Aaron Sherman writes:
: On Wed, 2002-05-15 at 21:38, root wrote:
: > 
: > I've always liked how VB allowed you to define "instance methods." 
: > Basically a more elegant way of doing callbacks, plus allows some 
: > structure within your callbacks. Will Perl6 allow this (Perl5 sortof did, 
: > but since the "bless" way of doing things is going away...)
: > 
: > Perhaps...
: > 
: >  class foo {...}
: > 
: >  $x = new foo;      #BTW, is there some standard way of creating instances 
: >             #now?
: 
: my $x is foo; # I think that's correct

Er, no.  That just ties the variable $x to class foo, presuming there
is a class foo.  Doesn't say anything at all about the *contents* of
$x.  You can type the value of $x by saying:

    my foo $x;

but that still doesn't create an instance.

Constructors haven't been designed yet, but one approach would be to
have the built-in opaque object type assume a constructor name of "new"
if you don't declare one.  I can see some problems with that though.
Certainly the Perl 5 way of creating instances will continue to be
supported--that is, with the data structure totally orthogonal to the
class binding.  Whether the new opaque objects are constructed inside
or outside of C<bless> is still to be decided.

Larry

Reply via email to