Re: You never have privacy from your children in Perl 6

2010-03-29 Thread Darren Duncan
Martin D Kealey wrote: On Mar 27, 2010, at 15:43 , Darren Duncan wrote: For example, say you want to define a graph of some kind, and for elegance you have a separate container and node and side classes, On Sat, 27 Mar 2010, Brandon S. Allbery KF8NH wrote: This sounds like a hackaround for an

Re: You never have privacy from your children in Perl 6

2010-03-29 Thread Martin D Kealey
> On Mar 27, 2010, at 15:43 , Darren Duncan wrote: > > For example, say you want to define a graph of some kind, and for > > elegance you have a separate container and node and side classes, On Sat, 27 Mar 2010, Brandon S. Allbery KF8NH wrote: > This sounds like a hackaround for an incomplete impl

Re: You never have privacy from your children in Perl 6

2010-03-27 Thread Brandon S. Allbery KF8NH
On Mar 27, 2010, at 15:43 , Darren Duncan wrote: My own take on 'trusts' is that I consider its main purpose is to let programmers *avoid* contrivances when they want to define something that would otherwise be a single class but is split into multiple classes for better elegance. For examp

Re: You never have privacy from your children in Perl 6

2010-03-27 Thread Darren Duncan
My own take on 'trusts' is that I consider its main purpose is to let programmers *avoid* contrivances when they want to define something that would otherwise be a single class but is split into multiple classes for better elegance. For example, say you want to define a graph of some kind, and

Re: You never have privacy from your children in Perl 6

2010-03-27 Thread Sean Hunt
On 03/26/2010 04:16 PM, Jason Switzer wrote: Also, this discussion of "trusts" piqued my interest; this sounds like a bad idea. Those of you who have worked extensively with C++ should bemoan "trusts" as much as friend classes. They break encapsulation for special cases, almost encouraging truly

Re: You never have privacy from your children in Perl 6

2010-03-26 Thread Jason Switzer
On Fri, Mar 26, 2010 at 7:16 AM, Carl Mäsak wrote: > You're using it wrong. You need to put 'trusts B;' in A in order for B to > > see A's privates. I hope it is obvious why this is the case. -- Darren > > Duncan > > Aye, my mistake. Apparently the syntax I used to try to get at the > private a

Re: You never have privacy from your children in Perl 6

2010-03-26 Thread Carl Mäsak
Carl (>), Darren (>>): >> I didn't get it to trust me, though: >> >> pugs: class A { has $!foo }; class B { trusts A; method bar(A >> $a) { say $a!foo } }; B.new.bar(A.new(:bar(42))) >> pugs: OUTPUT«␤» >> >> Either it bitrotted or I'm using it wrong. > > You're using it wrong.  You need to put 't

Re: You never have privacy from your children in Perl 6

2010-03-25 Thread Darren Duncan
Carl Mäsak wrote: Carl (>>), Darren (>): [...] and the 'trusts' keyword hasn't been realized in any Perl 6 implementation so far. I seem to recall that Pugs did support 'trusts' a few years ago, and that I used it. But I could be wrong. -- Darren Duncan I stand corrected. A quick search thro

Re: You never have privacy from your children in Perl 6

2010-03-25 Thread Carl Mäsak
Carl (>>), Darren (>): >> [...] and the >> 'trusts' keyword hasn't been realized in any Perl 6 implementation so >> far. > > I seem to recall that Pugs did support 'trusts' a few years ago, and that I > used it.  But I could be wrong. -- Darren Duncan I stand corrected. A quick search through the

Re: You never have privacy from your children in Perl 6

2010-03-25 Thread Darren Duncan
Carl Mäsak wrote: Carl (), Moritz (>>>), Carl (>>), Moritz (>): um, so 'protected' is when the deriving classes can see the attribute? yup that's what 'private' means in Perl 6. That's wrong. Perl 6's "private" is like Java's "private" - subclasses can't see it. It's just Rakudo being le

Re: You never have privacy from your children in Perl 6

2010-03-25 Thread Carl Mäsak
Carl (), Moritz (>>>), Carl (>>), Moritz (>): um, so 'protected' is when the deriving classes can see the attribute? yup that's what 'private' means in Perl 6. >>> >>> That's wrong. Perl 6's "private" is like Java's "private" - subclasses >>> can't see it. >>> It's just

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Raphael Descamps
Am Dienstag, den 23.03.2010, 20:06 +0100 schrieb Moritz Lenz: > > Carl Mäsak wrote: > > Carl (>>), Moritz (>): > >>> um, so 'protected' is when the deriving classes can see the > >>> attribute? > >>> yup > >>> that's what 'private' means in Perl 6. > >> > >> That's wrong. Perl 6's "private" i

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Daniel Ruoso
Em Ter, 2010-03-23 às 20:53 +0100, Moritz Lenz escreveu: > unless you count 'trusts' > traits, which are specific to single classes, not groups of subclasses Yes, that was what I meant... daniel

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Moritz Lenz
Daniel Ruoso wrote: > Em Ter, 2010-03-23 às 19:41 +0100, Carl Mäsak escreveu: >> um, so 'protected' is when the deriving classes can see the >> attribute? >> yup >> that's what 'private' means in Perl 6. >> what? so there's only really 'public' and 'protected', but no >> 'private'? >> basicall

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Daniel Ruoso
Em Ter, 2010-03-23 às 19:41 +0100, Carl Mäsak escreveu: > um, so 'protected' is when the deriving classes can see the > attribute? > yup > that's what 'private' means in Perl 6. > what? so there's only really 'public' and 'protected', but no > 'private'? > basically, yes. although 'protected'

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Moritz Lenz
Carl Mäsak wrote: > Carl (>>), Moritz (>): >>> um, so 'protected' is when the deriving classes can see the >>> attribute? >>> yup >>> that's what 'private' means in Perl 6. >> >> That's wrong. Perl 6's "private" is like Java's "private" - subclasses >> can't see it. >> It's just Rakudo being

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Carl Mäsak
Carl (>>), Moritz (>): >> um, so 'protected' is when the deriving classes can see the >> attribute? >> yup >> that's what 'private' means in Perl 6. > > That's wrong. Perl 6's "private" is like Java's "private" - subclasses > can't see it. > It's just Rakudo being leaky at the moment, not a fal

Re: You never have privacy from your children in Perl 6

2010-03-23 Thread Moritz Lenz
Carl Mäsak wrote: > um, so 'protected' is when the deriving classes can see the attribute? > yup > that's what 'private' means in Perl 6. That's wrong. Perl 6's "private" is like Java's "private" - subclasses can't see it. It's just Rakudo being leaky at the moment, not a fallacy of the Perl 6

You never have privacy from your children in Perl 6

2010-03-23 Thread Carl Mäsak
Wanting to run the recent class-attribute discussion[0] through the neural net of my friend, I described to him in detail how the current system with attributes works. He's kind of a Java guy, and though he liked the twigil distinction between private and public, he asked how to produce a 'protecte