[pooma-dev] Domain traits
James Crotinger
JimC at proximation.com
Wed Apr 11 21:38:41 UTC 2001
The trouble is that when you "get the traits" from somewhere else,
you are in fact duplicating them. If you write something like
template <class Dom>
struct DomainTraits {
static const int dimensions = Dom::dimensions;
// ...
};
then you are once again duplicating all the traits data.
Oh pshaw. 8-)
Here you'd have one template and the data would be defined in each domain.
The template could get the data from the domain if someone tried to use the
traits class. Right now we have specializations of the traits class for
every concrete class (but using forward declarations to "avoid" the circular
reference), and then we have the concrete classes themselves. Doing it the
other way you'd only specialize for "int" so there would be one general
template and (currently) one specilization (for int). Yes, the actual data
gets duplicated if you use the traits class, at least in appearance. It is
not clear to me that any data is duplicated in practice (as in taking up
separate memory). Perhaps it is, but this is pretty unimportant. The
important thing is the complexity of the software and it would be
considerably less complex the other way.
> Anyway, my 2 cents is to leave the traits in the class.
> Jim
OK, but can I commit these changes anyway?? ;-)
No. Stephen and I both like to say things like "Domain::dimensions" so leave
it there. I only want to use DomainTraits if I want to program for the
possibility of someone passing me an "int" as a domain.
Seriously, I'd like to finish this and move on to other
stuff. Unless there are technical reasons why this
would prevent new Pooma code development, break
existing code, cause a painful burning sensation, etc.,
I'd like to check in my changes later today.
Definitely falls into the "painful burning sensation" category. Change the
enums to static consts, but don't remove the traits from the domains.
Granted there may not be that many places in the Pooma source where this
occurs, but it has been part of the user interface, at least two "users"
like it, and indeed other users may have used this idiom and changing it
would break their code (Pooma 2 code exists that is not checked into our
repository, remember, so it also falls into the "breaks existing code"
category.).
Thanks, Julian C.
You're welcome.
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20010411/2e7f730b/attachment.html>
More information about the pooma-dev
mailing list