Am Montag, den 19.10.2009, 16:43 -0700 schrieb Jon Lang:
> Raphael Descamps wrote:
> > I personally don't understand why we don't have a exclude and alias
> > operator in Perl 6 but I have not read all the synopses and don't have
> > an overview.
>
> I don't think that it's explicitly spelled out
Raphael Descamps wrote:
> In the original traits paper the aliasing is not "deep": to respect the
> flattening property, the semantic of the role must not change, so
> aliasing a recursive method will call the original method. It's a known
> theoretical weakness of the traits paper and "freezing ro
Raphael Descamps wrote:
> I personally don't understand why we don't have a exclude and alias
> operator in Perl 6 but I have not read all the synopses and don't have
> an overview.
I don't think that it's explicitly spelled out anywhere; but the
reason is fairly straightforward: exclude and alias
On 2009-Oct-18, at 3:44 pm, Jon Lang wrote:
David Green wrote:
I would expect that role Logging { method log(Numeric $x:) {...} }
means the invocant is really of type Numeric & Logging, without
Logging having to do Numeric. On the other hand, I can see that
strictly that might not make se
Am Freitag, den 16.10.2009, 10:54 +0400 schrieb Richard Hainsworth:
> Arising out of "Freezing Roles" is a related question.
>
> Suppose I download a module from CPAN with a role I want to use, but it
> introduces a method that I want that is in conflict with an existing
> method (say one taken
David Green wrote:
> Jon Lang wrote:
>>
>> This implies that both Logging and Math do Numeric, since the invocant
>> ought to be of a type that the class does.
>
> I would expect that
> role Logging { method log(Numeric $x:) {...} }
> means the invocant is really of type Numeric & Logging, witho
On 2009-Oct-17, at 1:55 am, Jon Lang wrote:
This implies that both Logging and Math do Numeric, since the
invocant ought to be of a type that the class does.
I would expect that
role Logging { method log(Numeric $x:) {...} }
means the invocant is really of type Numeric & Logging, without
David Green wrote:
> Aha, so the bark:(Dog:) syntax identifies the method by its signature as
> well, thus distinguishing it from the .bark:(Tree:) method. This works fine
> when the sigs can distinguish the invocants, which is very common. However,
> I could have ambiguous methods even including
On 2009-Oct-16, at 12:54 am, Richard Hainsworth wrote:
Is there syntactic sugar for aliasing the conflicting method? Eg.
something like
does XML :db-write;
There needs to be something more than sugar: making a new class or
role with different methods will break substitutability. However, w
Ovid skribis 2005-04-10 10:47 (-0700):
> Apologies if this has been covered. What should this do?
> ($x,$y) := ($y,$x);
It would let $x be a second name for the variable that is also called
$y, and $y for $x. The old names $x and $y are overwritten, so
essentially the names for the two variable
On Fri, Jul 18, 2003 at 06:05:52PM -0400, Benjamin Goldberg wrote:
> What would happen if I used 1,2,3 instead of 1..3? Would it do the same
> thing?
I would think so.
> I wanna know what happens if I do:
>
>@a[0,2,4] = qw/ a b c d e /;
Yup, you're right, I didn't consider non-cont
Benjamin Golberg writes:
> Luke Palmer wrote:
> >
> > > David Storrs wrote:
> > > >
> > > > Thinking about it, I'd rather see lvalue slices become a nicer version
> > > > of C.
> > > >
> > > > my @start = (0..5);
> > > > my @a = @start;
> > > >
> > > > @a[1..3] = qw/ a b c d e /;
>
Dave Whipp wrote:
> "Luke Palmer" wrote:
> > Benjamin Goldberg wrote:
> > > David Storrs wrote:
> > > > @a[1..3] = qw/ a b c d e /;
> > > > print @a; # 0 a b c d e 4 5
> > >
> > > What would happen if I used 1,2,3 instead of 1..3?
> > > Would it do the same thing?
> >
> > Of course.
>
"Luke Palmer" <[EMAIL PROTECTED]> wrote:
> Benjamin Goldberg wrote:
> > David Storrs wrote:
> > > @a[1..3] = qw/ a b c d e /;
> > > print @a; # 0 a b c d e 4 5
> >
> > What would happen if I used 1,2,3 instead of 1..3? Would it do the same
> > thing?
>
> Of course.
I tend to agree, I
Luke Palmer wrote:
>
> > David Storrs wrote:
> > >
> > > Thinking about it, I'd rather see lvalue slices become a nicer version
> > > of C.
> > >
> > > my @start = (0..5);
> > > my @a = @start;
> > >
> > > @a[1..3] = qw/ a b c d e /;
> > > print @a; # 0 a b c d e 4 5
> >
>
> David Storrs wrote:
> >
> > Thinking about it, I'd rather see lvalue slices become a nicer version
> > of C.
> >
> > my @start = (0..5);
> > my @a = @start;
> >
> > @a[1..3] = qw/ a b c d e /;
> > print @a; # 0 a b c d e 4 5
>
> What would happen if I used 1,2,3 instead
David Storrs wrote:
>
> Thinking about it, I'd rather see lvalue slices become a nicer version
> of C.
>
> my @start = (0..5);
> my @a = @start;
>
> @a[1..3] = qw/ a b c d e /;
> print @a; # 0 a b c d e 4 5
What would happen if I used 1,2,3 instead of 1..3? Would it do
--- David Storrs <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 08, 2003 at 05:52:04PM -0700, Austin Hastings wrote:
> >
> > --- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote:
> > > Am I now thinking clearly?
> > >
> > I don't think so.
> >
> > If you've created two separate arrays that happen
On Tue, Jul 08, 2003 at 05:52:04PM -0700, Austin Hastings wrote:
>
> --- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote:
> > Am I now thinking clearly?
> >
> I don't think so.
>
> If you've created two separate arrays that happen to start with related
> values, then the changes to the first
--- Jonadab the Unsightly One <[EMAIL PROTECTED]> wrote:
> "Jonadab the Unsightly One" <[EMAIL PROTECTED]> writes:
>
> > Does this imply, though, that it's pointing to specific elements,
>
> Wow, I wasn't paying attention to what I was thinking there.
> Obviously it points to specific elements,
"Jonadab the Unsightly One" <[EMAIL PROTECTED]> writes:
> Does this imply, though, that it's pointing to specific elements,
Wow, I wasn't paying attention to what I was thinking there.
Obviously it points to specific elements, because the subscripts used
to create a slice don't have to be sequen
David Storrs <[EMAIL PROTECTED]> writes:
> my $r_slice = [EMAIL PROTECTED];
> @$r_slice = qw/ a b c d e /;
> print @a; # 0 a b c d e 4 5
This seems right to me. It would take approximately no time to get
used to this semantic, IMO.
> # Note that it does NOT modify in r
Thinking about it, I'd rather see lvalue slices become a nicer version
of C.
my @start = (0..5);
my @a = @start;
@a[1..3] = qw/ a b c d e /;
print @a; # 0 a b c d e 4 5
# Similarly:
@a = @start;
my $r_slice = [EMAIL PROTECTED];
@$r_slice = qw/ a b c
On 5 Jul 2003, Luke Palmer wrote:
> > return [EMAIL PROTECTED] $begin .. $end ];
>
> I fear that this might take a reference to each element in the slice,
> rather than a reference to the slice
Yes, that would indeed return a list of refs in perl5. Can it also be
assumed that the magic hy
> > On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote:
> >
> > > Actually, you can't reference a slice! Where the heck does the
> > > reference point? I would probably do:
> >
> > Of course not. I presume it points to something non-existent just like
> > a substring reference would in
> On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote:
>
> > Actually, you can't reference a slice! Where the heck does the
> > reference point? I would probably do:
>
> Of course not. I presume it points to something non-existent just like
> a substring reference would in perl5 :-)
>
On Sat, Jul 05, 2003 at 09:51:29AM -0600, Luke Palmer wrote:
> Actually, you can't reference a slice! Where the heck does the
> reference point? I would probably do:
Of course not. I presume it points to something non-existent just like
a substring reference would in perl5 :-)
$ perl -le '$a =
> On Fri, 4 Jul 2003, Damian Conway wrote:
>
> > > Will it be possible (or sane even) to bind a variable to an array slice
> > It *should* be, since it's possible (if ungainly) to do it in Perl 5:
>
> Ouch, blatant abuse of perl5's aliasing with @_ and globs ;) Can I also
> assume that you can al
On Fri, 4 Jul 2003, Damian Conway wrote:
> > Will it be possible (or sane even) to bind a variable to an array slice
> It *should* be, since it's possible (if ungainly) to do it in Perl 5:
Ouch, blatant abuse of perl5's aliasing with @_ and globs ;) Can I also
assume that you can also pass around
Dan Brook wrote:
Will it be possible (or sane even) to bind a variable to an array slice
It *should* be, since it's possible (if ungainly) to do it in Perl 5:
use Data::Dumper 'Dumper';
@bar = (1,2,3);
*foo = (sub [EMAIL PROTECTED])->(@bar[1,0,3]);
print Dumper [EMAIL PROTECTED];
> Will it be possible (or sane even) to bind a variable to an array slice
> e.g
>
> ## correct syntax?
> my @array = << a list of values >>;
>
> my @array_slice := @array[ 1 .. @array.end ];
Yeah, that'll work. It has to, lest:
my [EMAIL PROTECTED] := (1, 1, map { $^a + $^b } zip(@fi
Uri asked:
> but what if there are multiple bound variables like this example:
>
> for %phonebook.kv -> $name, $number {
> print "$name: $number\n"
> }
>
> is $_ aliased to either/both/neither of the two topics? are those now
> not topics but just aliased variabl
\%foo = \%bar is fine with me, it's the "is alias" I was a little worried
about.
Ilya
-Original Message-
From: David L. Nicol
To: Sterin, Ilya
Cc: 'Davíð Helgason '; '[EMAIL PROTECTED] '; 'John Porter '
Sent: 07/24/2001 5:45 PM
Subject: Re:
alias(%foo, %bar) is better IMO since it conforms to other functions in
perl.
my %foo is alias = %bar; #seems a little out of scope of the language,
unless more functionality is implemented in that way.
Ilya
-Original Message-
From: Davíð Helgason
To: [EMAIL PROTECTED]; John Porter
Sent
David L. Nicol wrote:
>
>Are there really situations where
>
> $$reference = An Expression;
>
>is clearer than
>
> $reference = \(An Expression);
>
>?
Eric is confused. I don't know about in Perl 6-to-be, but in Perl 5
those two mean totally different things:
$foo = \$bar;
David L. Nicol wrote:
> Assignment to a nonexistent reference becomes an
> alias instead of a copy.
Uh, I dunno. Like Python/Ruby, but without the consistency.
I think special constructs -- defined as NOT doing assignment
-- should be allowed to set up aliases. This includes, e.g. for().
P
But how would you then copy, without having to bring the reference in
existance first. How would you copy period? Maybe I am not understanding,
hopefully someone can clear it up:)
Ilya
-Original Message-
From: David L. Nicol
To: Mark J. Reed
Cc: '[EMAIL PROTECTED] '
Sent: 07/20/2001 1:
> 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
52 matches
Mail list logo