-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler flags for literal types? #12
Comments
The example val theAnswer: 42 = 42 does not work in (non-Typelevel) Scala 2.11.11 nor 2.12.3. scala> val theAnswer: 42 = 42
<console>:1: error: identifier expected but integer literal found.
val theAnswer: 42 = 42
^ According to the callout on p56 it should, right? |
Do you have `scalacOptions += "-Yliteral-types"` in your `build.sbt`? I
think you need to enable that for literal types. I can't remember how much
I go into this stuff in the book, but I wouldn't be surprised if it wasn't
clear enough.
…On Thu, Sep 7, 2017 at 6:37 PM Simeon H.K. Fitch ***@***.***> wrote:
The example
val theAnswer: 42 = 42
does *not* work Lightbend 2.11.11 nor 2.12.3.
scala> val theAnswer: 42 = 42
<console>:1: error: identifier expected but integer literal found.
val theAnswer: 42 = 42
^
According to the callout on p56 it should, right?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOI52gEdAfBF9RfYw28V1ZwDmaACMTtks5sgCnAgaJpZM4Kma36>
.
|
When I posted that I was looking at the PDF version at work. At home I have the paperback version, and noted there that it does reference the All that said, this is what I'm getting with 2.12.3: sfitch$ scalac -version
Scala compiler version 2.12.3 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
sfitch$ scalac -Yliteral-types
scalac error: bad option: '-Yliteral-types'
scalac -help gives more information |
Thanks for the update. I'll look into the book text in a next set of
updates.
I'm guessing 2.12.3 may have -Yliteral-types enabled by default?
…On Fri, Sep 8, 2017 at 2:02 PM Simeon H.K. Fitch ***@***.***> wrote:
When I posted that I was looking at the PDF version at work. At home I
have the paperback version, and noted there that it *does* reference the
-Yliteral-types flag. So it looks like the Lulu version is more up to
date than the free PDF version.
All that said, this is what I'm getting with 2.12.3:
sfitch$ scalac -version
Scala compiler version 2.12.3 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
sfitch$ scalac -Yliteral-types
scalac error: bad option: '-Yliteral-types'
scalac -help gives more information
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOI50YRa8WKwtQvhwAmSgKfakFPAi3jks5sgTrPgaJpZM4Kma36>
.
|
Nope: sfitch$ scala -version
Scala code runner version 2.12.3 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
sfitch$ scala -Yliteral-types
bad option: '-Yliteral-types'
Usage: scala <options> [<script|class|object|jar> <arguments>]
or scala -help
All options to scalac (see scalac -help) are also allowed.
sfitch$ scala
Welcome to Scala 2.12.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121).
Type in expressions for evaluation. Or try :help.
scala> val theAnswer: 42 = 42
<console>:1: error: identifier expected but integer literal found.
val theAnswer: 42 = 42
^ |
Update on this: it looks like the PR for literal types isn't yet merged into Lightbend Scala. Probably worth updating the text to say "...and coming soon in Lightbend Scala". |
Thanks for this. I'll correct for the next version. To be honest I get
confused as to what's available where. Too many updates! Still, it's a good
problem to have :)
…On Fri, 15 Sep 2017 at 16:51, Richard Dallaway ***@***.***> wrote:
Update on this: it looks like the PR for literal types isn't yet merged
into Lightbend Scala. Probably worth updating the text to say "...and
coming soon in Lightbend Scala".
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAOI5ztlEwpYQVePnQsfw5YHNKvzlA8Kks5sipzdgaJpZM4Kma36>
.
|
Reported by @d6y:
Box on "Literal types in Scala", p. 56
There's a flag to enable this stuff, right? Worth saying that?
As of Lightbend Scala....., with the -wibble flag enabled, we now have direct syntax support...
The text was updated successfully, but these errors were encountered: