[Recipients trimmed back to just the list, because it had gotten very
silly.  When replying to someone who's on the list, there's no need to
copy them personally, too; they just end up with duplicates. :)]

On 2003-09-15 at 09:21:18, Piers Cawley wrote:
> Great. But will it also be possible to add methods (or modify them)
> to an existing class at runtime? You only have to look at a Smalltalk
> image to see packages adding helper methods to Object and the like
> (better to add a do nothing method to Object that find yourself doing
> C<$thing.do_that if $thing.can('do_that')> all the time...)

No need to go as far as Smalltalk; just look at Ruby (which probably took
the idea from Smalltalk, but that's beside the point. :)).  There are
all sorts of libraries that do their thing by adding methods to
other classes.  Not just to Object, but to specific built-in classes
such as Time, Date, Numeric, Fixnum, String, etc.  

I'm not saying that this is necessarily the cleanest way to
implement an add-on; it's easy to argue that this sort of thing is
best accomplished by a static class or module method that takes an
instance of the class in question as a parameter.  But it's a nice
thing to have in the toolkit.

-- 
Mark REED                    | CNN Internet Technology
1 CNN Center Rm SW0831G      | [EMAIL PROTECTED]
Atlanta, GA 30348      USA   | +1 404 827 4754

Reply via email to