Created
December 18, 2012 11:04
-
-
Save egonelbre/4327151 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function sayExt(obj){ | |
return obj.say(); | |
} | |
Zoo = Context(function(player){ | |
Lion = Role({ | |
say : function(){ return 'meow'; } | |
}); | |
function sayInt(obj){ | |
return obj.say(); | |
} | |
lion = player.as(Lion); | |
return function(){ | |
// what should be the expected output for these | |
log( sayExt(lion) ); // ??? meow or hmmm | |
log( sayInt(lion) ); // ??? meow | |
log( lion.toString() ); // meow | |
}; | |
}); | |
player = {say : function(){ return 'hmmm'; }}; | |
zoo = Zoo(player); | |
zoo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment