[scala] Numeric symbols?

View: New views
3 Messages — Rating Filter:   Alert me  

[scala] Numeric symbols?

by Eric Willigers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Welcome to Scala version 2.7.5.final
scala> val a = '1
<console>:1: error: missing terminating quote
        val a = '1
                ^

Welcome to Scala version 2.8.0.r18236-b20090708020214
scala> val a = '1
a: Symbol = '1

Is the change in behaviour intended?


I'm enjoying Wampler and Payne's upcoming book, it is making me check
things I thought I understood.
http://programming-scala.labs.oreilly.com/ch02.html#SymbolLiterals


Re: [scala] Numeric symbols?

by Dean Wampler-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Interesting. I didn't know that behavior changed. Since we try to cover v2.8, we need to amend that paragraph in the book!

On Thu, Jul 9, 2009 at 6:03 AM, Eric Willigers <ewilligers@...> wrote:

Welcome to Scala version 2.7.5.final
scala> val a = '1
<console>:1: error: missing terminating quote
      val a = '1
              ^

Welcome to Scala version 2.8.0.r18236-b20090708020214
scala> val a = '1
a: Symbol = '1

Is the change in behaviour intended?


I'm enjoying Wampler and Payne's upcoming book, it is making me check things I thought I understood.
http://programming-scala.labs.oreilly.com/ch02.html#SymbolLiterals




--
Dean Wampler
coauthor of "Programming Scala" (O'Reilly)
-  http://programmingscala.com
twitter: @deanwampler, @chicagoscala
Chicago-Area Scala Enthusiasts (CASE):
-  http://groups.google.com/group/chicagoscala
-  http://www.meetup.com/chicagoscala/ (Meetings)
http://www.objectmentor.com
http://www.polyglotprogramming.com
http://www.aspectprogramming.com
http://aquarium.rubyforge.org
http://www.contract4j.org

Re: [scala] Numeric symbols?

by Martin Odersky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Jul 12, 2009 at 6:26 PM, Dean Wampler<deanwampler@...> wrote:
> Interesting. I didn't know that behavior changed. Since we try to cover
> v2.8, we need to amend that paragraph in the book!
>
Don't. I think it is a regression. I am going to change the compiler
to make it illegal.

Cheers

 -- Martin

> On Thu, Jul 9, 2009 at 6:03 AM, Eric Willigers <ewilligers@...> wrote:
>>
>> Welcome to Scala version 2.7.5.final
>> scala> val a = '1
>> <console>:1: error: missing terminating quote
>>       val a = '1
>>               ^
>>
>> Welcome to Scala version 2.8.0.r18236-b20090708020214
>> scala> val a = '1
>> a: Symbol = '1
>>
>> Is the change in behaviour intended?
>>
>>
>> I'm enjoying Wampler and Payne's upcoming book, it is making me check
>> things I thought I understood.
>> http://programming-scala.labs.oreilly.com/ch02.html#SymbolLiterals
>>
>
>
>
> --
> Dean Wampler
> coauthor of "Programming Scala" (O'Reilly)
> -  http://programmingscala.com
> twitter: @deanwampler, @chicagoscala
> Chicago-Area Scala Enthusiasts (CASE):
> -  http://groups.google.com/group/chicagoscala
> -  http://www.meetup.com/chicagoscala/ (Meetings)
> http://www.objectmentor.com
> http://www.polyglotprogramming.com
> http://www.aspectprogramming.com
> http://aquarium.rubyforge.org
> http://www.contract4j.org
>