On Thursday, March 16, 2017 at 11:34:52 PM UTC, [email protected] wrote:
>
> > I'd wanted to take advantage of this a while back with an Elm->Rust 
> compiler, that just used Rc (reference counting) for everything, so there's 
> no garbage collection.
>
> I guess this is also interesting because (as I understand it) it's the 
> lack of garbage collection in WebAssembly that disqualifies it as a compile 
> target.  Might linear types be another approach?  
> http://blog.tweag.io/posts/2017-03-13-linear-types.html
>

Yes. I was wondering if no circular references simplifies garbage 
collection. Maybe it does, but not by much as all that is needed to stop GC 
going round in a circle is a 'mark' bit on every object to indicate that is 
has already been visited. If it was a copying collector, you'd probably 
still need the mark bit anyway, despite their being no circular references, 
as the mark bit is also used to indicate that there is a forwarding address 
in the copy-to space that pointers need to be updated to.

Another though I had on WebAssembly is that it is implemented as an LLVM 
back-end. LLVM does not provide a garbage collector, but it does provide 
some minimal support for implementing your own. Is it possible that there 
are already some good third party collectors for LLVM that could be used?

Either ref counting or the most naive mark-and-sweep collector sound like 
low effort ways to implement Elm on WebAssembly version 0.1.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to