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

  • Home
  • SEARCH
  • 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 836859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:03:02+00:00 2026-05-15T05:03:02+00:00

Using XScalaWT , this compiled under Scala 2.7: class NodeView(parent: Composite) extends Composite(parent) {

  • 0

Using XScalaWT, this compiled under Scala 2.7:

class NodeView(parent: Composite) extends Composite(parent) {
  var nodeName: Label = null

  this.contains(
    label(
      nodeName = _
    )
  )
}

With 2.8.0 RC1, I get this error:

type mismatch; found : main.scala.NodeView required: org.eclipse.swt.widgets.Label

The types are:

label(setups: (Label => Unit)*)(parent: Composite) : Label
contains(setups: (W => Unit)*) : W

So it looks like _ now binds to the outer function instead of inner.

Is this change intentional?

UPDATE: Here is a minimized example:

Scala 2.7.7:

scala> var i = 0
i: Int = 0

scala> def conv(f: Int => Unit) = if (_:Boolean) f(1) else f(0)    
conv: ((Int) => Unit)(Boolean) => Unit

scala> def foo(g: Boolean => Unit) { g(true) }    
foo: ((Boolean) => Unit)Unit

scala> foo(conv(i = _))    

scala> i    
res4: Int = 1

Scala 2.8.0RC3:

scala> var i = 0
i: Int = 0

scala> def conv(f: Int => Unit) = if (_:Boolean) f(1) else f(0)
conv: (f: (Int) => Unit)(Boolean) => Unit

scala> def foo(g: Boolean => Unit) { g(true) }
foo: (g: (Boolean) => Unit)Unit

scala> foo(conv(i = _))
<console>:9: error: type mismatch;
 found   : Boolean
 required: Int
       foo(conv(i = _))
                  ^

scala> foo(conv(j => i = j))

scala> i
res3: Int = 1

Interestingly enough, this works:

scala> foo(conv(println _))
1
  • 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-05-15T05:03:02+00:00Added an answer on May 15, 2026 at 5:03 am

    Here is the answer I got from Lukas Rytz on the scala-user list:

    Hi Alexey,

    there has been a change in semantics
    when we introduced named arguments. An
    expression

    foo(a = _)
    

    used to be parsed as follows:

    foo(x => a = x)
    

    In 2.8, “a” is treated as a named
    argument, i.e. the expression is
    parsed as:

    x => foo(a = x)
    

    I will add a migration warning for
    this change.

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

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer A list function runs in a separate process (couchjs) which… May 16, 2026 at 4:03 pm
  • Editorial Team
    Editorial Team added an answer This is a line break in a WrapPanel: <WrapPanel> <TextBlock… May 16, 2026 at 4:03 pm
  • Editorial Team
    Editorial Team added an answer You should be able to perform a complete XSLT in… May 16, 2026 at 4:03 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Using C#, I need a class called User that has a username, password, active
Using jQuery's UI Tabs. This is my code. <div id=tabs> <ul> <li><a href=#tabs-1>Find a
Using online interfaces to a version control system is a nice way to have
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button
Using JDeveloper , I started developing a set of web pages for a project

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.