On Mon, 11 Aug 2003, Brent Dax 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 don't think this is the answer, because... > > use PythonClass; > $pyobj=PythonClass.new(); #Doesn't work--need to somehow > invoke > # the class > > #Sorry, I'm not very familiar with Python... > import PerlClass > plobj=PerlClass() #Doesn't work--need .new > > 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.
Actually, python has a magic method called __new__. __new__ actually creates an object (so it gives you the ability to make meta-classes, which we'd also need for ruby. Once __new__ is called and the object is around, python then calls __init__. > plobj=PerlClass() #Doesn't work--need .new What DOES this do? It seems to me that parrotclass could still have invoke for languages that use it, and that perlclass should just throw an exception if you try it. There's no problem doing PerlClass.new() from python. It wouldn't be transparent, but that's fine. It's a small price to pay, and if PerlClass() threw an exception remind us to use it, then it probably wouldn't be a problem at all. So I think invoke on the parrotclass is the way to go. Sincerely, Michal J Wallace Sabren Enterprises, Inc. ------------------------------------- contact: [EMAIL PROTECTED] hosting: http://www.cornerhost.com/ my site: http://www.withoutane.com/ --------------------------------------