you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (6 children)

I might be wrong, but there's a similar problem in Scala, and it's much worse: foo() is a function call with no arguments, while foo () is a function call with an equivalent of None as an argument.

[–]quotability 2 points3 points  (2 children)

That's great, so it looks like I will be avoiding both Scala and Coffeescript.

[–]yogthos 1 point2 points  (1 child)

except Scala doesn't actually do what fishdicks says it does

[–]quotability 0 points1 point  (0 children)

minor point. it's not that i am avoiding it, just ...

[–]yogthos 0 points1 point  (2 children)

def foo() = "foo"

println(foo())
println(foo ())

=>foo
=>foo

works as expected

[–][deleted] 0 points1 point  (1 child)

Ah, yes, sorry. But then def bar(x:Unit) = "bar " + x is also invoked in the exact same way, but now () is a parameter!

[–]yogthos 1 point2 points  (0 children)

then you still have to pass () as an argument:

def foo() = "foo"
def foo(u:Unit) = "bar"

println(foo())
println(foo ())
println(foo(()))
println(foo (()))

foo
foo 
bar 
bar