Re: aliasing - was:[nice2haveit]

2001-07-19 Thread Me
> Sounds like what we really want is a form of "for" which can iterate > over a list of hashes or arrays: > > for my @a ( @foo, @bar ) { ... > > for my %h ( %foo, %bar ) { ... Yes. Isn't the underlying issue in the above how perl6 handles manipulation and aliasing of multi-dimensional arrays i

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
> Why would you want it to print Monkey Hero, I would expect $_ to be > localized, rather than global, which could prove more convenient. No, it's still localized. But the With would mean that $_ in a way becomes a normal variable like $foo was, and the $foo is now the 'default variable'.

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
@foo = ("foo1", "foo2"); @bar = ("bar1", "bar2"); for ( \@foo, \@bar ) { print "$_->[0] : $_->[1]\n"; } will output foo1 : foo2 bar1 : bar2 I was thinking more of iterating through them at the same time, which would sort of like compare them. I believe this was the initial topic of

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread 'John Porter '
Sterin, Ilya wrote: > Well then maybe $_ can be a reference to a multidimensional array or hash, > and temp vars can be access like this. > > for ( @foo, @bar ) { > print "$_->[0] : $_->[1]\n"; > } That's bizarre and unnecessary. We can already do this: for ( \@foo, \@bar ) { print "$_

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
Why would you want it to print Monkey Hero, I would expect $_ to be localized, rather than global, which could prove more convenient. Ilya -Original Message- From: Stuart Rocks To: [EMAIL PROTECTED] Sent: 07/19/2001 1:13 PM Subject: Re: what's with 'with'? (was: [aliasing - was:[nice2ha

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread John Porter
Bart Lateur wrote: > So, in this case, a "with" synonym for "for" would work. > > But this only works for scalars. You can't have a %foo alias to > %Some::Other::hash this way, or a @bar alias to @Some::Other::array. Sounds like what we really want is a form of "for" which can iterate over a lis

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
> But can someone reiterate the > difference between the above and > > for($foo){ >print "I am not a $foo\n"; > # or: >print "I am not a "; >print; > } Try this under the current for system, cause it's unclear what will happen for those new to Perl: $foo="monkey"; $_=" coward";

RE: aliasing - was:[nice2haveit]

2001-07-19 Thread Sterin, Ilya
Agree. I think that with() should only be used with object references only, and $_ should be set accordingly. Ilya -Original Message- From: John Porter To: [EMAIL PROTECTED] Sent: 07/19/2001 1:01 PM Subject: Re: aliasing - was:[nice2haveit] Sterin, Ilya wrote: > But I thought this was

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
Well then maybe $_ can be a reference to a multidimensional array or hash, and temp vars can be access like this. for ( @foo, @bar ) { print "$_->[0] : $_->[1]\n"; } As for hashes it might hold the key, also in an multidimensional array. Ilya -Original Message- From: John Porter To: [E

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread John Porter
Sterin, Ilya wrote: > But I thought this was related to more than just with(), so if we have > > ### Would now have to be printed as > > print "This is number "; > print; > print " of 10\n"; > > I still believe that although not defining a variable source will use the > temp variable there is s

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Stuart Rocks
> Like "I am not a > coward" which can be easily done with print "I am not a $_"; will now have > to be written in two separate lines, and possibly more if there is more to > follow. > > Ilya Um, of course the original way is still possible!

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread John Porter
I believe what is really wanted is for "for" to be able to iterate over lists of arrays or hashes: for my @i ( @foo, @bar ) { ... for my %i ( %foo, %bar ) { ... with real aliasing occuring. If @_ and %_ are the default iterator variables, then imagine: for ( @argset1,

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
I question this too, since as you mentioned with, in my experience works nicely to reference and object like with(object) { .foo(); .bar(); } Ilya -Original Message- From: Mark Koopman To: [EMAIL PROTECTED] Sent: 07/19/2001 12:42 PM Subject: Re: what's with 'with'? (was: [aliasing

RE: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Sterin, Ilya
Well if you look at the proposed... $_ = "monkey "; $foo = "coward"; with ($foo){ print; print "$_"; } Would print "coward monkey", which will give you unexpected results if you are used to having the same output for both, "coward coward". But I guess the above would not replace

RE: aliasing - was:[nice2haveit]

2001-07-19 Thread Sterin, Ilya
But I thought this was related to more than just with(), so if we have foreach (1..10) { print; ### But if you are trying to use it in a string print "This is number $_ of 10\n"; ### Would now have to be printed as print "This is number "; print; print " of 10\n"; ### Which is three extra

Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Mark Koopman
Garrett Goebel wrote: > From: Stuart Rocks [mailto:[EMAIL PROTECTED]] > >>Both the following would work: >> >>with($foo){ >> print "I am not a $foo\n"; >> # or: >> print "I am not a "; >> print; >>} >> > > Okay... I've been mostly ignoring this thread. But can someone reiterate the > d

what's with 'with'? (was: [aliasing - was:[nice2haveit]])

2001-07-19 Thread Garrett Goebel
From: Stuart Rocks [mailto:[EMAIL PROTECTED]] > > Both the following would work: > > with($foo){ >print "I am not a $foo\n"; > # or: >print "I am not a "; >print; > } Okay... I've been mostly ignoring this thread. But can someone reiterate the difference between the above and for

Re: op code bof

2001-07-19 Thread Uri Guttman
> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: DS> At 07:51 PM 7/19/2001 +0200, Paul Johnson wrote: >> On Thu, Jul 19, 2001 at 01:40:50PM -0400, Dan Sugalski wrote: >> > >> > Sure, sounds good. I'll see about having the first draft of the "Parrot >> > Assembly Language Manual an

Re: op code bof

2001-07-19 Thread Dan Sugalski
At 07:51 PM 7/19/2001 +0200, Paul Johnson wrote: >On Thu, Jul 19, 2001 at 01:40:50PM -0400, Dan Sugalski wrote: > > > > Sure, sounds good. I'll see about having the first draft of the "Parrot > > Assembly Language Manual and Architecture Handbook" PDD with me too. > (All I > > need to do now is w

Re: op code bof

2001-07-19 Thread Paul Johnson
On Thu, Jul 19, 2001 at 01:40:50PM -0400, Dan Sugalski wrote: > > Sure, sounds good. I'll see about having the first draft of the "Parrot > Assembly Language Manual and Architecture Handbook" PDD with me too. (All I > need to do now is write it...) The Palmah. Our canon of scripture? -- Pau

Re: op code bof

2001-07-19 Thread Dan Sugalski
At 01:30 PM 7/19/2001 -0400, Uri Guttman wrote: > > "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: > > DS> We'll find a room, never fear. Lunch wednesday is still the best > DS> time, I think. > >fine. is gathering first at the exhibit hall a good idea? just a well >known point of refere

Re: aliasing - was:[nice2haveit]

2001-07-19 Thread Stuart Rocks
> >Then how would you write "I am not a coward" > > with ($foo) > { > print "I am not a"; ##What do I use here or do I have to issue a >##separate print like... > print; > } > > Ilya Well in Perl5, for the print to use default value it's just 'print;'. The same applie

Re: op code bof

2001-07-19 Thread Uri Guttman
> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: DS> We'll find a room, never fear. Lunch wednesday is still the best DS> time, I think. fine. is gathering first at the exhibit hall a good idea? just a well known point of reference. >> do we want/need a white board? i will be bringi

RE: aliasing - was:[nice2haveit]

2001-07-19 Thread Sterin, Ilya
Stuart Rocks wrote: >> >> C would also make the [variable, alias, whatever] >> default, but not replace the $_: >> >> $_ = "monkey "; >> $foo = "coward"; >> with ($foo){ >> print; >> print "$_"; >> } >> >> would output "monkey coward". >okay, "coward" is default but $_ has not been r

Re: op code bof

2001-07-19 Thread Dan Sugalski
At 01:04 AM 7/19/2001 -0400, Uri Guttman wrote: >i say we keep it at 12:30 on wed. we can meet at the exhibit hall (which >is where i will be much of that day). then we can find some place to >take over and bof the op code stuff. any other meeting places can be >suggested. i don't want to juggle t