--- Jonathan Lang <[EMAIL PROTECTED]> wrote:

> Ovid wrote:
> > If I call this:
> >
> >   if $class.^can('wibble') { ... }
> >
> > Does Perl 6 return false if that's only an instance method?  Will
> the
> > WALK iterator returned by .^can return references to instance
> methods?
> As I understand it, Perl 6 generally doesn't bother with the
> class-vs-instance distinction.  Instead, it uses an "objects and
> prototypes" paradigm, much like the distinction between proper nouns
> and common nouns.

I'm not sure that helps.  From the docs:

  If you declare an ordinary method, it can function as a
  "class" method when you pass it a protoobject such as
  "Dog" regardless of how defined the prototype object is,
  as long as the method body doesn't try to access any
  information that is undefined in the current instance.

Which means, as far as I can tell, that 'can' can still return methods
which it's not legal for me to call.  I can add those methods to the
metaobject, but that seems like a hack to get around this problem.  Not
disambiguating between class and instance methods makes it seem like
can() cannot possible return correct methods in all cases.  As a
result, metaprogramming seems broken.


Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to