This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Change of string representation of function or tuple

2 replies
Antoras
Joined: 2010-05-23,
User offline. Last seen 1 year 19 weeks ago.

scalac prints a function the same way as a tuple:

scala> def f: (String, Int) => Unit = (a, b) => ()
f: (String, Int) => Unit

scala> def g: ((String, Int)) => Unit = a => ()
g: (String, Int) => Unit

This leads to incomprehensible error messages. One of them is mentioned
in this topic on StackOverflow [1].

I think either the string representation of tuples or the one of
functions should be changed.

Is there already a topic discussing this? If not, do you agree to change
the string representations?

[1] http://stackoverflow.com/questions/8610776/scala-map-foreach

paulbutcher
Joined: 2010-03-08,
User offline. Last seen 10 weeks 5 days ago.
Re: Change of string representation of function or tuple

I believe that this has already been fixed and will be rolled out in 2.9.2:

https://issues.scala-lang.org/browse/SI-5067

On 23 Dec 2011, at 00:54, Antoras wrote:
> scalac prints a function the same way as a tuple:
>
> scala> def f: (String, Int) => Unit = (a, b) => ()
> f: (String, Int) => Unit
>
> scala> def g: ((String, Int)) => Unit = a => ()
> g: (String, Int) => Unit
>
> This leads to incomprehensible error messages. One of them is mentioned in this topic on StackOverflow [1].
>
> I think either the string representation of tuples or the one of functions should be changed.
>
> Is there already a topic discussing this? If not, do you agree to change the string representations?
>
> [1] http://stackoverflow.com/questions/8610776/scala-map-foreach

--
paul.butcher->msgCount++

Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: paul [at] paulbutcher [dot] com
AIM: paulrabutcher
Skype: paulrabutcher

Antoras
Joined: 2010-05-23,
User offline. Last seen 1 year 19 weeks ago.
Re: Change of string representation of function or tuple

That are good news. Topic finished.

On 12/23/2011 02:07 AM, Paul Butcher wrote:
> I believe that this has already been fixed and will be rolled out in 2.9.2:
>
> https://issues.scala-lang.org/browse/SI-5067
>
> On 23 Dec 2011, at 00:54, Antoras wrote:
>> scalac prints a function the same way as a tuple:
>>
>> scala> def f: (String, Int) => Unit = (a, b) => ()
>> f: (String, Int) => Unit
>>
>> scala> def g: ((String, Int)) => Unit = a => ()
>> g: (String, Int) => Unit
>>
>> This leads to incomprehensible error messages. One of them is mentioned in this topic on StackOverflow [1].
>>
>> I think either the string representation of tuples or the one of functions should be changed.
>>
>> Is there already a topic discussing this? If not, do you agree to change the string representations?
>>
>> [1] http://stackoverflow.com/questions/8610776/scala-map-foreach
> --
> paul.butcher->msgCount++
>
> Snetterton, Castle Combe, Cadwell Park...
> Who says I have a one track mind?
>
> http://www.paulbutcher.com/
> LinkedIn: http://www.linkedin.com/in/paulbutcher
> MSN: paul [at] paulbutcher [dot] com
> AIM: paulrabutcher
> Skype: paulrabutcher
>
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland