Re: Languages

From: Daniel A. Koepke (dkoepke@california.com)
Date: 03/10/99


Christian Loth wrote:
>
> Yes, but as far as I understood George's initial criticism that
> this is exactly what he criticized...you need to open a new block
> {} for that.

Not to rub it in -- but regardless of George's initial criticism the
information, or at least the example, you gave was incorrect.  The
overhead concerns are moot.  You said something along the lines that
in C you'd have to declare all the variables at the top, and there's
certain situations in functions where you'd never need them.  Thus
adding overhead.  But any such conditional use of a variable would
involve a control flow statement (e.g., if) and, hence, the opening
of a new block (potentially).

Opening arbitrary scopes is possible, too, albeit pretty ugly, IMHO.

> Readability...wasn't that exactly the point?

I consider the placement of variables in a non-uniform place highly
unreadable.  The claim that having the variable declared right before
you use it helps you find it has never made sense to me.  Variables
sandwiched between code have always been harder to find for me.

I'm also a fan of allowing variable declarations as the left-most
parameter to for(), since iterators shouldn't always have to live
outside the scope of the loop.  I think this is the only situation
where, "place the variable right where it first comes into use," is
acceptable and contributes to readability.  But that's my opinion.

-dak


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



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