YouTube link: https://www.youtube.com/watch?v=e687bFp2FT4
Our guest is Martin Odersky, the creator of Scala. We invited him on specifically to discuss Dotty, a new compiler for Scala.
Your hosts this episode: Josh Suereth,
scala> import scala.language.reflectiveCalls | |
import scala.language.reflectiveCalls | |
scala> type Structural = { def foo: Int; def foo_=(x: Int): Unit } | |
defined type alias Structural | |
scala> object O { var foo = 5 } | |
defined object O | |
scala> (O: Any).asInstanceOf[Structural].foo = 10 |
YouTube link: https://www.youtube.com/watch?v=e687bFp2FT4
Our guest is Martin Odersky, the creator of Scala. We invited him on specifically to discuss Dotty, a new compiler for Scala.
Your hosts this episode: Josh Suereth,
YouTube link: https://www.youtube.com/watch?v=BYm634_OfTk
We review the amazing year of 2015 and make predictions for 2016, as well as read off and discuss some user predictions.
Your hosts this episode: Josh Suereth, Dick Wall, Heather Miller,
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_66). | |
scala> implicit class Foo(val x: Int) { def foo = x * 2 } | |
defined class Foo | |
scala> 3.x | |
res0: Int = 3 | |
scala> :reset | |
Resetting interpreter state. |
# repo is https://github.com/SethTisue/Project-Euler | |
% sbt | |
[info] Loading global plugins from /Users/tisue/.sbt/0.13/plugins | |
[info] Updating {file:/Users/tisue/.sbt/0.13/plugins/}global-plugins... | |
[info] Resolving org.fusesource.jansi#jansi;1.4 ... | |
[info] Done updating. | |
[info] Loading project definition from /Users/tisue/euler/project | |
[info] Updating {file:/Users/tisue/euler/project/}euler-build... | |
[info] Resolving org.fusesource.jansi#jansi;1.4 ... |
The "collections" part of the original episode name will be covered once we have Josh back.
YouTube link: https://www.youtube.com/watch?v=qkTptEosN-o
Your hosts this episode: Dick Wall, Daniel Spiewak,
YouTube link: https://www.youtube.com/watch?v=RmezAWtGmWg
Your hosts: Josh Suereth, Dick Wall, Seth Tisue
Join us during and between episodes for web-based Scalawags chat on Gitter.
scala> def one = { println("hey!"); 1 } | |
one: Int | |
scala> val endlessParadeOfOnes = Stream.continually(one) | |
hey! | |
endlessParadeOfOnes: scala.collection.immutable.Stream[Int] = Stream(1, ?) | |
scala> endlessParadeOfOnes.take(5).sum | |
hey! | |
hey! |
Ichoran
Anyway, point being that all lazy vals have a bit of performance overhead, local and nonlocal. Hand-coding will generally be better if you can keep everything on the stack.
viktorklang Oct 12 19:32
IMHO lazy val should be non-thread safe and @volatile lazy val should be thread safe...
Ichoran Oct 12 19:40
@viktorklang - Yeah, that'd be nice. Or at least allow a @nonvolatile annotation to opt-in to the thread-unsafe version.