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 error message when using attributes on type objects #2204

Open
p6rt opened this issue Oct 4, 2010 · 8 comments
Open

LTA error message when using attributes on type objects #2204

p6rt opened this issue Oct 4, 2010 · 8 comments
Labels
Bug LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Oct 4, 2010

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

Searchable as RT78200$

@p6rt
Copy link
Author

p6rt commented Oct 4, 2010

From @masak

From the backlog​:

<hudnix> well I just spent a miserable two hours figuring out that the
error message "Type objects are abstract and have no attributes, but
you tried to access @​!foo" in fact had nothing to do with the
attribute @​!foo or anything else in my class, but was really
complaining that I had declared my object with "my $obj;" instead of
"my $obj .= new"

Would it be possible to have the error message be something like
"Tried to use type object $obj as an instance object"? Especially
having the name of the variable with the object being improperly
accessed seems like it would be a big help in a situation such as the
above.

@p6rt
Copy link
Author

p6rt commented May 28, 2012

From @coke

On Mon Oct 04 04​:15​:25 2010, masak wrote​:

From the backlog​:

<hudnix> well I just spent a miserable two hours figuring out that the
error message "Type objects are abstract and have no attributes, but
you tried to access @​!foo" in fact had nothing to do with the
attribute @​!foo or anything else in my class, but was really
complaining that I had declared my object with "my $obj;" instead of
"my $obj .= new"

Would it be possible to have the error message be something like
"Tried to use type object $obj as an instance object"? Especially
having the name of the variable with the object being improperly
accessed seems like it would be a big help in a situation such as the
above.

Can we get some sample code that demonstrates this problem?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 28, 2012

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

@p6rt
Copy link
Author

p6rt commented May 28, 2012

From @masak

masak (>>), Coke (>)​:

From the backlog​:

<hudnix> well I just spent a miserable two hours figuring out that the
error message "Type objects are abstract and have no attributes, but
you tried to access @​!foo" in fact had nothing to do with the
attribute @​!foo or anything else in my class, but was really
complaining that I had declared my object with "my $obj;" instead of
"my $obj .= new"

Would it be possible to have the error message be something like
"Tried to use type object $obj as an instance object"? Especially
having the name of the variable with the object being improperly
accessed seems like it would be a big help in a situation such as the
above.

Can we get some sample code that demonstrates this problem?

<masak> r​: class A { has $!x; method foo { say $!x } }; A.foo
<p6eval> rakudo 197e0b​: OUTPUT«Cannot look up attributes in a type object [...]

@p6rt
Copy link
Author

p6rt commented Apr 9, 2015

From @FROGGS

How about​:

(before)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object
  in method foo at -e​:1
  in block <unit> at -e​:1

(after)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object. Perhaps you need to instanciate first?
  in method foo at -e​:1
  in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented Nov 5, 2017

From @AlexDaniel

Hey Tobias, it looks like you've been working on this ticket for over two years. How is it going?
On 2015-04-09 12​:09​:55, FROGGS.de wrote​:

How about​:

(before)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object
in method foo at -e​:1
in block <unit> at -e​:1

(after)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object. Perhaps you need to
instanciate first?
in method foo at -e​:1
in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented Nov 5, 2017

From @AlexDaniel

FWIW the error message seems to be coming from MoarVM​: https://github.com/MoarVM/MoarVM/blob/ad86184681590c81fc25b9e90b406e5163098796/src/6model/reprconv.c#L607 (many similar lines like this in that file)

On 2017-11-05 07​:46​:17, alex.jakimenko@​gmail.com wrote​:

Hey Tobias, it looks like you've been working on this ticket for over two
years. How is it going?
On 2015-04-09 12​:09​:55, FROGGS.de wrote​:

How about​:

(before)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object
in method foo at -e​:1
in block <unit> at -e​:1

(after)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object. Perhaps you need to
instanciate first?
in method foo at -e​:1
in block <unit> at -e​:1

@p6rt
Copy link
Author

p6rt commented Nov 10, 2017

From @MasterDuke17

On Sun, 05 Nov 2017 07​:54​:01 -0800, alex.jakimenko@​gmail.com wrote​:

FWIW the error message seems to be coming from MoarVM​:
https://github.com/MoarVM/MoarVM/blob/ad86184681590c81fc25b9e90b406e5163098796/src/6model/reprconv.c#L607
(many similar lines like this in that file)

On 2017-11-05 07​:46​:17, alex.jakimenko@​gmail.com wrote​:

Hey Tobias, it looks like you've been working on this ticket for over
two
years. How is it going?
On 2015-04-09 12​:09​:55, FROGGS.de wrote​:

How about​:

(before)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object
in method foo at -e​:1
in block <unit> at -e​:1

(after)
$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a type object. Perhaps you need to
instanciate first?
in method foo at -e​:1
in block <unit> at -e​:1

The error message was recently improved in MoarVM/MoarVM@68a18b4#diff-be9fec83f5b58ba42962ded7b65de075

$ perl6-m -e 'class A { has $!x; method foo { say $!x } }; A.foo'
Cannot look up attributes in a A type object
  in method foo at -e line 1
  in block <unit> at -e line 1

@p6rt p6rt added the Bug label Jan 5, 2020
@MasterDuke17 MasterDuke17 added the LTA Less Than Awesome; typically an error message that could be better label Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

2 participants