Skip Menu |
Report information
Id: 78200
Status: open
Priority: 0/
Queue: perl6

Owner: FROGGS.de <email [at] froggs.de>
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] LTA error message when using attributes on type objects
Date: Mon, 4 Oct 2010 13:15:01 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 642b
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.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 797b
On Mon Oct 04 04:15:25 2010, masak wrote: Show quoted text
> 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
Subject: Re: [perl #78200] [BUG] LTA error message when using attributes on type objects
Date: Mon, 28 May 2012 11:43:24 +0200
To: perl6-bugs-followup [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 913b
masak (>>), Coke (>): Show quoted text
>> 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 [...]
Download (untitled) / with headers
text/plain 388b
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
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:
Show quoted text
> 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


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:
Show quoted text
> 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


Download (untitled) / with headers
text/plain 1.2k
On Sun, 05 Nov 2017 07:54:01 -0800, alex.jakimenko@gmail.com wrote: Show quoted text
> 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 https://github.com/MoarVM/MoarVM/commit/68a18b4f22553bfd96c47c8d7453af881772b3d4#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


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org