🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2588

Re: Complexity of syntax

#2588
From: Dan Bernstein
Date: Sat, 05 Jan 1991 02:21
60 lines
2669 bytes
In article <1991Jan4.152846.15917@maths.nott.ac.uk> anw@maths.nott.ac.uk (Dr A. N. Walker) writes:
> In article <18747:Jan220:02:1091@kramden.acf.nyu.edu>
> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
> >Huh? Who cares? To get an unnamed function you just have to declare the
> >function and not use its name. The fact that you can't write an unnamed
> >function is not a problem for programmers.
> 	Well, it *is* a problem.  You have to invent a name.

Every coding stylebook I've seen recommends that you give names to
everything. It's a very good idea, you know.

> but having programs
> liberally bespattered with f1, f2, f3, ..., f17, ..., f923, ... really
> isn't very pretty.

Which is why you choose more meaningful names. Like fxpc, a function
that adds c to x.

> What's more, in many languages, including C and
> Pascal, the declarations of f1 and its friends cannot usually be put
> close to their uses,

Huh?

  #define FXPC \
  double fxpc(x) double x \
  { return x + c; }

  z = 2 * sin(theta) * integral(fxpc, 0, pi) + ...;

Then just dump FXPC at the end of the program, and of course an fxpc
declaration in a header file. That looks pretty close to me, and I find
it more readable than these ludicrous attempts to put everything on one
line.

> but why *not* allow
> 	z = 2 * sin (theta) * integral ((float x)(blah), 0, pi) + ...;

Who cares? How about because it's a pain to parse, compile, and read?

  [ syntax versus semantics ]
> For
> example, is the restriction that you can't declare the same identifier
> twice in the same declaration syntactic or semantic?

Syntax. It has no effect on semantics.

> Are the C
> pointer/array relationships syntax or semantics?

Depends which one you're talking about. The fact that the evaluation of
x[n] is defined as the evaluation of *((x) + (n)) is syntax.

> 	Secondly, the syntax seriously influences the "software
> engineering" quality of a language.

I agree that syntax is an extremely important part of a language. That's
why I'm spending a lot of time on Q's syntax.

---Dan
Technical Details
Message-ID: <11883:Jan502:21:0191@kramden.acf.nyu.edu>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!emory!gatech!mcnc!uvaarpa!haven!adm!cmcl2!kramden.acf.nyu.edu!brnstnd
References: <1990Dec29.101233.1894@mathrt0.math.chalmers.se> <18747:Jan220:02:1091@kramden.acf.nyu.edu> <1991Jan4.152846.15917@maths.nott.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!emory!gatech!mcnc!uvaarpa!haven!adm!cmcl2!kramden.acf.nyu.edu!brnstnd
From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
Newsgroups: comp.lang.misc
Subject: Re: Complexity of syntax
Message-ID: <11883:Jan502:21:0191@kramden.acf.nyu.edu>
Date: 5 Jan 91 02:21:01 GMT
References: <1990Dec29.101233.1894@mathrt0.math.chalmers.se> <18747:Jan220:02:1091@kramden.acf.nyu.edu> <1991Jan4.152846.15917@maths.nott.ac.uk>
Organization: IR
Lines: 60