[Y-devel] Y-Protocol proposal, again :-)
Kris Van Hees aedil-y-devel at alchar.org
Tue Apr 13 17:07:45 BST 2004
I'm replying to all in one chunk, since ultimately everything boils down to the
same thing (the concept - I am not implying that you are repeating yourself).
The problem I have always seen happening with representing things like this
with numeric values is that someone tends to come along who feels that it is
'ugly' to have non-monotonously increasing values in the file, where line L+1
should only have value V+1 if line L has value V (and recurse).
I agree that with proper management, using values can work and can work well.
You just need a system in place that ensures uniqueness throughout time, with
care for the borderline cases, like a new last value is assigned, then removed
for some reason before any new numbers are assigned, and a new value needs to
be assigned. It gets tempting to reuse the value there, but again you cannot
do that.
The part that always fascinates me about switching from strings to values, is
that the Bell Labs people (in Plan9) went the opposite way, without really much
concerns for performance loss. It was a bold move, and somehow it seems to
work out nicely.
Kris
On Tue, Apr 13, 2004 at 05:53:38PM +0200, Maurice van der Pot wrote:
> On Tue, Apr 13, 2004 at 11:23:41AM -0400, Kris Van Hees wrote:
> > The one major disadvantages to using values for events/messages is that you
> > make the assumption that both server and client will indeed *NEVER* renumber
> > anything.
>
> Correct. The same holds for strings, they shouldn't change names.
>
> > That is all fine, if you work with definition files that associate
> > the values with meanings *AND* put the rule in place that no value will ever
> > be reused. That usually results in a very messy file that needs a text editor
> > search if you look for the code for a certain message because, well, you cannot
> > depend on any order.
>
> You can reshuffle the messages in that file around as much as you like
> as long as the value is determined by the line itself and not its
> position (so use #define's or use explicit values if you use an enum).
>
> > No big deal, though. Until someone decides that cleaning
> > up that file really should be done (but it won't be possible),
>
> Why wouldn't that be possible with explicit values?
>
> > or when someone
> > feels that (either for easthetic reasons, or for actual design reasons) a block
> > of values should be set aside for a certain module, to be used at will. Which
> > means you will lose in the end, because assigning actual semantic meaning to
> > arbitrary values is *BAD*.
>
> If you want to group messages, use group numbers in addition to message
> numbers. Don't force them into one value and you'll be fine.
>
> > I'm not saying that going with pure values is a bad idea, but we need to have
> > a total commitment that values will be assigned from either 0 or UINTMAX, with
> > no gaps, and whenever a value is no longer needed, the value is *LOST*, so
> > that it is guaranteed that values will never, ever be reused. Even if it seems
> > a good idea, or what e.g. with a major release, clients and servers should be
> > back in sync, and thus renumbering seems possible. Just never do it :)
>
> If you have 4G message values to choose from, losing some is acceptable.
>
> Maurice.
>
--
Never underestimate a Mage with:
- the Intelligence to cast Magic Missile,
- the Constitution to survive the first hit, and
- the Dexterity to run fast enough to avoid being hit a second time.
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved