Created
March 7, 2013 16:23
-
-
Save hoelzro/5109267 to your computer and use it in GitHub Desktop.
Perl 6 window manager
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
#!/usr/bin/env perl6 | |
use v6; | |
class Window { | |
has $.name; | |
has $.class; | |
} | |
class WindowManager { | |
proto method manage-window(Window $w) { * } | |
multi method manage-window(Window $w ( :class<Firefox> )) { | |
say "Managing Firefox"; | |
} | |
multi method manage-window(Window $w) { | |
say "Falling back to default management"; | |
} | |
} | |
my $manager = WindowManager.new; | |
my $window = Window.new(:class<Firefox>, :name<Firefox>); | |
$manager.manage-window($window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment