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.

> The by-ref model is actually a degenerate form of region
> typing, since we do not allow escape at all (rather than allowing it as
> long as the target region is guaranteed to be in a later activation).

If you're already doing some sort of region typing then this should be
being checked for and everything should be OK.  I guess I'm missing
something then!

Hum, thinking about it a bit more.  I'm not sure what you meant by
"there is no problem as long as the reference does not escape its
definition".  The definition of what?  Using shap's example:

  (define (outer x:(by-ref 'a))
    (lambda (y)
      (pair y x)))

As an aside, shap spelt the inner expression (pair y,x) and I'm not sure
why; I thought it would be either (y,x) or (pair y x).

On a first reading, I thought you meant that x has escaped the
definition of "outer", but this, on its own, isn't unsafe.  It's only
bad when x escapes the definition of whatever it's referencing.  For
example, the following use of outer is safe:

  (let ((z 1))
    (snd (outer z)))

because the reference to z never escapes its definition.  Again, I'm
unsure of the semantics, is the "let" even needed? from a functional
coding point of view it would be nice if it wasn't.

Is that sort of correct, or have I missed the point entirely?


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

Reply via email to