> Are instances of class objects uniquely identifiable and usable as keys?
Only if they provide a __hash__ function, but in theory it should be possible.

> If so, you could use the class as a key using the same mechanism instead
> of the string name with Param.blah. So then you use class Foo to look up
> a param description rather than actually doing something fancy with Foo
> itself. I don't quite follow the subtleties of what you guys are talking
> about so I'm not sure if that helps.
The problem is that we can now do this:

class Foo(SimObject):
    bar = Param.Bar(....)

class Bar(SimObject):
    foo = Param.Foo(....)


Because of tricks we did with attribute lookup with Param, the
parameter type isn't looked up until the objects are all constructed.
In your case:

class Foo(SimObject):
    bar = Param(Bar, ....)

class Bar(SimObject):
    foo = Param(Foo, ....)


The "bar" parameter would get an error because Bar is not yet defined.
 It's not particularly easy to get around this.  Python 3.0 and the
new way they do metaclasses can help you solve the problem, but
unfortunately, that's not going to be mainstream for a while.

  Nate
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to