BrowserREPL-button-tip-on BrowserREPL-button-tip-off

EditButtonTip 2019-08-04

class X::Attribute::NoPackage

Compilation error due to declaring an attribute outside of a package

class X::Attribute::NoPackage does X::Comp { }
Code

Compile time error thrown when an attribute is declared where it does not make sense (for example in the mainline).

For example

has $.x;
Code

Dies with

You cannot declare attribute '$.x' here; maybe you'd like a class or a role?
Code

Methods§

method name§

method name(--> Str:D)
Code

Returns the name of the attribute