Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-22 Thread Larry Wall
On Tue, Nov 22, 2005 at 10:12:00AM +0100, Michele Dondi wrote: : Oh, I'm not the person you were responding to, and probably the less : entitled one to speak in the name of everyone else here, but I feel like : doing so to say that in all earnestness I'm quite sure no one took any : offense out

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-22 Thread Michele Dondi
On Mon, 21 Nov 2005, Larry Wall wrote: I would like to publicly apologize for my remarks, which were far too harsh for the circumstances. I can only plead that I was trying to be far too clever, and not thinking about how it would come across. No, to be perfectly honest, it was more culpable th

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Larry Wall
On Mon, Nov 21, 2005 at 11:43:21AM -0800, Larry Wall wrote: : Let's see, where did I put my stash of generic quotes? I would like to publicly apologize for my remarks, which were far too harsh for the circumstances. I can only plead that I was trying to be far too clever, and not thinking about h

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Larry Wall
On Mon, Nov 21, 2005 at 02:05:31PM -0500, Rob Kinyon wrote: : This is very close to a proposal I made to the ruby-dev mailing list : (which was Warnocked). I proposed a very basic engine that would work : with the parser/lexer to determine what action to take instead of : using the huge case statem

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Rob Kinyon
On 11/21/05, TSa <[EMAIL PROTECTED]> wrote: > HaloO, > > Luke Palmer wrote: > > On 11/21/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > > > >>Of course, the compiler is free to optimize these things if it can prove > >>that runtime's &statement_control: is the same as the internal > >>optimized

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Larry Wall
On Mon, Nov 21, 2005 at 10:45:56AM -0800, Larry Wall wrote: : Another issue in "if" optimization is whether the blocks in fact do : anything blockish that have to be scoped to the block. This is a : determination that Perl 5 makes when it's compiling blocks. It's : basically an attribute that mig

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Larry Wall
On Mon, Nov 21, 2005 at 03:51:19PM +, Luke Palmer wrote: : On 11/21/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: : > Of course, the compiler is free to optimize these things if it can prove : > that runtime's &statement_control: is the same as the internal : > optimized &statement_control:.

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread TSa
HaloO, Luke Palmer wrote: On 11/21/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: Of course, the compiler is free to optimize these things if it can prove that runtime's &statement_control: is the same as the internal optimized &statement_control:. Which it definitely can't without some p

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Luke Palmer
On 11/21/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: > Of course, the compiler is free to optimize these things if it can prove > that runtime's &statement_control: is the same as the internal > optimized &statement_control:. Which it definitely can't without some pragma. I wonder if they sh

Re: statement_control() (was Re: lvalue reverse and array views)

2005-11-21 Thread Ingo Blechschmidt
Hi, Rob Kinyon wrote: > On 11/20/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: >> Yep. Also note that "for" is not a special magical construct in Perl >> 6, it's a simple subroutine (&statement_control:, with the >> signature ([EMAIL PROTECTED], Code *&code)). (Of course, it'll usually be >> op

statement_control() (was Re: lvalue reverse and array views)

2005-11-20 Thread Rob Kinyon
On 11/20/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote: [snip] > Yep. Also note that "for" is not a special magical construct in Perl 6, > it's a simple subroutine (&statement_control:, with the signature > ([EMAIL PROTECTED], Code *&code)). (Of course, it'll usually be optimized.) > > Example: >

Re: lvalue reverse and array views

2005-11-20 Thread Rob Kinyon
On 11/20/05, Daniel Brockman <[EMAIL PROTECTED]> wrote: > Reversing an array, changing it, and then rereversing it --- > I think that kind of pattern is common. I would think that reversing a string, modifying it, then reversing it back is more common. Does modifying the reversal of a string modif

Re: lvalue reverse and array views

2005-11-20 Thread Ingo Blechschmidt
Hi, Juerd wrote: > Ingo Blechschmidt skribis 2005-11-20 16:44 (+0100): >> Where is the difference (for the user) between a subroutine which >> returns an appropriate proxy object and an array? > > The big difference between pure arrays and referenced arrays, for the > user, is that pure arrays fl

Re: lvalue reverse and array views

2005-11-20 Thread Juerd
Ingo Blechschmidt skribis 2005-11-20 16:44 (+0100): > Where is the difference (for the user) between a subroutine which > returns an appropriate proxy object and an array? An object is a scalar, an array is an array. Perl has unreferenced arrays --I like to call them "pure" arrays--, and reference

Re: lvalue reverse and array views

2005-11-20 Thread Ingo Blechschmidt
Hi, Juerd wrote: > Will Perl 6 support mutable for-reverse? I'd like it! :) > Some possible answers that I could think of: > > (a) Yes, but as a special case > (b) Yes, because reverse returns lvalue aliases > (c) No > > But there's another one, that I didn't immediately think of: > > (d) Yes

Re: lvalue reverse and array views

2005-11-20 Thread Juerd
Daniel Brockman skribis 2005-11-20 6:58 (+0100): > Well, wouldn't pushing an element onto @xyzzy be more like > pushing the car to @foo and the cdr to @bar, or throwing an > exception if the new element is not a Pair? Zipping has nothing to do with pairs, though! Consider, for example: @foo

Re: lvalue reverse and array views

2005-11-19 Thread Daniel Brockman
Juerd <[EMAIL PROTECTED]> writes: > I think something like > > my @bar := reverse @foo; > > would be very useful. Insert an element between positions 1 and 2, and > the original @foo array gets them between positions -3 and -2. That would be cool. The concept is reminiscent of using a change

lvalue reverse and array views

2005-11-19 Thread Juerd
In Perl 5, for (reverse @foo) { $_ = $_ + 1 } actually works. But reverse does not return lvalues, which means that: (reverse @foo) = map $_ + 1, @foo; does not do the same thing, but actually throws an exception. I think, but haven't confirmed, that the for-reverse is an optimization