I'd be glad if people could implement the C<new_extended> vtable method
for other PMCs too.
Some PMCs have a similar constructur (C<invoke>), which is used for
creating Python objects. This method takes PMC areguments only, but is
rather similar. When the C<new_extended> slots are filled, its likely
that C<invoke> can be removed then. That needs some work in the compiler
though, to detect that the function call is actually the object
instantiation.
Thanks,
leo
[1] Python throws a TypeError exception. E.g.
>>> i = int(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: int() takes at most 2 arguments (3 given)
>>>
I think, we could use that as well generically. classes/fixedpmcarray
and some others have it implemented in invoke()
$P0 = getclass 'Foo'
obj = $P0( arg1, arg2, arg3... )
.namespace ['Foo']
.sub __init method # or whatever the BUILD property says
.param int arg1
.param pmc arg2
print "self is a newly created Foo object"
.end
jens
> $P0 = getclass 'Foo'
> obj = $P0( arg1, arg2, arg3... )
How do you create a new Sub then ;)
> jens
leo