soegaard2
2017-7-31 19:22:00

Reading expander/run/linklet.rkt. Why are the imports boxed? https://github.com/racket/racket7/blob/master/pkgs/expander/run/linklet.rkt#L166


mflatt
2017-7-31 21:23:28

@soegaard2 Linklets import and export variables (as opposed to values), and the variables are potentially mutable


mflatt
2017-7-31 21:24:44

But the “schemify” linklet-to-lambda compiler performs the modest cross-linklet optimization of avoiding the box if the variable is never mutated


soegaard2
2017-7-31 21:32:33

Ok. Not sure when mutation is needed though. Reading the code for the various subsystems help. Biggest problem so far was connecting the dots in how the linklets in a bundle needs to be evaluated. Reading eval-module helped.


mflatt
2017-7-31 21:38:04

Modules don’t often export variables that are set!ed, but it happens sometimes, and then the corresponding linklet will need to export a mutable variable


soegaard2
2017-7-31 21:40:52

Ok. Good to know.


notjack
2017-7-31 21:57:23

banning set! and requiring mutation with boxes instead of bindings has always seemed like a decent racket2 idea to me


abmclin
2017-7-31 22:56:00

interesting idea, I hadn’t thought about that. Most of the time when I use set! it’s because I needed to save some simple data. I can see using a box and set-box! would be a perfectly good substitution for set!