Skip to content

Instantly share code, notes, and snippets.

@moritz
Created May 8, 2014 18:55
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 moritz/1f58e20a98d7b0f5219d to your computer and use it in GitHub Desktop.
Save moritz/1f58e20a98d7b0f5219d to your computer and use it in GitHub Desktop.
Generate a class on the fly (or at least trying to...)
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