Skip to content

Instantly share code, notes, and snippets.

@ufobat
Last active December 23, 2018 18:47
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 ufobat/9b10e0cb68e656119bb3e1012c1bb6a1 to your computer and use it in GitHub Desktop.
Save ufobat/9b10e0cb68e656119bb3e1012c1bb6a1 to your computer and use it in GitHub Desktop.
martin@babylon MINGW64 ~/repositories/papierlos/perl6-papierlos (master)
$ perl6 -e 'use StrictClass; role B { has $.foo is required }; class A does B {}; A.new( foo => 1).perl.say;'
A.new(foo => 1)
martin@babylon MINGW64 ~/repositories/papierlos/perl6-papierlos (master)
$ perl6 -e 'use StrictClass; role B { has $.foo is required }; class A does B does StrictClass {}; A.new( foo => 1).perl.say;'
The attribute '$!foo' is required, but you did not provide a value for it.
in method new at C:\rakudo\share\perl6\site\sources\9CFA02DF4E647A51F48B1D301294D0DCFA1E8357 (StrictClass) line 9
in block <unit> at -e line 1
martin@babylon MINGW64 ~/repositories/papierlos/perl6-papierlos (master)
$ perl6 -e 'use StrictClass; role B { has $.foo }; class A does B does StrictClass {}; A.new( foo => 1).perl.say;'
any(A.new(foo => Any), {:foo(1)})
--------
martin@babylon MINGW64 ~/repositories/papierlos/lib (master)
$ cat A.pm6
use StrictClass;
use B;
class A does B does StrictClass {}
martin@babylon MINGW64 ~/repositories/papierlos/lib (master)
$ cat B.pm6
role B {
has $.foo is required;
}
martin@babylon MINGW64 ~/repositories/papierlos/lib (master)
$ perl6 -I. -e 'use A; A.new(:foo(1))'
The attribute '$!foo' is required, but you did not provide a value for it.
in method new at C:\rakudo\share\perl6\site\sources\9CFA02DF4E647A51F48B1D301294D0DCFA1E8357 (StrictClass) line 9
in block <unit> at -e line 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment