1 Jun 2004 07:12
Re: [Q] class creation on the fly?
Alan Knight <knight <at> acm.org>
2004-06-01 05:12:01 GMT
2004-06-01 05:12:01 GMT
Hmmm,
Behavior new
superclass: Object;
setInstanceFormat: Object format;
methodDictionary: MethodDictionary new.
seems to work fine for me. Web Toolkit uses these if you define methods
within a page, which admittedly isn't all that common, but I've not had a
problem debugging or inspecting them, or with mysterious crashes.
At 09:15 PM 5/31/2004, Thomas Gagné wrote:
>Why does a dynamic class require a name? If something is identified
>automatically in a domain for which a class must be created to accomodate
>instances of, it won't have a name. It's class will be referenced and
>instances created from it, but it is (in my case at least) transient.
>
>Imagine a class created to handle a database projection. The programmer
>doesn't need to name the projection, it simply exists because it was
>projected (the existentialists among us need to resist the urge...). It
>has behaviors and data unique to itself and the programmer (or program)
>knows how to communicate with it but does so without naming it.
>
>The closest I came without hacking too deeply (but seemed to caus
>instability in the image) was:
>
>newClass := Behavior new
> setInstanceFormat: self format;
> setSuperclass: self;
> methodDictionary: MethodDictionary new.
(Continue reading)
RSS Feed