Last active
November 21, 2018 23:00
-
-
Save FCO/8badb8ffc1ff86a2c2c4ae7963f37fd2 to your computer and use it in GitHub Desktop.
Red Schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bla { | |
has Ble $.ble; | |
has Bli $.bli; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ble { | |
has Bla $.bla; | |
has Bli $.bli; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bli { | |
has Bla $.bla; | |
has Ble $.ble; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use lib "."; | |
use Schema <Bla Ble Bli>; | |
say Bla; | |
say Ble; | |
say Bli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub get-code($name) { | |
$*REPO.repo-chain.first(*.resolve: CompUnit::DependencySpecification.new: :short-name($name)).prefix.add("{$name}.pm6").slurp | |
} | |
sub EXPORT(*@types --> Hash()) { | |
my @code; | |
for @types -> $type { | |
@code.unshift: "class $type \{ ... }"; | |
@code.push: get-code $type; | |
} | |
@code.join("\n").EVAL; | |
@types.map: -> $type { $type => $type.EVAL } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment