MMD leftover: logical_{or,and,xor}

0 views
Skip to first unread message

Leopold Toetsch

unread,
May 11, 2005, 4:17:30 AM5/11/05
to Perl 6 Internals
The logical MMD functions currently try to set a passed in destination
PMCs value via assign, or they return a clone of themselves.

This is verly likely wrong: not all PMCs have to implement assign:

<Dan>: That's why the destination controls assignment.

Additionaly we can't assign to singletons or r/o PMCs.

So the right thing for the logical functions seems to be, to just return
the left or right side according to their boolean value (or return a new
Boolean false in case of xor), i.e. you get a reference to one of the
PMCs usually.

This would break a few tests, which don't cope with these ref semantics.

Comments welcome,
leo

Patrick R. Michaud

unread,
May 11, 2005, 8:46:24 AM5/11/05
to Leopold Toetsch, Perl 6 Internals
On Wed, May 11, 2005 at 10:17:30AM +0200, Leopold Toetsch wrote:
>
> So the right thing for the logical functions seems to be, to just return
> the left or right side according to their boolean value (or return a new
> Boolean false in case of xor), i.e. you get a reference to one of the
> PMCs usually.

This sounds good to me.

Pm

Leopold Toetsch

unread,
May 11, 2005, 10:19:57 AM5/11/05
to Patrick R. Michaud, Perl 6 Internals

Done, rev 8061

* logical ops C<or>, C<and>, C<xor> return the left or right PMC
* C<xor> may return a new scalar, which is set to VTABLE_set_bool(..,0)
(this is more a short term hack until we have HLL type mappings)

* This invalidates current bytecode as the MMD function numbers did change

Please make realclean; ...

> Pm

leo

Reply all
Reply to author
Forward
0 new messages