On Oct 15, 2003, at 8:36 AM, Dan Sugalski wrote:

I'm poking around in the object stuff today, to try and get at least
single-inheritance objects up and running.

At the moment, I'm torn between just having a new method of some sort in
the class and having a vtable method on the class PMC that returns an
object of that class. (get_pmc on the class returns a new object, or
something of the sort)

What do you mean by "new method in the class" above?


To use the vocabulary of other languages, if you're trying to decide between a static method (a.k.a. a class method), versus a instance method on the class object, I'd say they amount to the same thing. (Either involves calling an implementation which depends on the class, and arranging for that implementation to have access to class-specific data, in the form of a class object or static class data.) Here the distinction is mostly just a matter of viewpoint--C++ has static methods, ObjC has class objects.

If you're trying to decide whether the creation method should have access to a class object, then I think it should--that makes it easier to implement things such as singletons, since you have a place to hang state, such as a cache. And calling this an instance method on the class object is conceptually simpler (I would argue).

Or did I totally miss your point?

JEff



Reply via email to