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

Rakudo erroneously allows non-Str in base conversions #2607

Closed
p6rt opened this issue Jan 8, 2012 · 5 comments
Closed

Rakudo erroneously allows non-Str in base conversions #2607

p6rt opened this issue Jan 8, 2012 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jan 8, 2012

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

Searchable as RT107756$

@p6rt
Copy link
Author

p6rt commented Jan 8, 2012

From @masak

<TimToady> note that nom is not behaving according to spec wrt S02​:3365
<TimToady> :8(42) is supposed to fail

Use of the functional form on anything that is not a string will throw
an exception explaining that the user has confused a number with the
textual representation of a number. This is to catch errors such as
a C<​:8(777)> that should have been C<< :8<777> >>, or the attempt to use
the function in reverse to produce a textual representation from a number.

< masak> TimToady​: hm, I wonder if we have an RT ticket for that...
* masak looks
<masak> seems we don't.
<moritz> TimToady​: :8(Numeric) in general?
<TimToady> :8(none(Str)) :)
< masak> nom​: say :8(42)
<p6eval> nom 327fc9​: OUTPUT«34␤»
* masak submits rakudobug
<TimToady> note also that :8<42> is a special form, so is not subject
to val() semantics
<moritz> and subject to Str.Numeric semantics?
<TimToady> though even if it were, <42> counts 42 as a Str in addition to an Int

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

From @jnthn

On Sun Jan 08 12​:30​:27 2012, masak wrote​:

<TimToady> note that nom is not behaving according to spec wrt
S02​:3365
<TimToady> :8(42) is supposed to fail

Use of the functional form on anything that is not a string will throw
an exception explaining that the user has confused a number with the
textual representation of a number. This is to catch errors such as
a C<​:8(777)> that should have been C<< :8<777> >>, or the attempt to
use
the function in reverse to produce a textual representation from a
number.

< masak> TimToady​: hm, I wonder if we have an RT ticket for that...
* masak looks
<masak> seems we don't.
<moritz> TimToady​: :8(Numeric) in general?
<TimToady> :8(none(Str)) :)
< masak> nom​: say :8(42)
<p6eval> nom 327fc9​: OUTPUT«34␤»
* masak submits rakudobug
<TimToady> note also that :8<42> is a special form, so is not subject
to val() semantics
<moritz> and subject to Str.Numeric semantics?
<TimToady> though even if it were, <42> counts 42 as a Str in addition
to an Int

Now it constrains to Str. So​:

:8(42)
Nominal type check failed for parameter '$str'; expected Str but got Int
instead

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Jan 30, 2012

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

@p6rt
Copy link
Author

p6rt commented Apr 22, 2012

From @moritz

Now tested in S02-literals/radix.t.

@p6rt
Copy link
Author

p6rt commented Apr 22, 2012

@moritz - 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