2 ms·
If functions are higher order then the distinction between plain functions and closures is retained (unless you treat all functions as closures). This is becaus
by tsegratis 3y ago
If functions are higher order then the distinction between plain functions and closures is retained (unless you treat all functions as closures). This is because the data needs to be passed around in the function pointer. If not higher order then yes, they desugar
Implementing these things is maybe easy for you ;) but for myself, doing it well, I would definitely not describe as a walk in the park
- utterwise 3y agoIt is true you need to pass the environment around, but if the language you are implementing also has objects or structs then you will need to implement that anyway. My main objection to the grand parent is the idea that functional languages are 10x more difficult to implement than mainstream languages. Maybe that is true for Haskell, but most functional features can be compiled efficiently without much additional complexity. The complexity added by closures for instance would be closer to 1% than 10x.