MMD roundup 2 - TODO and design items

2 views
Skip to first unread message

Leopold Toetsch

unread,
Apr 18, 2005, 6:15:34 AM4/18/05
to Perl 6 Internals
Below is some stuff, which I'm unsure of how it should be implemented
eventually. Input is highly welcome.

Thanks,
leo

MMD_roundp-2.txt

Leopold Toetsch

unread,
Apr 18, 2005, 8:32:04 AM4/18/05
to perl6-i...@perl.org
Leopold Toetsch <l...@toetsch.at> wrote:

> 5) new opcodes that return a new result:

> Px = n_add Py, Pz # new Px created

> These opcodes will be done RSN.

RSN is now. There is one basic test in t/pmc/integer.t. Overloading
is tested in mmd.t.

More tests are welcome for other PMCs.

Caveat: the "n_" variants for the infix opcodes work only for the
arithmetic operations: add, sub, mul, div, fdiv, mod, cmod, pow.

leo

Leopold Toetsch

unread,
Apr 20, 2005, 2:56:13 AM4/20/05
to perl6-i...@perl.org
Leopold Toetsch <l...@toetsch.at> wrote:

> TODO items and design issues

And some more:

6) stringish MMD infix operators: concatenate, repeat

The implementation takes either two strings, or one string and an integer
repeat count. Again not much multi to dispatch IMHO.

Missing: PMC variants of substr, index, split, join, and tons more.
This should all be builtin (NCI) methods of the String PMC.

leo

Nicholas Clark

unread,
Jul 23, 2005, 5:39:17 PM7/23/05
to Leopold Toetsch, Perl 6 Internals
On Mon, Apr 18, 2005 at 12:15:34PM +0200, Leopold Toetsch wrote:
> Below is some stuff, which I'm unsure of how it should be implemented
> eventually. Input is highly welcome.

> TODO items and design issues
>

> 1) bitwise or, and, xor
>
> We currently have two distinct sets of opcodes and MMD functions for
> numeric (i.e. integer) and string bitwise functionality. E.g.
>
> bor Px, Py # $x +|= $y
> bors Px, Py, Pz # $x = $y ~| $z
>
> It now depends on the Perl6 code generator how the Parrot
> implementation should behave (or vice versa :)
>
> a) just do MMD
>
> Px = Px.__as_number() # numeric context
> $P1 = Py.__as_number()
> bor Px, $P1 # MM dispatch on <Int, Int>
>
> $P0 = Py.__as_string() # string context
> $P1 = Pz.__as_string()
> bor Px, $P0, $P1 # MM dispatch on <Str, Str>
>
> b) use current distinct opcodes
>
> bor Px, Py # call get_integer() internally
>
> bors Px, Py, Pz # call get_string() internally
>
> If a) is true, we would have just one set of bitwise MMD functions.
> If b) is true, then there is no MMD needed as the functionality is
> always the same: make numeric/string and do the bitwise operation.
> This would be better implemented with a vtable method.

This all got Warnocked, didn't it?

Having read it twice, I don't think I'm going to get closer to a decent
response than "er, this is really a call for the designer to make, isn't it?"

Nicholas Clark

Leopold Toetsch

unread,
Jul 25, 2005, 10:53:20 AM7/25/05
to Nicholas Clark, Perl 6 Internals
Nicholas Clark wrote:

> This all got Warnocked, didn't it?
>
> Having read it twice, I don't think I'm going to get closer to a decent
> response than "er, this is really a call for the designer to make, isn't it?"

Mway be it's time to start a WARNOCKED file in parrot's root dir and
collect such undesigned items.

> Nicholas Clark

leo

Will Coleda

unread,
Jul 25, 2005, 11:05:59 AM7/25/05
to Nicholas Clark, Perl 6 Internals
Rather than adding another file, I'd recommend putting these under
DESIGN in docs/ROADMAP. Then they're all in one place for Chip when
he gets more tuits.

I added a link to this one there.

Regards.

Reply all
Reply to author
Forward
0 new messages