Created
May 8, 2014 18:55
-
-
Save moritz/1f58e20a98d7b0f5219d to your computer and use it in GitHub Desktop.
Generate a class on the fly (or at least trying to...)
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 v6; | |
my ($classname, $message) = ('C', 'hi'); | |
my $class := 1.HOW.new_type(:name($classname)); | |
$class.^add_method('message', anon method message() { $message }); | |
$class.^compose(); | |
say $class.new.message(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment