IoIo programming languageConstants- January 10, 2008 Kevin Greer posted this to LtU recently and I though it was worth repeating due to the recent interest in dynamic features: Constant := Object clone do ( with := method(msg, self msg := msg self activate := method(call message setName(msg asString); msg) ) ) Lets try it out: Make PI a regular number PI := 3.1415926 Make b a method that uses it b := method(PI+PI) writeln(b) - 6.283185 Inspect bs "source" code writeln(getSlot("b") code) - block(PI...http://www.iolanguage.com/blog/blog.cgi?do=item&id=108 |