Anonymous user
Add a variable to a class instance at runtime: Difference between revisions
Add a variable to a class instance at runtime (view source)
Revision as of 17:48, 5 September 2015
, 8 years ago→{{header|Perl 6}}: monkey kebab
(added Morfa) |
m (→{{header|Perl 6}}: monkey kebab) |
||
Line 1,063:
On the other hand, mixins are frowned upon when it is possible to compose roles directly into classes (as with Smalltalk traits), so that you get method collision detection at compile time. If you want to change a class at run time, you can also use monkey patching:
<lang perl6>use
augment class Int {
method answer { "Life, the Universe, and Everything" }
|