top | item 37126579 (no title) polack | 2 years ago The real question is why they do Module.function() and then function.() instead of .function()?It makes no sense to have the dot at the end of an anonymous named function. discuss order hn newest sodapopcan|2 years ago `function()` is stored inside a `Module`, so we call `Module.function()`.An anonymous function "`()`" is stored inside a `variable`, so we call `variable.()`.It does make some good sense. It's even kinda elegant! darraghenright|2 years ago I've sometimes wondered if I am the only person who actually likes the syntax :D There's a reason for it, but additionally, I like the fact that it's explicit — I can look at `some_call.()` and specifically know it's an anonymous function. load replies (2) brightball|2 years ago When it's explained that way, it makes a lot of sense.
sodapopcan|2 years ago `function()` is stored inside a `Module`, so we call `Module.function()`.An anonymous function "`()`" is stored inside a `variable`, so we call `variable.()`.It does make some good sense. It's even kinda elegant! darraghenright|2 years ago I've sometimes wondered if I am the only person who actually likes the syntax :D There's a reason for it, but additionally, I like the fact that it's explicit — I can look at `some_call.()` and specifically know it's an anonymous function. load replies (2) brightball|2 years ago When it's explained that way, it makes a lot of sense.
darraghenright|2 years ago I've sometimes wondered if I am the only person who actually likes the syntax :D There's a reason for it, but additionally, I like the fact that it's explicit — I can look at `some_call.()` and specifically know it's an anonymous function. load replies (2)
sodapopcan|2 years ago
An anonymous function "`()`" is stored inside a `variable`, so we call `variable.()`.
It does make some good sense. It's even kinda elegant!
darraghenright|2 years ago
brightball|2 years ago