summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.ohio-state.edu>1997-04-11 18:25:33 -0400
committerChip Salzenberg <chip@atlantic.net>1997-04-09 00:00:00 +0000
commit9de372454b482d4516b3f3c85b686af8cb18d211 (patch)
tree95fb7e31b19c941ba3eeee5364f86c88600b4aaa
parenteb79544ff58c74c06888e5611739331fa5e91f32 (diff)
downloadperl-9de372454b482d4516b3f3c85b686af8cb18d211.tar.gz
Fix for incorrect overloaded assignment
Subject: Re: overloading problem Jarkko Hietaniemi writes: > > > Please proofread for me. Isn't what Chris is trying to do > > to get overloading to promote the unblessed scalar $c > containing '2' to a Math::Complex blessed object? > > Please correct me if I am wrong but isn't this impossible? > > As there are only three possibilities for binops: normally ordered > arguments, inverted arguments, modifying binop: the overloading will > swap the honest Math::Complex $z as the first argument _and_ pass the > third argument to minus() as undef (perldoc overload) and therefore > > a) the value of the result will be $z - $c, not $c - $z > b) minus() will modify $z, not $c > > I may just too sleepy... Looks like an overeager optimization... Try this: p5p-msgid: 199704112225.SAA03482@monk.mps.ohio-state.edu
-rw-r--r--gv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index cc520d6247..257f4215ba 100644
--- a/gv.c
+++ b/gv.c
@@ -1301,7 +1301,7 @@ int flags;
EXTEND(sp, notfound + 5);
PUSHs(lr>0? right: left);
PUSHs(lr>0? left: right);
- PUSHs( assign ? &sv_undef : (lr>0? &sv_yes: &sv_no));
+ PUSHs( lr > 0 ? &sv_yes : ( assign ? &sv_undef : &sv_no ));
if (notfound) {
PUSHs( sv_2mortal(newSVpv((char *)AMG_names[method + assignshift],0)) );
}