Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Takers wanted: new_extended

3 views
Skip to first unread message

Leopold Toetsch

unread,
Sep 3, 2004, 7:35:51 AM9/3/04
to Perl 6 Internals
The C<new_extended> opcode and vtable is in CVS. The Complex PMC has a
reference implementation (modulo some error checking[1]) and there are
some tests using the new opcode as well as the function call syntax.

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()

Jens Rieks

unread,
Sep 6, 2004, 2:02:05 PM9/6/04
to perl6-i...@perl.org
Leopold Toetsch wrote:
> I think, we could use that as well generically. classes/fixedpmcarray
> and some others have it implemented in invoke()
Why not generally use the class'es invoke method to create new PMCs/objects?

$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

Leopold Toetsch

unread,
Sep 6, 2004, 3:11:07 PM9/6/04
to Jens Rieks, perl6-i...@perl.org
Jens Rieks <par...@jensbeimsurfen.de> wrote:
> Leopold Toetsch wrote:
>> I think, we could use that as well generically. classes/fixedpmcarray
>> and some others have it implemented in invoke()
> Why not generally use the class'es invoke method to create new PMCs/objects?

> $P0 = getclass 'Foo'
> obj = $P0( arg1, arg2, arg3... )

How do you create a new Sub then ;)

> jens

leo

0 new messages