Skip to content

Instantly share code, notes, and snippets.

@paulp
Last active August 29, 2015 14:25
Show Gist options
  • Save paulp/6d69b71bd6f2ee272762 to your computer and use it in GitHub Desktop.
Save paulp/6d69b71bd6f2ee272762 to your computer and use it in GitHub Desktop.
parens vs. braces
scala> case class Foo(x: Int = -12345)
defined class Foo
scala> def y = 5
y: Int
scala> val x = Foo(y)
x: Foo = Foo(5)
scala> val x = Foo{y}
x: Foo = Foo(5)
scala> val x = new Foo(y)
x: Foo = Foo(5)
scala> val x = new Foo{y}
x: Foo = Foo(-12345)
@adriaanm
Copy link

scala> x.getClass
res0: Class[_ <: Foo] = class $anon$1

@som-snytt
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment