<div dir="ltr"><div>On Thu, Aug 27, 2015 at 1:24 PM, Edward Z. Yang <span dir="ltr"><<a href="mailto:ezyang@mit.edu" target="_blank">ezyang@mit.edu</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">It seems to me that we should take a page from OCaml's playbook<br>
and add support for native mutable fields in objects, because<br>
this is essentially what a mix of words and pointers is.<br></blockquote><div><br></div><div>That actually doesn't work as well as one might hope.<div><br></div><div>We currently treat data constructor closures as so much tissue paper around a present. We tear them open, rip out all their contents, scatter them throughout our code and then we build a whole new data constructor closure when we're done, or we just leave them suspended in closures awaiting someone to demand we finally make a new data constructor. </div><div><br></div><div>Half the time we don't even give back the data constructor closure and push it into update g frames and we just give back the items on the stack.</div></div><div><br></div><div>With the machinery I mentioned above I get a world where every time I access an object I can know it is evaluated for real, so this means I'm not stuck 'entering an unknown closure', and getting it to give me back a slab of memory that we know is a real data constructor that i can bang away on mutable entries in.</div><div><br></div><div>In a world where things in * could hold mutable pointers we have to care a lot more about object identity in deeply uncomfortable ways.</div><div><br></div><div>With what I've implemented I only care about object identity between things in # that are gcptrs. The garbage collector may move them around, but it doesn't put in thunks anywhere.</div><div><br></div><div>-Edward</div></div></div></div>