Michal Wallace writes: > On Fri, 13 Feb 2004, Dan Sugalski wrote: > > > We also have to have a way to fetch the method PMC for a named method > > for later use, which is where the interesting bits come in. > > > > This is required for a number of reasons, including Python, so we > > have to have it. The question is... *When* is the name resolved? That > > is, if we do: > > > > findmethod P4, Pobject, "methodname" > > > > does the method PMC that gets stuck in P4 represent the method > > "methodname" for the object *at that point in time* or does it > > represent the method *at the time it is invoked*? That is, do we > > defer actual lookup until invocation, or do we resolve at method find > > time? > > > For python, you want P4 to contain the method as > it is when this op is run. > > But the whole idea of a findmethod seems very > unpythonic to me. In python, a method is just another > attribute... One that happens to be callable and also > happens to know what instance it's bound to.
As with Perl 6. A sub object has a C<do> trait which specifies what to do when it's called. 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. Luke