: 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
On Wed, 9 Oct 2002, Chris Dutton wrote:
: Wasn't "class MyClass;" supposed to work along the line of Perl5's
: "package MyClass;" and make everything following that statement the
: definition of MyClass?
Yes, though we're thinking of limiting that construct to the front
of a file, along with "m
On Thu, 10 Oct 2002, Chip Salzenberg wrote:
: According to Luke Palmer:
: > for ( grep { $_{smoker} and $_{age} > 18 } @Subscribers ) {
: > .send($Cigarette_Advertisement)
: > }
:
: Hm, would this work too:
:
: for ( grep { .{smoker} and .{age} > 18 } @Subscribers )
:
On Thu, 10 Oct 2002, Michael Lazzaro wrote:
: On Thursday, October 10, 2002, at 11:23 AM, John Williams wrote:
: > my $obj = MyClass(...);
: >
: > This seems to assume that objects have a default method if you treat
: > them
: > like a subroutine. Kinda tcl-ish, but I don't recall anything li
On Thursday, October 10, 2002, at 11:23 AM, John Williams wrote:
> my $obj = MyClass(...);
>
> This seems to assume that objects have a default method if you treat
> them
> like a subroutine. Kinda tcl-ish, but I don't recall anything like
> this
> in the apocalypes.
>
> my $obj = MyClass;
On Mon, 7 Oct 2002, Andy Wardley wrote:
: Nicholas Clark wrote:
: > I think that the first syntax
: >
: > class Car::Q is Car renames(eject => ejector_seat)
: > is CD_Player renames(drive => cd_drive);
: >
: > makes it more clear that I'd like to pick and choose which methods
: > th
According to Luke Palmer:
> for ( grep { $_{smoker} and $_{age} > 18 } @Subscribers ) {
> .send($Cigarette_Advertisement)
> }
Hm, would this work too:
for ( grep { .{smoker} and .{age} > 18 } @Subscribers )
{ .send($ciggie_ad) }
? I think .{x} read
On Mon, 7 Oct 2002, chromatic wrote:
: On Wed, 02 Oct 2002 04:12:44 -0700, Michael G Schwern wrote:
:
: > I like the "class Vehicle is interface" as a shorthand for declaring every
: > method of a class to be an interface.
:
: Perhaps associating a property with a class can be shorthand for asso
On Mon, 30 Sep 2002, Michael G Schwern wrote:
: On Tue, Oct 01, 2002 at 01:36:19AM +0100, Simon Cozens wrote:
: > [EMAIL PROTECTED] (Michael G Schwern) writes:
: > > method _do_internal_init ($num) is private {
: >
: > Just thinking aloud, would
: > sub foo is method is private is inte
On Wed, 9 Oct 2002, Michael Lazzaro wrote:
> PLEASE contribute to this document! Email me with suggestions, "yes"
> or "no" votes on recipe approaches, info on philosophies or best-guess
> syntax, etc., or discuss them here on perl6-language.
Very nice. I hope this evolves into a useful perl6
On Thursday, October 10, 2002, at 02:33 AM, Angel Faus wrote:
> Just a silly note:
>> Recipe 1.9: Using Subroutines as Objects
> I think it was said that the way to avoid the ambiguity here is to add
> & to sub name.
Thanks, applied.
MikeL
On Wednesday, October 9, 2002, at 07:54 PM, Chris Dutton wrote:
> One first thing I notice while I'm supposed to be doing homework. :-)
>
> Wasn't "class MyClass;" supposed to work along the line of Perl5's
> "package MyClass;" and make everything following that statement the
> definition of
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;
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;
Hi,
Many thanks Michael, this is very useful, really. I had lost all the
OO discussion and this document is very helpful.
I really like the part of context transformations, I hope something
like this gets in.
Just a silly note:
> Recipe 1.9: Using Subroutines as Objects
>
> Problem:
> You w
One first thing I notice while I'm supposed to be doing homework. :-)
Wasn't "class MyClass;" supposed to work along the line of Perl5's
"package MyClass;" and make everything following that statement the
definition of MyClass?
Larry Wall wrote:
[...]
> Maybe we should ... to mean "and so on forever":
>
> @a[0...; 0...:10; 0...:100]
>
> Except then we couldn't use it to mean what Ruby means by it, which
> might be handier in real life.
No more yada-yada-yada?
Brad
17 matches
Mail list logo