- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Unit unique value is (), not {}, is it ?
Thu, 2011-04-07, 11:31
Hello,
I thought that Unit unique value was (), but in the specification
(section 4.2, 4.6.3), it is said that {} is.
Elsewhere, in section 6.9 "Tuples", it is said that "The empty tuple ()
is the unique value of type scala.Unit", and again in 6.11 "unit value
() is assumed", and again in 12.2.3 for the definition of Class Unit.
So, I suppose that that last chapter is right, is it ? If so, are
references to {} errors, or please could someone explain me why they are
not (I thought that {} was syntactic sugar for {()}).
Thanks !
Thu, 2011-04-07, 14:37
#2
Re: Unit unique value is (), not {}, is it ?
On Thu, Apr 7, 2011 at 12:31 PM, Francois <fanf42@gmail.com> wrote:
Hello,It was a oversight in the SLS. () is correct. Thanks for pointing out the error.
I thought that Unit unique value was (), but in the specification (section 4.2, 4.6.3), it is said that {} is.
Elsewhere, in section 6.9 "Tuples", it is said that "The empty tuple () is the unique value of type scala.Unit", and again in 6.11 "unit value () is assumed", and again in 12.2.3 for the definition of Class Unit.
So, I suppose that that last chapter is right, is it ? If so, are references to {} errors, or please could someone explain me why they are not (I thought that {} was syntactic sugar for {()}).
-- Martin
Thu, 2011-04-07, 16:57
#3
Re: Unit unique value is (), not {}, is it ?
On 4/7/11 3:31 AM, Francois wrote:
> I thought that Unit unique value was (), but in the specification
> (section 4.2, 4.6.3), it is said that {} is.
Trivia: tuples used to be denoted with {}. Parens were as big an
improvement as you might imagine.
Thu, 2011-04-07, 17:37
#4
Re: Unit unique value is (), not {}, is it ?
On Thu, Apr 7, 2011 at 5:37 PM, Paul Phillips <paulp@improving.org> wrote:
On 4/7/11 3:31 AM, Francois wrote:
I thought that Unit unique value was (), but in the specification
(section 4.2, 4.6.3), it is said that {} is.
Trivia: tuples used to be denoted with {}. Parens were as big an improvement as you might imagine.
Paul, if you want to make some extra cash you could always assemble a deck of Trivial Pursuit: Scala and sell online ;-)
--
Viktor Klang,
Director of Research and Development
Scalable Solutions
Code: github.com/viktorklang
Follow: twitter.com/viktorklang
Read: klangism.tumblr.com
Thu, 2011-04-07, 18:07
#5
Re: Unit unique value is (), not {}, is it ?
Am 07.04.2011 um 12:31 schrieb Francois:
> I thought that Unit unique value was (), but in the specification (section 4.2, 4.6.3), it is said that {} is.
https://lampsvn.epfl.ch/trac/scala/ticket/3704
:-)
bye, Thomas
Thu, 2011-04-07, 18:47
#6
Re: Unit unique value is (), not {}, is it ?
On Thu, Apr 7, 2011 at 6:56 PM, Thomas Much <thomas@snailshell.de> wrote:
Am 07.04.2011 um 12:31 schrieb Francois:Fixed now, thanks. -- Martin
> I thought that Unit unique value was (), but in the specification (section 4.2, 4.6.3), it is said that {} is.
https://lampsvn.epfl.ch/trac/scala/ticket/3704
:-)
bye, Thomas
--
----------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Scala Solutions
PSED, 1015 Lausanne, Switzerland
Ken
On 7 April 2011 20:31, Francois <fanf42@gmail.com> wrote: