Skip Menu |
Report information
Id: 128210
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Sun, 22 May 2016 12:07:06 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Subject: [BUG] Can't adverb approximately-equals operator in Rakudo
Download (untitled) / with headers
text/plain 586b
<masak> m: my $x = 0; say $x ≅ 0 :tolerance(1e-3) <camelia> rakudo-moar 7a4ca4: OUTPUT«===SORRY!=== Error while compiling /tmp/Pvx3eWkBNW␤You can't adverb &infix:<≅> [...] <masak> can't adverb? o rly? <masak> how do I $x ≅ 0 :tolerance ? <bartolin> m: my $x = 0; say ($x ≅ 0, :tolerance(1e-3)) <camelia> rakudo-moar 7a4ca4: OUTPUT«(True tolerance => 0.001)␤» <bartolin> like that? <bartolin> no, probably not ... <masak> nope, that's just printing a pair, not passing an adverb. <masak> I believe I haz found... a bug * masak .oO( dun dun DUN ) * masak submits rakudobug
Download (untitled) / with headers
text/plain 147b
<sortiz> m: my $x = 0.0001e0; say infix:<≅> $x, 0, :tolerance(1e-3); # Indeed a bug, this works. <camelia> rakudo-moar 7a4ca4: OUTPUT«True␤»
Date: Wed, 1 Jun 2016 22:09:14 -0400
To: perl6-bugs-followup [...] perl.org
From: Daniel Green <ddgreen [...] gmail.com>
Subject: [perl #128210]
Download (untitled) / with headers
text/plain 379b
I've been looking into this and just got some clarification from TimToady on expected behaviour for adverbs and chains in general (http://irclog.perlgeek.de/perl6/2016-06-02#i_12589974). The gist is that adverbs should be placed at the end of a chain and then distributed to all the operators in the chain, which will of course make the example in this ticket "just work".

Dan
Download (untitled) / with headers
text/plain 439b
It seems that it is possible adverb custom operators, e.g. perl6 -e 'sub infix:<~~~>($x,$y,:$z) { say "$x $y $z" }; 1 ~~~ 2 :z(12)' 1 2 12 However, when these are chained, the adverb is not distributed perl6 -e 'sub infix:<~~~>($x,$y,:$z) { say [$x,$y,$z].perl; 9 }; 1 ~~~ 2 ~~~ 3 :z(12)' [1, 2, Any] [9, 3, 12] So, if adverbs are made to distribute across infix operators in general then I suppose this existing behavior would change.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org