Would it make sense for the syntax to be more like 

my $obj3 = $obj.new;

Of course, that would kill my ".= new" idea for instantiation (since it would
call an instance-based new instead of class-based), but I'm getting less fond
of that syntax anyway (though I think .= should definitely be supported in the
language, and $a .= foo; should DTRT, ie, $a = $a.foo).

> 
> On Monday, October 14, 2002, at 07:54  PM, Mark J. Reed wrote:
> > Heh, indeed.  :) But seriously, you could do worse.  JavaScript 
> > receives
> > a lot of (IMHO) undeserved criticism.  The name is a blatant marketing
> 
> No, I've had to use it off-and-on for the past year... it deserves it.  
> :-)  But enough of that.
> 
> I agree, prototype based inheritance is really useful sometimes.  
> (Those of you not subjected to JS may be more familiar with 
> Class::Classless, a quite nice perl5 implementation.)
> 
> I'd definitely like to see builtin support for instance based 
> inheritance.  I've found many, many uses for Class::Classless, and have 
> made halfbreed variations of it for several special-case situations.  
> IMO the best situation would be to have both worlds collide; not 
> strictly class-based, not strictly proto-based, but a mix-and-match of 
> each in accordance to the particular problem you're trying to solve.
> 
> An interesting way to do this could simply be to allow object 
> instances, as well as normal classes, in the inheritance tree; you 
> could then mix a prototype-based object with, for example, several 
> class-based mixin behaviors, etc.
> 
> Something like:
> 
>    my $obj = Something.new;        # (1) obj based on a class
> 
>    class MyClass is $obj {...}     # (2) a class based on an obj!
> 
>    my $obj2 = MyClass.new;         # (3) obj based on a class based on 
> an obj
> 
>    my $obj3 isa $obj;              # (4) an obj based on another obj
> 
>    my $obj4 isa $obj isa MyClass;  # (5) obj + mixin (but what syntax???)
> 
> 
> Note that (2) would have interesting implications if you changed $obj 
> runtime, but would be very uncommon.  (4,5) could be quite common, tho. 
>   And (4,5) need to use a word other than 'is', which means that 
> currently none of these syntaxes look anything alike.  :-P
> 
> Mixing OO frameworks is quite useful in some real-world situations.  
> Sometimes it's more efficient to change your OO implementation than to 
> try to translate your problem to fit the one you're given.
> 
> MikeL
> 

-- 
Adam Lopresto ([EMAIL PROTECTED])
http://cec.wustl.edu/~adam/

All I want is a warm bed, a kind word, and unlimited power.

Reply via email to