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 7944583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:35:42+00:00 2026-06-04T00:35:42+00:00

scala 2.9.2 This compiles fine object AppBuilder extends App { def app( blockw: Int

  • 0

scala 2.9.2
This compiles fine

object AppBuilder extends App {

  def app( blockw: Int => String ) : List[String] = List( blockw(6) )

  def app( block: => String ) : List[String] = app( _ => block )
}

But in REPL, the same methods/functions ( not sure about the distinction here) as above, when not enclosed in a class, I get the following errors

scala> def app( blockw: Int => String ) : List[String] = List( blockw(6) )
app: (blockw: Int => String)List[String]

scala> def app( block: => String ) : List[String] = app( _ => block )
<console>:8: error: missing parameter type
       def app( block: => String ) : List[String] = app( _ => block )
                                                     ^
  • 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-04T00:35:43+00:00Added an answer on June 4, 2026 at 12:35 am

    Overloaded methods aren’t currently supported in the REPL—see this answer for an explanation of why. You can prove this with a much simpler example:

    scala> def f(x: Int) = x
    f: (x: Int)Int
    
    scala> def f(x: String) = x
    f: (x: String)String
    

    Now try f(0), and you’ll get a type mismatch.

    You can use paste mode as a workaround:

    scala> :paste
    // Entering paste mode (ctrl-D to finish)
    
    def app( blockw: Int => String ) : List[String] = List( blockw(6) )
    def app( block: => String ) : List[String] = app( _ => block )
    
    // Exiting paste mode, now interpreting.
    
    app: (blockw: Int => String)List[String] <and> (block: => String)List[String]
    app: (blockw: Int => String)List[String] <and> (block: => String)List[String]
    

    But you’d probably be better off avoiding overloading.

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

Sidebar

Related Questions

List(This,is,Scala).foreach(a => print(a+ )) compiles fine, but List(This,is,Scala).foreach(print(_+ )) fails complaining of missing parameter
I have this snippet of Scala code: def prologList(l: List[ScalaObject], sep: String) = [
Given this Scala code: object test { def byval(a: Int) = println(Int) def byval(a:
I'm using Scala 2.8 and defining an Enumeration like this: object Stooges extends Enumeration
Consider the file bug.scala : package sandbox object Foo { implicit def stringToInt(s: String)
I have this method: scala> def foo(traversable: Traversable[{def toByte: Byte}]) = { | traversable.map(_.toByte)
consider this piece of scala swing code detail.reactions += { case ButtonClicked(but) => detail.contents
This is the same question for older version of Scala, but they say that
In Scala, how can I do something like this: def cast [Type] (x: _
The following compiles just fine using scala Beta1 and scalaz snapshot 5.0: val p1:

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.