--- Brent Dax <[EMAIL PROTECTED]> wrote: > Sean O'Rourke: > # > * make parrotclass handle "invoke" > # > this strikes me as the most efficient, > # > but I'm not really confident with C > # > so I'm hesitant to try it > # > # This seems to me like the way to go, > # except you might subclass parrotclass > # to pythonclass (since this lack- > # of-"new" seems to be the "Pythonic way"). The C > # should pretty much just turn around and call > # pmc_new, then return the original return address > # that was passed in. > > I think this is a syntactic issue, not a semantic > issue; as such, it > needs to be dealt with at the syntactic (bytecode) > level, not the > semantic (PMC) level.
Well the fact of the matter is that Python classes behave as subroutines that produce instances hen they're invoked. That's definitely a semantic issue. You wouldn't want to pass your class to a function written in Perl expecting it to be able to call the thing but have it not work. And given that Parrot already has a framework for using anonymous subroutines in place, I don't see that adding an invoke method is a big deal. > I don't think this is the answer, because... > > use PythonClass; > $pyobj=PythonClass.new(); # Doesn't > # work--need to somehow invoke > # the class Just because you can invoke it and get an instance doesn't mean you can't also get an instance by calling the 'new' method. > # Sorry, I'm not very familiar with Python... > import PerlClass > plobj=PerlClass() #Doesn't work--need .new Solution: have all classes (python and otherwise) respond to invoke by creating a new instance :-) Unless there's some language in which invoking a class does something else, I don't see that there would be any problem with this approach. __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com