How can I add methods to a class at runtime in Smalltalk?
问题 I'm building a Smalltalk API to an XML-based web service. The XML service is so regular that, rather than write the methods by hand, I figured I'd just override #doesNotUnderstand: to dynamically add methods via MyApi class>>compile: , then call all the methods once in a workspace, then remove the DNU and have my nice API. This works great, but passing a giant string to #compile: just feels really wrong to me; in Python and other languages, I'd be able to attach a nicely syntax-checked lambda