News for hackers. Stuff that matters.
Re:CoffeeScript -- You Are Totally Gonna Hate It by 10ren on Saturday July 17, 2010 @11:16AM (#1523901)
The "try coffeescript" demo (http://jashkenas.github.com/coffee-script/) is really cool. It converts to javascript in realtime/as you type, including error checking on the fly.

I like the lambda syntax (I don't recall seeing exactly this syntax before):

    () -> alert("lambda")

    (() -> alert("lambda")) ()     # to call it
Re:CoffeeScript -- You Are Totally Gonna Hate It by jashkenas on Saturday July 17, 2010 @11:21AM (#1523911)
CoffeeScript lets you leave off parentheses when they're not necessary to describe what you mean. Your example can also be written as:

    -> alert 'lambda'

    (-> alert 'lambda')()  # to call it
Re:CoffeeScript -- You Are Totally Gonna Hate It by d0m on Saturday July 17, 2010 @12:38PM (#1524094)
It's a matter of opinion, but I don't particularly like when you can "omit" things.. and sometime it works and sometime it doesn't. Yes, sometime it makes the code a little clearer, but it can often lead to sneaky bugs and confusion.

I mean:

map x -> xx seq

might be readable ..

but:

map x -> xx seq seqs

is less clear.. while:

(map (x -> x*x) (seq seqs)) is more readable.

Re:CoffeeScript -- You Are Totally Gonna Hate It by jashkenas on Saturday July 17, 2010 @01:26PM (#1524211)
My two cents on optional parentheses, optional commas, and optional syntax in general are that it's about readability and style. If the statement that you're writing isn't clear without disambiguating the structure, then by all means, use parentheses. But if you're choosing between this:

    print("Hello");
And this:

    print "Hello"
(Which are equivalent in CoffeeScript) ... I'll take the latter every time.
Re:CoffeeScript -- You Are Totally Gonna Hate It by aaronblohowiak on Saturday July 17, 2010 @01:17PM (#1524189)
it also increases the friction when you are editing; the question in your mind must be "does this edit require the implicit to be made explicit?" Editor support can help alleviate the drudgery of the change, but I prefer to pay up-front.
Re:CoffeeScript -- You Are Totally Gonna Hate It by djacobs on Saturday July 17, 2010 @01:23PM (#1524203)
aaronblohowiak, I wonder if "pay up front" is analogous to pre-mature optimization?

I'm thinking out loud, mainly because I tend to use the simplest syntax possible when coding in languages that allow for multiple syntaxes (i.e., Ruby). Most of the time, my decisions (at least) work out for me, and I don't have to go back and (say) add parentheses.

Re:CoffeeScript -- You Are Totally Gonna Hate It by gnaritas on Saturday July 17, 2010 @12:52PM (#1524129)
That's very similar to the C# syntax

    () => expression
    arg => expression
    arg, arg2 => expression
    arg => { statement; expression }