On Aug 25, 2006, at 12:55 PM, Walter Purvis wrote:

 I really have not been following this thread very closely,
 but has anyone considered Shared Methods?  Instead of making
 an object factory, why not make the object itself be
 responsible for creating an instance of it's type?

 Something like:

    [Shared] Function Instance() As MyClass
      Return New MyClass
    End Function

That makes sense. What would be good is to have an interface, call it
InstanceFromClassName, with two methods, Instance (as decribed above) and ClassName (as described earlier in thread -- it simply returns the name of
the class).

Then any class you want to be instantiable (that's probably not a word) just has to implement that interface and it can be registered with the factory
(which presumably would store the registered
InstanceFromClassName-implementing objects, i.e., the mini- factories, in a dictionary), using a Register(instance as InstanceFromClassName) method.

This would work if we had first-class classes. But we don't, and right now, you can't treat a class as an object in this way. The shared methods and properties make a class *almost* exactly like a module at the moment.

Guyren G Howe
Relevant Logic LLC

guyren-at-relevantlogic.com ~ http://relevantlogic.com

REALbasic, PHP, Python programming
PostgreSQL, MySQL database design and consulting
Technical writing and training


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to