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

Rat.perl does not round-trip #3669

Closed
p6rt opened this issue Feb 5, 2015 · 6 comments
Closed

Rat.perl does not round-trip #3669

p6rt opened this issue Feb 5, 2015 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Feb 5, 2015

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

Searchable as RT123741$

@p6rt
Copy link
Author

p6rt commented Feb 5, 2015

From @FROGGS

FROGGS​: m​: say (2/6).WHAT; say (2/6).perl.EVAL.WHAT # rakudobug
camelia​: rakudo-moar 613c0b​: OUTPUT«(Rat)␤(Str)␤»

jnthn​: timotimo​: Thing is, I think it's meant to be a RatStr, not just a
Rat?
timotimo​: no
timotimo​: Any such literal, when written without spaces, produces a pure
numeric value without a stringy allomorphism. Put spaces to override that​:
timotimo​: <1/2> # a Rat
timotimo​: < 1/2 > # a RatStr
timotimo​: http://design.perl6.org/S02.html#Allomorphic_value_semantics
jnthn​: Oh...
timotimo​: i have a failure in "weird-errors" and "start.t", but
otherwise 5 todos passed
timotimo​: i'll just push it to a branch, because i'll have to AFK again
jnthn​: The "any such literal" suggests that it extends to all Numeric forms?
jnthn​: If so, can we (in the Action method for a <...> quote), do​:
jnthn​: if [it's just a single value not a list] {
timotimo​: as in "doesn't have a space in it at all"? that sounds like
something nibblish
timotimo​: but yeah, there ought to be a branch for complex numbers
there, too
jnthn​: try { ...call .Numeric on the string, if we are successful
then add result as a constant and update the QAST we'll produce }
jnthn​: }
jnthn​: m​: say "1/2".Numeric.WHAT
camelia​: rakudo-moar 613c0b​: OUTPUT«(Rat)␤»
jnthn​: m​: say " 1/2".Numeric.WHAT
camelia​: rakudo-moar 613c0b​: OUTPUT«(Rat)␤»
jnthn​: Ah
jnthn​: Darn, that is soft on whitespace...
timotimo​: that'd be "doesn't have spaces"
jnthn​: Yeah, but maybe we can check if the string contains whitespace as
part of the initial "if"
timotimo​: also not sure how <1 / 5> is supposed to work
jnthn​: I'm quite sure we don't want the .Numeric logic implemented in
two places.
jnthn​: So I'm reluctant to go special-casing it in the grammar.
Kristien​: special cases break generic code
jnthn​: Right.
jnthn​: Do it with .Numeric and we get the complex and so on for free also.
dalek​: rakudo/angular_bracket_literal_semantics​: b49d943 | timotimo++ |
src/Perl6/ (2 files)​:
dalek​: rakudo/angular_bracket_literal_semantics​: this is how <1/5> could
produce a Rat directly.
dalek​: rakudo/angular_bracket_literal_semantics​: review​:
rakudo/rakudo@b49d943917
timotimo​: that's fair.
timotimo​: i could have just not pushed this branch then :)
jnthn​: otoh, you could have your grammar rule call <numeric>
jnthn​: '<' ~ <numeric> ~ '>'
timotimo​: you mean '<' ~ '>' <numeric> :)
jnthn​: And that probably also re-uses some logic.
jnthn​: uh, yes
jnthn​: But
jnthn​: wait, don't use ~
jnthn​: 'cus we don't want to explode
jnthn​: We just want to parse it as a normal quote in that case
timotimo​: it already uses ~ around the alteration
jnthn​: Ah

@p6rt
Copy link
Author

p6rt commented Sep 14, 2015

From @usev6

I don't grasp everything of the quoted discussion, but the original evaluation works now as expected​:

$ perl6 -e 'say (2/6).WHAT; say (2/6).perl.EVAL.WHAT'
(Rat)
(Rat)

A test was added to S32-scalar/perl.t with commit df84392d05.

Is this ticket closeable?

1 similar comment
@p6rt
Copy link
Author

p6rt commented Sep 14, 2015

From @usev6

I don't grasp everything of the quoted discussion, but the original evaluation works now as expected​:

$ perl6 -e 'say (2/6).WHAT; say (2/6).perl.EVAL.WHAT'
(Rat)
(Rat)

A test was added to S32-scalar/perl.t with commit df84392d05.

Is this ticket closeable?

@p6rt
Copy link
Author

p6rt commented Sep 14, 2015

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

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

From @coke

On Mon Sep 14 12​:42​:34 2015, bartolin@​gmx.de wrote​:

I don't grasp everything of the quoted discussion, but the original
evaluation works now as expected​:

$ perl6 -e 'say (2/6).WHAT; say (2/6).perl.EVAL.WHAT'
(Rat)
(Rat)

A test was added to S32-scalar/perl.t with commit df84392d05.

Is this ticket closeable?

I think so. Closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant