3 ms·
Out of curiosity, the docs state that closures are supported as zero-cost abstractions. That seems to imply that the language can store environments at zero cos
by jonathanstrange 8y ago
Out of curiosity, the docs state that closures are supported as zero-cost abstractions. That seems to imply that the language can store environments at zero cost. How is that possible?
- jlg23 8y agoThe author referenced[0] this paper: http://compilers.cs.uni-saarland.de/papers/lkh15_cgo.pdf http://compilers.cs.uni-saarland.de/papers/lkh15_cgo.pdf [0] https://lritterdevlog.hashbase.io/#toc8 https://lritterdevlog.hashbase.io/#toc8
- sanxiyn 8y agoIt does not imply that. Closures are usually implemented with environments, but this is unnecessary. You can compile so that everything that would be in the environment is passed as arguments. It seems to me Scopes is implemented this way.