> 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
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
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 t
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
cks
To: [EMAIL PROTECTED]
Sent: 07/19/2001 11:31 AM
Subject: Re: aliasing - was:[nice2haveit]
> >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
>#
> >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
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
> > So, in this case, a "with" synonym for "for" would work.
> >
> Particularly if '$_' was implied... So with Perl 6's '.' replacing '->',
> and 'with' aliasing 'for':
>
>with ( $XL.{Application}.{ActiveSheet} ) {
> .cells(1,1) = "Title";
> .language() = "English";
>}
This is m
> > So, in this case, a "with" synonym for "for" would work.
> >
> Particularly if '$_' was implied... So with Perl 6's '.' replacing '->',
> and 'with' aliasing 'for':
>
>with ( $XL.{Application}.{ActiveSheet} ) {
> .cells(1,1) = "Title";
> .language() = "English";
>}
This is m
>> Does such a thing exist already?
>
>A WTDI exists already:
>
>for ( $XL->{Application}->{ActiveSheet} ) {
> $_->cells(1,1) = "Title";
> $_->language() = "English";
>}
>
>(presuming lvalue-methods, of course...)
So, in this case, a "with" synonym for "for" would work.
]- OR
Bart Lateur wrote:
> On Wed, 18 Jul 2001 09:00:25 -0400, John Porter wrote:
> >for ( $XL->{Application}->{ActiveSheet} ) {
> > $_->cells(1,1) = "Title";
> > $_->language() = "English";
> >}
> >
> >(presuming lvalue-methods, of course...)
>
> So, in this case, a "with" s
On Wed, 18 Jul 2001 09:00:25 -0400, John Porter wrote:
>> Does such a thing exist already?
>
>A WTDI exists already:
>
>for ( $XL->{Application}->{ActiveSheet} ) {
> $_->cells(1,1) = "Title";
> $_->language() = "English";
>}
>
>(presuming lvalue-methods, of course...)
So, in th
Jeremy Howard wrote:
> with $XL->{Application}->{ActiveSheet} {
> ->cells(1,1) = "Title"
> ->language() = "English"
> }
>
> Does such a thing exist already?
A WTDI exists already:
for ( $XL->{Application}->{ActiveSheet} ) {
$_->cells(1,1) = "Title";
$_->language() =
"raptor" <[EMAIL PROTECTED]> wrote:
<...>
> the idea of aliasing is to preserve the fast access and on the other side
to
> shorden the "accessor"(i.e the way to access the structure) and make code
> clearer.(mostly u can choose a name that has better meaning in your
context)
>
This reminds me... a
> > > I mean something like this :
> >
> > > instead of :
> > > #$Request->{Params}
> > > local *myhash = \%{$$Request{Params}};
> >
> > > my %myhash alias %{$$Request{Params}};#see - it is my (now as far as I
know
> > > u can't have it 'my')
> >
> >You don't need a typeglob there; you can do the
15 matches
Mail list logo