Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xor behavior according to r14547 in [perl6-synopsis] #128

Closed
p6rt opened this issue Jun 12, 2008 · 9 comments
Closed

Fix xor behavior according to r14547 in [perl6-synopsis] #128

p6rt opened this issue Jun 12, 2008 · 9 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 12, 2008

Migrated from rt.perl.org#55666 (status was 'resolved')

Searchable as RT55666$

@p6rt
Copy link
Author

p6rt commented Jun 7, 2008

From @bacek

Hello.

<exp_evalbot> rakudo r28164 OUTPUT[1␤␤]
<bacek> rakudo​: say (0+(defined $!)) xor 1;
<exp_evalbot> rakudo r28164 OUTPUT[1␤]
<bacek> rakudo​: say (defined $!) xor 1;
<exp_evalbot> rakudo r28164 OUTPUT[1␤]
<bacek> rakudo​: try{die}; say defined $!;
<exp_evalbot> rakudo r28164 OUTPUT[1␤]
<bacek> rakudo​: try{die}; say defined $!; say (defined $!) xor 1;
<exp_evalbot> rakudo r28164 OUTPUT[1␤␤]
<bacek> rakudo​: try{die}; say (defined $!) xor 1;
<exp_evalbot> rakudo r28164 OUTPUT[␤]

Two last statements produces "Undef" instead of expected result.

--
Bacek.

@p6rt
Copy link
Author

p6rt commented Jun 12, 2008

From @bacek

Hello.

xor still short-circuit but returns Bool​::False

:)

There is patch attached.

--
Bacek.

@p6rt
Copy link
Author

p6rt commented Jun 12, 2008

From @bacek

xor.diff
diff --git a/compilers/pct/src/PAST/Compiler.pir b/compilers/pct/src/PAST/Compiler.pir
index 52ad089..4c91666 100644
--- a/compilers/pct/src/PAST/Compiler.pir
+++ b/compilers/pct/src/PAST/Compiler.pir
@@ -1451,7 +1451,7 @@ a second child is found that evaluates as true.
     ops.'push_pirop'('set', ops, bpost)
     ops.'push_pirop'('goto', endlabel)
     ops.'push'(falselabel)
-    ops.'push_pirop'('new', ops, '"Undef"')
+    ops.'push_pirop'('get_hll_global', ops, '["Bool"]', '"False"')
     ops.'push'(endlabel)
     .return (ops)
 .end

@p6rt
Copy link
Author

p6rt commented Jun 13, 2008

From @pmichaud

On Thu, Jun 12, 2008 at 03​:52​:43AM -0700, Vasily Chekalkin wrote​:

# New Ticket Created by Vasily Chekalkin
# Please include the string​: [perl #​55666]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=55666 >

Hello.

xor still short-circuit but returns Bool​::False

:)

There is patch attached.

PCT can't assume that Bool​::False will be available, since that's
Perl 6 specific (and PCT is generic to many languages).

I'll either adjust the C<xor> node to have a 'false value returns'
attribute, or move it entirely into the Perl 6 compiler.

Pm

@p6rt
Copy link
Author

p6rt commented Jun 13, 2008

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jun 13, 2008

From @bacek

Patrick R. Michaud wrote​:

I'll either adjust the C<xor> node to have a 'false value returns'
attribute, or move it entirely into the Perl 6 compiler.

+1 for 'move entirely'. It's very Perl6 specific behavior.

--
Bacek

@p6rt
Copy link
Author

p6rt commented Jun 29, 2008

@pmichaud - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 11, 2008

From @bacek

Works for me on r32555.

@p6rt
Copy link
Author

p6rt commented Nov 11, 2008

@bacek - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 11, 2008
@p6rt p6rt added the patch label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant