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

Can't adverb approximately-equals operator in Rakudo #5333

Open
p6rt opened this issue May 22, 2016 · 5 comments
Open

Can't adverb approximately-equals operator in Rakudo #5333

p6rt opened this issue May 22, 2016 · 5 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented May 22, 2016

Migrated from rt.perl.org#128210 (status was 'open')

Searchable as RT128210$

@p6rt
Copy link
Author

@p6rt p6rt commented May 22, 2016

From @masak

<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

@p6rt
Copy link
Author

@p6rt p6rt commented May 22, 2016

From @masak

<sortiz> m​: my $x = 0.0001e0; say infix​:<≅> $x, 0, :tolerance(1e-3); # Indeed a bug, this works.
<camelia> rakudo-moar 7a4ca4​: OUTPUT«True␤»

@p6rt
Copy link
Author

@p6rt p6rt commented Jun 2, 2016

From @MasterDuke17

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

@p6rt
Copy link
Author

@p6rt p6rt commented Jun 2, 2016

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

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 29, 2017

From @bduggan

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.

@p6rt p6rt added the Bug 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant