Re: Delegation syntax

2002-10-11 Thread Ralph Mellor
> [proposal for delegation syntax, drawing from Class::Delegation] > > If something is part of the method interface, it ought to be declared > as a method. > > method steer is really(Wheel) is also(???) { .profit!!! } That's tidy, and is sorta on the lines of my own

Re: Delegation syntax

2002-10-10 Thread Larry Wall
: Problem: : : You want to use delegation rather than inheritance to : add some capabilities of one class or object to : another class or object. : : Solution: : : Use a PROXY block: : : class MyClass { : : PROXY { : attr $left_front_wheel is Wheel; : attr $right_fro

Delegation syntax

2002-10-10 Thread Ralph Mellor
Problem: You want to use delegation rather than inheritance to add some capabilities of one class or object to another class or object. Solution: Use a PROXY block: class MyClass { PROXY { attr $left_front_wheel is Wheel; attr $right_front_wheel is Wheel;

Delegation syntax

2002-10-10 Thread Me
Problem: You want to use delegation (rather than inheritance) to add some capabilities of one class or object to another class or object. Solution: Use a PROXY block: class MyClass { PROXY { attr $left_front_wheel is Wheel; attr $right_front_wheel is Wheel;

RE: Delegation syntax? (was: Re: Private contracts)

2002-10-04 Thread Garrett Goebel
John Williams: > Reaction #2: Inheritance would automatically delegate all those > methods, so again, in what way does inheritance _not_ solve > the problem? What about when you want to be able to dynamically swap the objects to which you're delegating? -- Garrett Goebel IS Development Special

Re: Delegation syntax?

2002-10-04 Thread Dan Sugalski
At 12:37 AM -0400 10/4/02, Michael G Schwern wrote: >Delegation is a basic OO technique. We definately should have fast, >well-designed core support for it. I'm pretty sure we will. I certainly need it internally... -- Dan --

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-04 Thread Andy Wardley
John Williams wrote: > Reaction #2: Inheritance would automatically delegate all those > methods, so again, in what way does inheritance _not_ solve the problem? Many real life systems are composed from elements, not inherited from elements. A car is not a wheel, but is composed from 4 (or more

Re: Delegation syntax?

2002-10-03 Thread Michael G Schwern
On Fri, Oct 04, 2002 at 12:28:29AM -0400, Trey Harris wrote: > I think my point here is that there are clearly places where we need > stronger built-in support in Perl of some OO concepts. Delegation may not > be one of them--it's easy enough to graft on, and TMTOWTDI may be good > here. Delegat

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 07:59:33PM -0600, John Williams wrote: > Reaction #2: Inheritance would automatically delegate all those > methods, so again, in what way does inheritance _not_ solve the problem? I don't think p6l is the right place to discuss the merits of delegation, let's just say it'

Re: Delegation syntax?

2002-10-03 Thread Trey Harris
In a message dated Thu, 3 Oct 2002, Michael Lazzaro writes: > On Thursday, October 3, 2002, at 04:25 PM, Michael G Schwern wrote: > > Class::Delegation? > > Yeah, it's one of the best I've seen: it makes sense, does everything I > want, and is easy to explain even to newbies. The perl5 hash-bas

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread John Williams
On Thu, 3 Oct 2002, Michael Lazzaro wrote: > > 1) Delegation through inheritance: > (a.k.a. "mixin" classes, "hard delegation", "concrete interfaces", > etc., etc.) > > Example: I want to say that a class DataManager has the capabilities > of the interfaces DataStrategy and Cache

Re: Delegation syntax?

2002-10-03 Thread Michael Lazzaro
On Thursday, October 3, 2002, at 04:25 PM, Michael G Schwern wrote: > On Thu, Oct 03, 2002 at 03:54:09PM -0700, Michael Lazzaro wrote: >> I have no *good* syntax proposals for this, I don't think I've ever >> seen the problem solved with syntax that I really ever liked. > > Class::Dele

Re: Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael G Schwern
On Thu, Oct 03, 2002 at 03:54:09PM -0700, Michael Lazzaro wrote: > I have no *good* syntax proposals for this, I don't think I've ever > seen the problem solved with syntax that I really ever liked. Class::Delegation? -- Michael G. Schwern <[EMAIL PROTECTED]>http://www.pobox

Delegation syntax? (was: Re: Private contracts)

2002-10-03 Thread Michael Lazzaro
On Thursday, October 3, 2002, at 03:18 PM, Paul Johnson wrote: >> (As a lame aside, are we going to have a concept of "private" vs. >> "protected" vs. "public", or just private/public? > > No protected. Even Stroustrup admits it was a mistake in D&E. Oh, thank God. I was hoping people would sa