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 18:55, 5 June 2009
, 15 years agoSlate implementation
(omits) |
(Slate implementation) |
||
Line 194:
e.instance_eval("class << self; attr_accessor :foo; end")
puts e.foo</lang>
=={{header|Slate}}==
Slate objects are prototypes:
<lang slate>
define: #Empty -> Cloneable clone.
define: #e -> Empty clone.
e addSlotNamed: #foo valued: 1.
</lang>
=={{header|Smalltalk}}==
|