TSa (Thomas Sandlaß) thomas-at-sandlass.de |Perl 6| wrote:
.......
    my $x = |$obj.foo(1,2); #4

to keep the ReturnCapture, and call it later either explicitly

    $x.resume(3);

or implicitly

    $x = 3;


Hope that helps, TSa.

Interesting idea, as an alternative to get/set methods like Microsoft languages. Do you have a pointer to the thread, or collected notes I could read?

Is there anything in Perl 6 as it stands now that really uses continuations like this?

I don't like the default lvalue subs as the exist now because I might want to do more than assign to the value located with the access. Even if that's fine now, how do I add an "clear_cache; tell_subscribers;" after the value is changed? It means adding the ugly C++ form and then changing all existing uses. But, I realized that the ability to return a tied scalar as a proxy object gives us this. You can specify an accessor that returns an object that has the getter/setter installed in the FETCH/STORE routines. A class can be written for the purpose, that takes blocks (anonomous methods) in the constructor, and a macro gives reasonable syntactic sugar for writing separate get/set methods right by the attribute.

I'm not sure about returning things other than a scalar.

But the point is, since it _can_ be done in a module, I'm punting on that and not lobbying for it for 6.0 when there is so much else that needs doing.

--John

Reply via email to