Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7931871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:50:51+00:00 2026-06-03T20:50:51+00:00

While working my way through Cay S. Horstmann’s Scala for the Impatient, I noticed

  • 0

While working my way through Cay S. Horstmann’s “Scala for the Impatient”, I noticed something interesting revealed by the first exercise in the first chapter.

  1. In the Scala REPL, type 3. followed by the Tab key. What methods can be applied?

When I do this, I get the following

scala> 3.
%              &              *              +              -              /              
>              >=             >>             >>>            ^              asInstanceOf   
isInstanceOf   toByte         toChar         toDouble       toFloat        toInt          
toLong         toShort        toString       unary_+        unary_-        unary_~        
|       

But I noticed that if I hit Tab a second time, I get a slightly different list.

scala> 3.
!=             ##             %              &              *              +              
-              /                            >=             >>             >>>            ^              asInstanceOf   
equals         getClass       hashCode       isInstanceOf   toByte         toChar         
toDouble       toFloat        toInt          toLong         toShort        toString       
unary_+        unary_-        unary_~        |    

What is the REPL trying to tell me here? Is there something special about the different methods that appear the second time?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:50:52+00:00Added an answer on June 3, 2026 at 8:50 pm

    Hitting tab twice in the REPL raises the verbosity of the completion:

    If “methodName” is among z‘s completions, and verbosity > 0 indicating
    tab has been pressed twice consecutively, then we call alternativesFor
    and show a list of overloaded method signatures.

    The following methods from the interpreter source indicate what’s filtered for method completion when verbosity == 0 (i.e., when you’ve only hit tab once and aren’t getting the alternativesFor version):

    def anyRefMethodsToShow = Set("isInstanceOf", "asInstanceOf", "toString")
    
    def excludeEndsWith: List[String] = Nil
    
    def excludeStartsWith: List[String] = List("<") // <byname>, <repeated>, etc.
    
    def excludeNames: List[String] =
      (anyref.methodNames filterNot anyRefMethodsToShow) :+ "_root_"
    
    def exclude(name: String): Boolean = (
      (name contains "$") ||
      (excludeNames contains name) ||
      (excludeEndsWith exists (name endsWith _)) ||
      (excludeStartsWith exists (name startsWith _))
    )
    

    So with one tab you’re getting the methods filtered by some rules that the interpreter developers have decided are reasonable and useful. Two tabs gives you the unfiltered version.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, while working my way through Scala for the Impatient I found myself wondering:
While working my way through the Android tutorials, I came across something I don't
While working on something non-development related, I noticed something interested while on answers.com .
I'm working my way through the Node Beginner Tutorial while tailoring things to work
Thanks for any thoughts. while I am working my way through some custom validationAttributes,
I am working my way through a book called Head First C#. It doesnt
I'm working my way through Head First C#, and I'm a bit confused on
I'm working through learn python the hard way , and in exercise 33 extra
While working my way through The RSpec Book, I came across the as_null_object method.
While working through this exercise I ran into a problem. from sys import argv

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.