tj / luna

luna programming language - a small, elegant VM implemented in C
2.45k stars 147 forks source link

def or fun ? #40

Closed DAddYE closed 11 years ago

DAddYE commented 11 years ago

Honestly I prefer def in OO, I see better fun in luna especially for anonymous stuff (if you'll ever want to support it):

a=fun(a:int, b:string){}

or

fun bar() do
   a = fun(){ long_job }
   promise = async(a)
end

but here I see the js problem where:

a = func(){} or func a(){} ?

z0w0 commented 11 years ago

+1 for renaming def to fun. I think it fits in better in with the rest of the language.

tj commented 11 years ago

no way! def is way better IMO, we'll need a terse lambda style token anyway, def or fun both look really weird in that context IMO, but I love def at the root level, and to be quite honest the more I use closures the more I feel that closures just create a mess (within reason)

DAddYE commented 11 years ago

Mmm, I see! I like also the Guido style!! :D That's the correct way!

tj commented 11 years ago

what's that haha