DEV Community

Discussion on: Exploring how Elm can target Web Assembly

Collapse
 
dubyabrian profile image
W. Brian Gourlie

I don't think the intention is to add a general purpose GC to WASM because GC implementations vary significantly based on language characteristics. I believe they intend to introduce GC primitives from which a GC can be implemented.

An Elm specific GC would actually be pretty simple as I understand it, thanks to all the assumptions that can be made with a pure, functional, eagerly evaluated language.

Collapse
 
robinheghan profile image
Robin Heggelund Hansen

Ahh, you're right. I didn't read the proposal properly. That's actually better though =)

Collapse
 
synalysis profile image
Synalysis

I'd also assume that what's called garbage collection here is due to the conclusion that if JavaScript needs one Elm will also need one.

Some years ago I wrote a PostScript interpreter and quite a while it worked very well without a garbage collector - all was done with reference counting. Apple shows with ARC (Automatic Reference Counting) that even a language much more complex than ELM can work without GC.

So as long as you don't have cyclic references reference counting should do the trick.