Michele Dondi writes: > On Thu, 24 Jun 2004, Luke Palmer wrote: > > > > However I wonder if an implicit stack could be provided for return()s into > > > void context. It is well known that currently split() in void context has > [snip] > > To be honest, I have no idea what you're asking for. Might you explain > > in a little more detail? > > Well, something like a predefined (e.g.) @STACK variable such that > something along the lines of this can work in the obvious way: > > 1; > $_='foo bar baz'; > split; > # @STACK now is (1, 'foo', 'bar', 'baz'); > > I can imagine some uses for that...
Sick... and... wrong. :-) Not only would it mess with what things have to do in void context, it would fudge up the garbage collector to no end. You'd have objects lying around in @STACK, where no sane programmer would ever use them, and be wondering why their DESTROY hasn't been called yet. To boot, I can't think of a way to implement that in currently-defined Perl 6, which should scare you. So, yeah, no, Perl 6 won't be doing that. But if you don't mind being a little more explicit, this is nice and easy: our @STACK; sub p ([EMAIL PROTECTED]) { push @STACK, @args } p 1; $_ = 'foo bar baz'; p split; # @STACK is now (1, <<foo bar baz>>); Luke