I think it's quite good - it allows a programmer to conceptually separate her "normal" functions from lambda expressions, even if they're essentially equivalent, and one is syntactic sugar for another.
It's not duplicate syntax. `func` adds a named function to the current environment, and `->` only describes an anonymous function. It's the equivalent of `function foo(...)` vs `function(...)` in JS.
Re:Spider Programming Language
by fizzbatter on Monday November 17, 2014 @07:14PM
(#8621703)
Can you not `func(foo){}`? Because that is what would bother me.
`func(foo){}` and `(foo) ->` seem too similar, for my taste at least. Sure, the difference is that one is always anonymous, where as one is sometimes anonymous.. but we've been using `function` as both named and anonymous for ages
ES6 already has =>, I think that Spider should probably stay far away from trying to replicate existing language features with different syntax
Many functional languages have shortcut syntax for inline functions, e.g. in OCaml:
let f = fun x y -> x + y
Haskell: let f = \x y -> x + y
It looks that Spider uses a similar syntax, but uses uncurried form in line with function invocation syntax.I actually agree about this - two ways to do exactly the same thing is generally a bad thing when it comes to language design. But I think that a more important goal is to make the transition from Spider to JS as easy as possible.
Just my 2c.
Fwiw, i'm going to be trying this out asap - I have high hopes for this replacing my very heavy CoffeeScript usage!