D - Nested enumerated types
- ~Gh0sT~ (43/43) May 27 2003 If I have, for example, my own window messages, classified as:
- Andy Friesen (10/58) May 27 2003 Conceptually, enumerations are not integers, and they should not be
If I have, for example, my own window messages, classified as:
1. hook notifies
1.1. CBT hook
- minimal value
- maximal value
window ...
- creation
- destruction
- activation
- resizing
- moving
1.2. Keyboard hook
- minimal value
- maximal value
key
- pressing
- releasing
.. and others ...
2. internal notifies
- minimal value
- maximal value
2.1. window area refreshs
2.2. waiting to update bottom windows
........
The true object-oriented language will be able to let me use expressions such:
if( msg.code >= msgvalues.internal.min )
...........
else if( msg.code >= msgvalues.hooks.cbt.min )
{
if( msg.code <= msgvalues.hooks.cbt.max )
switch( msg.code )
{
case msgvalues.hooks.cbt.create:
.......
case msgvalues.hooks.cbt.destroy:
.......
.......
}
else if( msg.code <= msgvalues.hooks.keyboard.max )
.........;
}
~Gh0sT~
~Gh0sT~ [frankenstein fastmail.fm]
May 27 2003
~Gh0sT~ wrote:
If I have, for example, my own window messages, classified as:
1. hook notifies
1.1. CBT hook
- minimal value
- maximal value
window ...
- creation
- destruction
- activation
- resizing
- moving
1.2. Keyboard hook
- minimal value
- maximal value
key
- pressing
- releasing
.. and others ...
2. internal notifies
- minimal value
- maximal value
2.1. window area refreshs
2.2. waiting to update bottom windows
........
The true object-oriented language will be able to let me use expressions such:
if( msg.code >= msgvalues.internal.min )
...........
else if( msg.code >= msgvalues.hooks.cbt.min )
{
if( msg.code <= msgvalues.hooks.cbt.max )
switch( msg.code )
{
case msgvalues.hooks.cbt.create:
.......
case msgvalues.hooks.cbt.destroy:
.......
.......
}
else if( msg.code <= msgvalues.hooks.keyboard.max )
.........;
}
~Gh0sT~
~Gh0sT~ [frankenstein fastmail.fm]
Conceptually, enumerations are not integers, and they should not be
treated like them. Comparing them for anything other than equality, or
lack of same isn't a very sound idea. (like adding booleans. It's weird
and doesn't make sense)
Aside from that, enumerations have no part at all in the object oriented
paradigm. They're a completely orthagonal concept.
What I would do is have a message code and subcode. You could also
simply prefix the enumerations, a la win32.
-- andy
May 27 2003








Andy Friesen <andy ikagames.com>