On Tue, Dec 23, 2014 at 4:53 PM, William ML Leslie <
[email protected]> wrote:

> On 24 December 2014 at 11:26, Jonathan S. Shapiro <[email protected]>
> wrote:
>


> > let captured mutable x = initializer in ...
>
> Is the existing box (ref) not sufficient?


Yes and no. I guess you could do something like:

let* boxed_i = boxed (mutable 0);
      i = reference_to(*boxed_i) in
  for i = 1 to 10 do
    ... make closure here ...


the reason for the *reference_to* being to avoid saying *boxed_i
everywhere. And note that reference escape here would be legal under a
region system, because that reference names an object in the global heap
region.

What this pattern *doesn't* do is (a) signal your intent, or (b) provide a
syntactically reasonable or succinct solution. It also doesn't work as a
way to say that induction variables bound by an inducting form should be
capturable.

So yeah, it can be done, and I'm not sure this problem scenario is worth
burning a keyword, but it's damned ugly.


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

Reply via email to