On Oct 28, 2003, at 3:56 PM, Luke Palmer wrote:

  Object Instantiation
    Dan had a moment of clarity and declared that the Parrot Way to
    instantiate an object in class Foo will be:

new P5, .Foo

All we need now is a working implementation. And, apparently, knowing
what class a class is a member of might be handy, but Dan's punting on
("ignoring the heck out of") that one.

(Yeah, I read the thread, but just thought of this now)


So classes will be integers?  Fair enough, as there's just as many of
those as there are memory locations.

I do worry about some long-running daemon that uses anonymous classes
heavily.  It's possible that after quite some time, we'd run out of
integers, even when there are far fewer than 4 billion classes in
current existence.

So, shouldn't classes instead be objects that can be garbage-collected?
I know that violates that nice equivalency between PMCs and classes, but
I'm sure there's a way to finesse the convenience of that equivalence
somehow...

I'd say it's more like class names are integers, so anonymous classes don't use them up since they don't have names. But that points out that there should be a way to instantiate a member of a class given the class object (itself a PMC), with the above syntax serving as a bit of a shorthand (possibly an optimized one) for finding the class object based on its name and then instantiating it.


(And it's not really that a class name is an int, but rather that the representation of the name spit out by a compiler would be an int.)

Just a thought.

JEff



Reply via email to