Re: 3 Questions

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 01/31/01


On Wed, 31 Jan 2001, George Greer wrote:

> See line 2684 of db.c

Making a new scope, of course, is still possible.  It would still be nice
not to have to explicitly create the scope.  But then, I've always thought
that switch was kind of broken, anyway.  Instead of defaulting to
fall-through:

  switch (cond) {
  case val1:
    . . .;
    goto case val2; /* goto val2 case label */
  case val2:
    . . .;
    /* doesn't fall-through. */
  default:
    . . .;
  }

always seemed a touch better to me.  But language design is a fringe
topic.  (And, yes, that's the dreaded 'goto' statement.)

> I'd say that much state would usually be in a struct already.

This would service, but I don't think it's the best approach.  Structs let
you deal with data in an instance of the struct.  This is good if you have
operations on the state of several instances.  Where the state is specific
to a set of functions and you don't need several instances, it'd be more
direct to be able to wrap the state with the functions.


-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST