On Mon, Jul 02, 2001 at 05:04:23PM -0400, John Porter wrote:
> Michael G Schwern wrote:
> > Are they really necessary?  You can get the same effect so many other
> > ways in Perl already, 
> 
> That is a very unhelpful attitude.

We've already got everything and the kitchen sink proposed for Perl 6.
Remember, somebody's got to write all this.


> Give me data aggregation by inheritance

Oooh, now that would be useful.


> namespace scoping

Err... something like lexical namespaces?  "my package Foo"?

        package Foo;
        {
            my package Bar;
            sub baz { 42 }
        }
        print Bar->baz;  # *bzzzzt* Bar only exists in its scope.

Interesting, but do we need them in 6.0?


> interfaces

Pretty much covered by our discussions of method signatures and typing
earlier, no?  Yes, we need them.


> and then I'll grant that inner classes are easy to tack on.

You can always do this right now:

        package Whatever;
        sub foo {
            my $self = shift;

            my $obj = Class::Object->new;
            $obj->sub 'bar', sub {
                blah blah blah
            };
            $obj->sub 'yarrow', sub {
                more blah
            };

            ...now $obj acts like an instance of...
            ...an anonynous inner class...
        }

When $obj goes away, all trace of its class goes away (thanks to a
helpful DESTROY method).  Same effect as an anonymous inner class in
Java.  One instance, methods defined on the spot, can't access it from
outside foo().  The syntax could use a little work...


And, of course, you can get the same effect if you don't sweat the
protections by just defining one package inside another.


Uh oh.  I smell another BDSM OO vs Happy-Go-Lucky OO argument brewing...

-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
WOOHOO!  I'm going to Disneyland!
        http://www.goats.com/archive/980805.html

Reply via email to