Re: Circlemud design issues

From: John Evans (evansj@HI-LINE.NET)
Date: 04/23/98


On Thu, 23 Apr 1998, James Turner wrote:

> As for added flexibility -- what added flexibility is gained from:
>
> #define GET_AC(ch)        ((ch)->points.armor)
>
> None. Yes, there are other uses for macros -- ones that the C language
> itself can't provide otherwise -- but the way Circle uses them is as
> short-hand hacks that really have no place anymore.

The place that macros have is saving MY brain juice so that I can use it
for more productive means. If I had to memorize the character structure
inside and out to get anything done, I would not have near as much code
done as a do now. the GET_XXX(ch) macros are a life saver!

I don't see anything bad about them at all. May take a bit longer to
compile, but I'd rather wait an extra second or five on the compile than
waste minutes searching through structs.h for an elusive variable name.

If _you_ don't like macros, then remove them in _your_ code. I thought
that that was the whole point of a publicly available code-base... So
each person could code the MUD in their own style and mannerisms.

> On the flip side, bizarre macro side-effects only make circle harder
> for newer coders to understand.  And, though you may not like or care
> that there are people who learn or improve their skills with circle,
> it happens quite frequenly.

Quite the opposite. Again, if the easy to read (and remember) macros were
not there, I'd have nowhere near as much coded on my MUD as I do now.
Example:
#define GET_BAD_PWS(ch)         ((ch)->player_specials->saved.bad_pws)

It's quite clear what GET_BAD_PWS(ch) means when you read it in context
with the code in nanny() in interpreter.c. Of course,
ch->player_specials->saved.bad_pws is also fairly clear as well, but if I
were to use the variable at a later date, I _know_ that I could remember
the macro a hell of a lot easier than I can the data structs. No, I'm not
being lazy at all. I'm applying what little brain juice that I have
available to me in the most productive manner.


John Evans <evansj@hi-line.net>  --  http://www.hi-line.net/~evansj/

Any sufficiently advanced technology is indistinguishable from magic.
  -- Arthur C. Clarke


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST