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

LTA Failure error message when hash-indexing a non-hash (using either .<> or .{}) in Rakudo #2106

Closed
p6rt opened this issue Aug 29, 2010 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Aug 29, 2010

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

Searchable as RT77504$

@p6rt
Copy link
Author

p6rt commented Aug 29, 2010

From @masak

<masak> has anyone else gotten this error message lately?
'postcircumfix​:<Nil()> not defined for type Array()'
<masak> I find it weird and disconcerting.
<TimToady> maybe that's because it *is* weird and disconcerting

...then, a day later...

<masak> rakudo​: ~[]<c>
<p6eval> rakudo d9aa57​: OUTPUT«postcircumfix​:<Nil()> not defined for
type Array() [...]
<masak> hah! got you, bug!
<masak> yeah!
* masak slams it into RT!

The error message is highly confusing. There's no such thing as
postcircumfix​:<Nil()>. In fact, that looks like an interpolation gone
wrong somewhere. The error message should probably have read
'postcircumfix​:<< < > >> not defined for type Array()' or something.

Something like The prefix​:<~> in the error-triggering example is
required, because the hash access itself only generates a Failure,
which is then condensed into an actual run-time error by using the
failure somehow; for example, by stringifying it.

The same less-than-awesome error message is given for other types, and
for the .{} hash accessor as well​:

<masak> rakudo​: ~5<c>
<p6eval> rakudo d9aa57​: OUTPUT«postcircumfix​:<Nil()> not defined for
type Int() [...]
<masak> rakudo​: ~5{'c'}
<p6eval> rakudo d9aa57​: OUTPUT«postcircumfix​:<Nil()> not defined for
type Int() [...]

@p6rt
Copy link
Author

p6rt commented Aug 30, 2010

From @masak

masak (>)​:

The error message is highly confusing. There's no such thing as
postcircumfix​:<Nil()>. In fact, that looks like an interpolation gone
wrong somewhere. The error message should probably have read
'postcircumfix​:<< < > >> not defined for type Array()' or something.

<pmichaud> a-ha!
<pmichaud> it's returning a Failure... that's good.
<pmichaud> it's just the error that is lta
<pmichaud> looking
<pmichaud> heh
<pmichaud> fail "postcircumfix​:<{ }> not defined for type {self.WHAT}"
<pmichaud> if self.defined;
<pmichaud> fail FAIL
<pmichaud> the curlies are being interpolated.
<pmichaud> (the first ones)
<colomon> doh!
<masak> :D
<masak> that explains everything.
* masak amends the ticket
<pmichaud> if someone wants to fix it to escape the curlies, that would be awesome. :-)

@p6rt
Copy link
Author

p6rt commented Aug 30, 2010

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

@p6rt
Copy link
Author

p6rt commented Jun 10, 2013

From @coke

On Sun Aug 29 17​:27​:23 2010, masak wrote​:

masak (>)​:

The error message is highly confusing. There's no such thing as
postcircumfix​:<Nil()>. In fact, that looks like an interpolation
gone
wrong somewhere. The error message should probably have read
'postcircumfix​:<< < > >> not defined for type Array()' or something.

<pmichaud> a-ha!
<pmichaud> it's returning a Failure... that's good.
<pmichaud> it's just the error that is lta
<pmichaud> looking
<pmichaud> heh
<pmichaud> fail "postcircumfix​:<{ }> not defined for type
{self.WHAT}"
<pmichaud> if self.defined;
<pmichaud> fail FAIL
<pmichaud> the curlies are being interpolated.
<pmichaud> (the first ones)
<colomon> doh!
<masak> :D
<masak> that explains everything.
* masak amends the ticket
<pmichaud> if someone wants to fix it to escape the curlies, that
would be awesome. :-)

Updated behavior looks A enough​:

09​:17 < [Coke]> rakudo​: []<c>
09​:17 <+camelia> rakudo b2072f​: OUTPUT«postcircumfix​:<{ }> not defined for type
  Array␤ in method Str at src/gen/CORE.setting​:10160␤ in
  method Str at src/gen/CORE.setting​:876␤ in method Stringy at
  src/gen/CORE.setting​:885␤ in sub prefix​:<
> at
  src/gen/CORE.setting​:1272␤ in sub prefix​:<> at src/gen/…
09​:17 < [Coke]> rakudo​: 5<c>
09​:17 <+camelia> rakudo b2072f​: OUTPUT«postcircumfix​:<{ }> not defined for type
  Int␤ in method Str at src/gen/CORE.setting​:10160␤ in method
  Str at src/gen/CORE.setting​:876␤ in method Stringy at
  src/gen/CORE.setting​:885␤ in sub prefix​:<
> at
  src/gen/CORE.setting​:1272␤ in sub prefix​:<
> at src/gen/CO…
09​:17 < [Coke]> rakudo​: 5{'c'}
09​:17 <+camelia> rakudo b2072f​: OUTPUT«postcircumfix​:<{ }> not defined for type
  Int␤ in method Str at src/gen/CORE.setting​:10160␤ in method
  Str at src/gen/CORE.setting​:876␤ in method Stringy at
  src/gen/CORE.setting​:885␤ in sub prefix​:<
> at
  src/gen/CORE.setting​:1272␤ in sub prefix​:<~> at src/gen/CO…

Closable with tests.
--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 2, 2015

From @usev6

I added three tests to S02-types/hash.t with commit Raku/roast@a3669d54c5

I'm closing this ticket now.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jan 2, 2015

From @usev6

I added three tests to S02-types/hash.t with commit Raku/roast@a3669d54c5

I'm closing this ticket now.

@p6rt
Copy link
Author

p6rt commented Jan 2, 2015

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