C
Chris Mullins
I've got some classes that I've built that currently require far too many
locks when they're running in a multi-threaded environment. To get around
this, I'm looking to make these classes immutable. I'm also trying to be (as
any good programmer) as lazy as possible about the approach tha tI take.
I have a class (XmppId) that has roughly the same properties on it you would
expect of an email address.
I would like to be able to say,
"public class ImmutableXmppID : Immutable<XmppId>{}"
I would also like to take the same approach as strings, with a global Intern
list and precalculated hashes in order to help with performance.
The issue so far is that this seems to be well beyond the scope of what
Generics can do. The only option for doing this that I can see is to build a
CodeSmith template, or even a custom piece of Code Generation for the
CodeDOM, and then do it.
Anyone done any signifigant work with immutable classes, and have any gems
of wisdom they're willing to pass along?
locks when they're running in a multi-threaded environment. To get around
this, I'm looking to make these classes immutable. I'm also trying to be (as
any good programmer) as lazy as possible about the approach tha tI take.
I have a class (XmppId) that has roughly the same properties on it you would
expect of an email address.
I would like to be able to say,
"public class ImmutableXmppID : Immutable<XmppId>{}"
I would also like to take the same approach as strings, with a global Intern
list and precalculated hashes in order to help with performance.
The issue so far is that this seems to be well beyond the scope of what
Generics can do. The only option for doing this that I can see is to build a
CodeSmith template, or even a custom piece of Code Generation for the
CodeDOM, and then do it.
Anyone done any signifigant work with immutable classes, and have any gems
of wisdom they're willing to pass along?