Skip to content

Instantly share code, notes, and snippets.

@Altai-man
Created January 13, 2019 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Altai-man/225947b79a209619c5199333e1d76490 to your computer and use it in GitHub Desktop.
Save Altai-man/225947b79a209619c5199333e1d76490 to your computer and use it in GitHub Desktop.
my $inner = Metamodel::ClassHOW.new_type(name => 'Inner');
$inner.^compose;
my $outer = Metamodel::ClassHOW.new_type(name => 'Outer');
my $attr = Attribute.new(name => '$!inner', type => $inner, package => $outer, :has_accessor);
$outer.^add_attribute($attr);
$outer.^compose;
say $inner.WHICH eq $outer.^attributes[0].type.WHICH; # True
say $inner === $outer.^attributes[0].type; # True
say $inner ~~ $outer.^attributes[0].type; # False ???
# Type check failed in assignment to $!inner; expected Inner but got Inner.new ???
say $outer.new(inner => $inner.new);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment