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

[CVS ci] pow, hash, instantiate

18 views
Skip to first unread message

Leopold Toetsch

unread,
Dec 7, 2004, 5:53:58 AM12/7/04
to Perl 6 Internals
I've added a few ops and methods:

* pow MMD function and opcodes
* hash vtable and opcode

Both aren't yet implemented in classes/*

The "new_extended" opcode and vtable got renamed to the more appropriate
"instantiate". classes/complex.pmc has an implementation of this method,
the default is a fallback to pmc_new().

leo

PS please "make clean ; rm runtime/parrot/include/*.pasm ; perl
Configure.pl ..."

Sam Ruby

unread,
Dec 7, 2004, 10:36:20 AM12/7/04
to Leopold Toetsch, Perl 6 Internals
Leopold Toetsch wrote:

> I've added a few ops and methods:
>
> * pow MMD function and opcodes
> * hash vtable and opcode
>
> Both aren't yet implemented in classes/*
>
> The "new_extended" opcode and vtable got renamed to the more appropriate
> "instantiate". classes/complex.pmc has an implementation of this method,
> the default is a fallback to pmc_new().

Excellent!

Question: what is the difference (conceptually) between "new" and
"instantiate"? If they are different, these differences should be
highlighted. If not, the opcode should be named the same in both cases.

Also, I would prefer not to have to deal with implicit registers.
new_p_p would be the method signature I would prefer. The name of the
vtable entry could remain instantiate.

- Sam Ruby

Leopold Toetsch

unread,
Dec 7, 2004, 12:01:19 PM12/7/04
to Sam Ruby, perl6-i...@perl.org
Sam Ruby <ru...@intertwingly.net> wrote:

> Excellent!

Welcome.

> Question: what is the difference (conceptually) between "new" and
> "instantiate"? If they are different, these differences should be
> highlighted. If not, the opcode should be named the same in both cases.

$ perldoc -F ops/pmc.ops

instantiate(out PMC)
Create a new PMC of the type of class REG_PMC(2). This
is a classmethod. Arguments are passed according to
the calling conventions in
docs/pdds/pdd03_calling_conventions.pod. See also the
getclass opcode to get a class PMC.


> Also, I would prefer not to have to deal with implicit registers.

How do you pass a variable amount of initializers then?

E.g.

.local pmc cl, o
cl = getclass "Complex"
o = cl."instantiate"(2, 3)
o = cl."instantiate"("2 + 3i")

> - Sam Ruby

leo

0 new messages