jnthn / oo-monitors

Monitors with condition variables for Raku
12 stars 7 forks source link

Error: Cannot look up attributes in a type object #2

Closed ab5tract closed 8 years ago

ab5tract commented 9 years ago

As reported in this gist: https://gist.github.com/ab5tract/4c2b8cc439d8470cbfda

I will post back a golf, if I find one.

ab5tract commented 8 years ago

More golf-like and useful, I hope:

https://gist.github.com/ab5tract/414e6b6cda21d7f167e27b322932fd14

ab5tract commented 8 years ago

Contents of the golf, for easier access:

use v6;

use OO::Monitors;

monitor Grid {
    has @!grid;

    submethod BUILD() {
        @!grid = [23, 42];
    }
}

my $g = Grid.new;
dd $g;

The error is:

Invocant requires an instance of type Lock, but a type object was passed. Did you forget a .new?

and other variations on the theme, including:

Cannot invoke this object (REPR: Null; VMNull)

jnthn commented 8 years ago

Fixed BUILD and new methods in monitors and added tests.