Forward declarations in function prototypes, yet again

Peter S. Shenkin uunet!avogadro.barnard.columbia.edu!shenkin
Fri Jul 17 09:14:16 PDT 1992


Richard Stallman writes:
> Creating a special case in which an expression can use a variable
> before its declaration is not forbidden, because there is no one to
> forbid it.  But it is inconsistent with a basic design principle of
> the langauge.  Such inconsistency is bad design.

Design that requires the programmer to employ extra and unwieldy syntax
-- such as the double-semicolon notation which rms admitted to liking --
to express an idea that any idjit can understand without it is bad
design. (*See below.) 

It sure as hell is going to be easier for ANY programmer to remember what 
the following declaration means:

	function( float a[n], int n );

than it will be for him to remember any syntax yet proposed that preserves
the precious "declare before use" rule. And if "declare before use" is
not going to help you remember the syntax, what use does it serve in
this context?

I have no quarrel with "declare before use" on philosophical grounds.  I 
even like it.  If there were any way to both preserve it and maintain a 
simple syntax for this new language feature, I'd be all for it.  But none 
of the smart folks out there has been able to devise a syntax even NEARLY 
as simple as the above that both preserves the rule and expresses the 
very simple new idea we're trying to intoduce into the language.

I believe that rms's argument, as excerpted at the top, is entirely 
philosophical/aethetic.  And I'm not against either Truth or Beauty.  
I even like them, in moderation. But when one must make an unfortunate 
choice between elegance and ease of use, I'll pick ease of use any day.  
C is full of features that bear evidence of this same point of view.

Finally, rms's original arguments against this simple syntax, some months 
back, were based not on the philosophical point we seem to be debating now,
but rather on the difficulty of implementing it in the context of gcc's 
parsing scheme.  I am not unsympathetic to this view either;  C also 
bears some evidence of the language designers having once chosen ease of 
implementation over Truth, Beauty and even Usability.  Such implementation 
difficulties are unfortunate.  But again, I think that overcoming them
will result in a far more USABLE implementation of this language feature.
I think I'd hold this view even if I were a compiler writer.

	-P.

*Please don't misunderstand me -- I'm not trying to call anyone an idiot.
 I'm just pointing out that this notation is unambiguous to everyone,
 even those who oppose it, and, I expect, even those who have never seen
 it before -- far more so than the alternatives that preserve "declare
 before use."
************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb*************************
Peter S. Shenkin, Department of Chemistry, Barnard College, New York, NY 10027
(212)854-1418    shenkinaavogadro.barnard.columbia.edu   shenkinacunixf.BITNET
******************** The singular of "media" is "medium". ********************




More information about the Numeric-interest mailing list