At 10:12 AM -0500 2/15/04, Michal Wallace wrote:
On Sun, 15 Feb 2004, Luke Palmer wrote:
 > But I think findmethod is a good idea, cross-language-wise.  Each
 language has a different idea of what a method is, and they can
 store it that way.  As long as findmethod is vtableable, you can
 hook it up to whatever system your language uses.

I was thinking the same thing as I wrote my post last night... But I'm not convinced. Suppose I do something like this:

  x = parrot.find("perl::whatever")
  x.method()

Is that second line a method call or a function call?

Got me. I can't see any way it wouldn't be a method call, honestly. It's also very language dependent, being syntax and all--if python says its a method call, it's a method call. (If x is a bound method which you have to call first and then call a method on its return value, well... that makes things a bit more interesting in spots but not for the compiler)


Snipping the multimethod example, multimethod lookup is done by the core as part of the provided "find me the method that matches" code. If you use that code to do the lookup you get MMD. If you don't, you won't.

In fact, since I'm on the subject, properties and
attributes also have this problem.

Properties and attributes have a much bigger problem. Two, actually. First, they're private and may *not* be exposed, so non-class code can't ever see them. (Well, OK, shouldn't ever see them without cheating) Second, as they're class-private, there can (and will) be duplicate names in there.


While I'd love 'em to be interchangeable, they're not going to be. Python code won't ever see what we're calling attributes unless it makes an explicit call to go look. (or Guido alters the syntax, which is both unlikely and arguably a bad thing, or at least parrot's a bad reason to do it)

Random code, in most languages (including perl 6 and python) that does:

y = foo.bar

will either get the bar property or the result of bar method, but never (any of) the bar attributes. (And yes, before someone else jumps in, languages can mark attributes public, but that means the language compiler generates an lvalue method, reducing the problem to a previous one :)
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to