Whither SmallScript? (was Re: Integer micro-benchmarks)

Andrew Hunt andy at toolshed.com
Wed May 2 16:15:47 EDT 2001


On Wed, 2 May 2001 17:09:45 +0100, phil hunt 
<philh at comuno.freeserve.co.uk> wrote:

> On Wed, 02 May 2001 04:10:45 GMT, James A. Robertson <jarober at mail.com> wrote:
> >Greg Ewing wrote:
> >> 
> >> Martin von Loewis wrote:
> >> >
> >> > andy at toolshed.com (Andrew Hunt) writes:
> >> >
> >> > > Can you continue to dynamically add methods to classes at runtime?
> >> >
> >> > Yes, you can.
> >> 
> >> You can also change the class of an object and rearrange
> >> the inheritance hierarchy at runtime, just in case you
> >> were wondering. And add or remove instance variables
> >> dynamically, too (I don't think that one is so easy in
> >> Smalltalk).
> >
> >Sure it is.  
> >
> >MyClass addInstVarName: 'foo'
> >
> >MyClass removeInstVarName: 'foo'
> 
> In Python you can an instance variale to *just one* instance of a 
> class with all the other instances remaining unchanged.

You can do the same in Ruby; both instance variables and methods
can be added to an individual instance as well as a class.  You can
also traverse all the living objects in the system for various nefarious
purposes, if you're so inclined.

/\ndy



More information about the Python-list mailing list