Hacker News new | past | comments | ask | show | jobs | submit login

The only thing i don't like so far, is `func` and `->` both expressing functions. I use Coffee a ton, and Golang, so oddly enough i love both syntaxes.. but i don't like multiple ways to declare a core feature like functions.

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!




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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: