Re: A question about role-private attributes

2008-11-09 Thread Jonathan Worthington
[EMAIL PROTECTED] wrote: I am trying to understand the following small portion from S12, and it seems slightly ambiguous to me: === from S12: You may wish to declare an attribute that is hidden even from the class; a completely private role attribute may be declared like this: C The na

A question about role-private attributes

2008-11-09 Thread [EMAIL PROTECTED]
I am trying to understand the following small portion from S12, and it seems slightly ambiguous to me: === from S12: You may wish to declare an attribute that is hidden even from the class; a completely private role attribute may be declared like this: C The name of such a private attrib

Re: A question about arrays

2008-10-16 Thread Larry Wall
On Thu, Oct 16, 2008 at 02:56:28PM +1100, Timothy S. Nelson wrote: > Hi all. I'm working on the code for trees that I keep talking about, > and I have code that somewhat resembles the following: > > role Tree::Node does Array { > has Tree::Node @!children handles ; > } > > The

A question about arrays

2008-10-15 Thread Timothy S. Nelson
Hi all. I'm working on the code for trees that I keep talking about, and I have code that somewhat resembles the following: roleTree::Node does Array { has Tree::Node @!children handles ; } The intent of this code is that, if you treat the Tree::Node as an array, you're operatin

Re: A question about attribute functions

2004-09-01 Thread Larry Wall
On Wed, Sep 01, 2004 at 07:08:57PM +0200, Juerd wrote: : Larry Wall skribis 2004-09-01 8:02 (-0700): : > : $x.transform.(); : > That might not work either. This will, though: : > ($x.transform)(); : : This is surprising. Can you please explain why .() won't work? I have : methods return su

Re: A question about attribute functions

2004-09-01 Thread Juerd
Larry Wall skribis 2004-09-01 8:02 (-0700): > : $x.transform.(); > That might not work either. This will, though: > ($x.transform)(); This is surprising. Can you please explain why .() won't work? I have methods return subs quite often, and like that I can just attach ->() to it to make

Re: A question about attribute functions

2004-09-01 Thread Larry Wall
On Wed, Sep 01, 2004 at 08:02:33AM -0700, Larry Wall wrote: : That might not work either. This will, though: : : ($x.transform)(); So will $x.transform()(); for that matter... Larry

Re: A question about attribute functions

2004-09-01 Thread Larry Wall
On Wed, Sep 01, 2004 at 10:41:37AM -0400, Aaron Sherman wrote: : How do you declare attribute functions? Specifically, I was thinking : about map and what kind of object it would return, and I stumbled on a : confusing point: : : class mapper does iterator { : has &.transform;

A question about attribute functions

2004-09-01 Thread Aaron Sherman
How do you declare attribute functions? Specifically, I was thinking about map and what kind of object it would return, and I stumbled on a confusing point: class mapper does iterator { has &.transform; ... } Ok, that's fine, but what kind of access

Re: A question about binary does

2004-04-23 Thread Dan Sugalski
At 2:21 PM -0500 4/22/04, Abhijit A. Mahabal wrote: This is actually a couple of questions: 1: can you extend roles by saying: role Set is extended {} Parrot will allow this, so if Larry says OK you're fine. It may be rather significantly expensive, however. (Not nearly as bad as, say, adding an

Re: A question about binary does

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 09:42:51AM -0700, Larry Wall wrote: : : return $self.keys.grep { exists $other{$^a} } : : grepping a hash? Sorry--looked at that cross-eyed. Of course you can grep the keys... Larry

Re: A question about binary does

2004-04-23 Thread Larry Wall
On Thu, Apr 22, 2004 at 02:21:17PM -0500, Abhijit A. Mahabal wrote: : This is actually a couple of questions: : 1: can you extend roles by saying: role Set is extended {} Perhaps. Classes and objects that have already composed the role would have to be notified that they need to recalculate colli

A question about binary does

2004-04-22 Thread Abhijit A. Mahabal
This is actually a couple of questions: 1: can you extend roles by saying: role Set is extended {} 2: if yes, does this change variables for which you said $var does Set? In other words, is the singleton class like a closure or a first-class class? What follows is just some example code in case

Re: A question

2002-01-21 Thread Piers Cawley
Piers Cawley <[EMAIL PROTECTED]> writes: > Larry Wall <[EMAIL PROTECTED]> writes: > >> Piers Cawley writes: >> : Yeah, that's sort of where I got to as well. But I just wanted to make >> : sure. I confess I'm somewhat wary of the ';' operator, especially >> : where it's 'unguarded' by brackets, a

Re: A question

2002-01-21 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > Piers Cawley writes: > : Yeah, that's sort of where I got to as well. But I just wanted to make > : sure. I confess I'm somewhat wary of the ';' operator, especially > : where it's 'unguarded' by brackets, and once I start programming in > : Perl 6 then >

Re: A question

2002-01-20 Thread Larry Wall
Piers Cawley writes: : Yeah, that's sort of where I got to as well. But I just wanted to make : sure. I confess I'm somewhat wary of the ';' operator, especially : where it's 'unguarded' by brackets, and once I start programming in : Perl 6 then : : for (@aaa ; @bbb -> $a; $b) { ... } : : w

Re: A question

2002-01-18 Thread Piers Cawley
[reformatting response for readability and giving Glenn a stiff talking to] Glenn Linderman <[EMAIL PROTECTED]> writes: > Piers Cawley wrote: > >> Okay boys and girls, what does this print: >> >> my @aaa = qw/1 2 3/; >> my @bbb = @aaa; >> >> try { >> print "$_\n"; >> } >> >> for @aaa; @bbb ->

Re: A question

2002-01-18 Thread Glenn Linderman
That particular example is flawed, because the try expression is turned into a try statement because the } stands alone on its line. But if you eliminate a couple newlines between } and for, then your question makes sense (but the code is not well structured, but hey, maybe you take out all the n

A question

2002-01-18 Thread Piers Cawley
Okay boys and girls, what does this print: my @aaa = qw/1 2 3/; my @bbb = @aaa; try { print "$_\n"; } for @aaa; @bbb -> my $a; my $b { print "$a:$b"; } I'm guessing one of: 1:1 2:2 3:3 or a syntax error, complaining about something near C<@bbb -> my $a ; my $b {> In other words, how