David Whipp wrote:
> 
> Mark J. Reed wrote:
> > Okay, but now we're getting into the fundamental O-O model for
> > Perl.  I guess that's fair game?  You can certainly make the case
> > that prototype-based inheritance makes at least as much sense
> > as class-based inheritance for a dynamic language like Perl.
> > But that's a major implementation change and you have to be careful
> > to be sure that "Perl stays Perl".
> 
> > [...]
> 
> > You could go the Python/JavaScript route and have methods just
> > be members that happen to contain code references, so
> > $obj.meth(@args) would be a synonym for $obj.{meth}.(@args)
> > (or $obj{meth}(@args) with the optional '.'s elided). But then
> > you're merging two namespaces that used to be distinct; e.g.
> > how do you provide an accessor function with the same name as
> > the scalar attribute it's protecting?
> >
> > While I'm also fond of prototype-based inheritance, I think changing
> > the inhertiance model in Perl would be among the most radical
> > changes discussed so far.  Not to say it's not doable, but I'm
> > wondering if it  would be worth it or if it would really maintain the
> > language's fundamentally Perlish nature.
> 
> Good, this thread's found a much more productive path.
> 
> For the distinction between methods vs members, I don't think
> we have to stray too far from perl-is-perl. Afterall, we already
> know that &foo is a function and $foo is a scalar. So from an
> implementation perspective there's no problem giving methods
> and members a separate namespace. Its just a syntax issue ;-).

David Whipp intoned, most echoey: 
> We already have a "sub" keyword; and one of its parameters is
> the name of the function.

Yet when used to define a named function, sub does not appear to
return anything.


$Ref_to_foo = sub foo($$){print "$_[0] was followed by $_[1]\n"};

does not work, it must be written

$Ref_to_foo = *foo = sub ($$){print "$_[0] was followed by $_[1]\n"};



Yet another minor candidate for regularization.

-- 
                                           David Nicol 816.235.1187
                   ftp://ftp.microsoft.com/developr/interix/gpl.txt

Reply via email to