On Mon, 2007-06-04 at 11:23 +0100, Sam Mason wrote:
> On Sun, Jun 03, 2007 at 10:16:47PM -0400, Jonathan S. Shapiro wrote:
> >   2. Captured by-reference arguments are legal in *escaping* closures,
> >      but a *copy* of the by-reference value is made at the time of
> >      closure construction.
> >
> >      This yields sensible behavior and preserves type safety, but it
> >      introduces behavioral subtlety that will confuse programmers. 
> 
> I think this would confuse the semantics a lot, apparently simple
> changes to an expression could change its behaviour considerably.

No more so (or less so) than any procedure call that is passed a
reference.

The reason I want this is that there is an idiom for writing constructor
and re-initializer procedures that requires it. The problem at present
is that there is no clean way to re-initialize a data structure that is
unboxed, nor any way to characterize field get/set as a procedure call
within the language.

> >      My intuition is that is is better to prohibit escaping capture of
> >      BY-REFERENCE parameters, even if this means that we must prohibit
> >      their capture in *all* closures.
> 
> Sounds a bit strong, but at least it could be relaxed without obvious
> problems later.

Oh I think it is too strong too, but we haven't got closure escape
analysis yet, and as you say it can be relaxed.

I do think it is better than "copy on closure formation", which appears
to be what the Felix folks are considering.


shap

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to