develooper Front page | perl.perl6.internals | Postings from February 2001

lazy || and vtables

From:
David Mitchell
Date:
February 21, 2001 08:15
Subject:
lazy || and vtables
Message ID:
200102211615.QAA03265@tiree.fdgroup.co.uk
Following up from a thread a couple of weeks ago,

Dan wrote:
> > Dave wrote:
> >Hmmm, I can't quite how that trick works. How whould the following get
> >evaluated:
> >
> >$opened || open(F, ...)
>
> The second PMC would point to a lazy list, so it wouldn't be evaluated 
> unless its value gets fetched.

Do you have any more details how this 'lazy list' would work?
The only way I can think is to have an 'execution' vtable type,
which initially holds a pointer to a CV or an area of bytecode or somat,
but when asked for it's value, executes itself and morphs into the result
of the expression.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About