On Tue, 29 Jun 2004, Luke Palmer wrote:

> >   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.

Yep, I understand that. However a possible scenario/workaround could be to 
have the stack-like void context work as above iff @STACK is explicitly 
(or implicitly, by means of some hypothetical function/operator referring 
to it) used and/or to have it activated (locally) by a 'use stack' pragma.

> To boot, I can't think of a way to implement that in currently-defined
> Perl 6, which should scare you.

It does!

> 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:
[snip]

Not so bad either...

I still wonder if there couldn't be another means of implementing it in a
reasonably safe way. For example with a special semantics for the
statement separator (e.g., ';;', if it's not already taken and/or if it's
not a nightmare to parse, etc.) so that (i) it could work also in other
contexts, (ii) typing two charachters instead of one would be difficult 
enough to prevent one from doing that unadvertently:

   my $i=1;;
   $i+=5;;
   for qw/foo bar baz/ { .subst /.(.*)/, {.1};; }
   # @STACK is now (1, 6, 'oo', 'ar', 'az')
   
But now I'm probably giving the impression than Im more keen on this thing 
than I actually am. Personally I find stack based languages conceptually 
interesting but I must admit that these concepts do not seem to fit too 
well with Perl's "look&feel". Though it is always lovely to have more and 
more WTDI in it...
;-)


Michele
-- 
> [ standard bull-shit snipped ]
>      Your friend,
>      Nathan the Great
>      Age 11

The best of your postings is the backside.
Please let the front also blank in the
future.
- Rainer Rosenthal in sci.math, "Re: Cantor Paradox :-)"

Reply via email to