Better HN
topnewbestaskshowjobs
Log inSign up

utterwise

5 karma · joined Aug 25, 2023 (3y ago) · 2 submissions

Submissions

comment 3y ago · link · parent

It 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.

comment 3y ago · link · parent

> However, things like closures, composition at runtime and partial function application just made everything 10x harder.

Closures are just functions with an extra parameter for the environment (free variables). Subsequent passes after desugaring can treat them like any other function.

Function composition and currying should also be static transformations. Maybe you made it harder than it has to be?