Add a variable to a class instance at runtime: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Added another way of adding a method to a singleton)
(Added zkl)
Line 1,417: Line 1,417:
% $s2 value time
% $s2 value time
can't read "time": no such variable</lang>
can't read "time": no such variable</lang>

=={{header|zkl}}==
Once created, class structure is fixed. However, using reflection, you can blow apart the class structure, add what ever and recompile the class (at run time). The REPL does this to store intermediate user results (defined classes, functions, variables, etc). It is ugly, slow and left as an exercise to the reader who cares.



{{omit from|Applesoft BASIC}}
{{omit from|Applesoft BASIC}}