On Wed, Mar 12, 2008 at 10:44:02AM -0400, Jonathan S. Shapiro wrote:
> On Wed, 2008-03-12 at 12:00 +0000, Sam Mason wrote:
> > On Tue, Mar 11, 2008 at 05:54:01PM -0400, Swaroop Sridhar wrote:
> > > The by-ref operator is a limited form of the address (&) operator. There
> > > is actually no problem as long as the reference does not escape its
> > > definition. 
> > 
> > Then I'm confused, I thought that was the point of shap's original
> > email---the fact that by-refs can escape.
> 
> Swaroop later corrected me, though now that I think about it again I am
> not convinced that he had it right.
> 
> Ignoring BY-REF, any stack-allocated closed-over variable is forced into
> the heap so that the stack frame is not aliased by the closure. This is
> done automatically by the compiler. Swaroop and I sometimes refer to
> this process as "heapification".

OK, I didn't realise it was doing this.  It'll be fun/awkward writing
code that doesn't do any heapification then :) I've also just thought of
another issue with mutable by-refs, I think it's going to make auditing
harder?  Take the following function:

  (defun (f x : (mutable int32))
    (g x)
    x)

How do I know, without looking at it, whether g is going to change
the value of x.  Without by-ref's, I know that it can't---it can only
change it's own private copy.  I thought this was a big complaint of the
similar feature in C++.


I'm still thinking about the rest of your message.


  Sam
_______________________________________________
bitc-dev mailing list
bitc-dev@coyotos.org
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to