What's C's biggest mistake?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Nov 8 20:07:47 PST 2012


On Thu, Nov 08, 2012 at 10:47:10PM -0500, Nick Sabalausky wrote:
> On Thu, 08 Nov 2012 21:04:06 +0100
> "Kagamin" <spam at here.lot> wrote:
> 
> > Well, in the same vein one could argue that write(a,b) looks as 
> > if first function is called then arguments are computed and 
> > passed so the call should be written (a,b)write instead. The 
> > language has not only syntax, but also semantics.

In that case, we should just switch wholesale to reverse Polish
notation, and get rid of parenthesis completely. Why write hard-to-read
expressions like a+2*(b-c) when you can write a 2 b c - * +? Then
function calls would fit right in:

	1 5 sqrt + 2 / GoldenRatio == assert;

Even constructs like if statements would be considerably simplified:

	i 10 < if i++ else i--;

Things like function composition would actually make sense, as opposed
to the reversed order of writing things that mathematicians have imposed
upon us. Instead of f(g(x)) which makes no sense in terms of ordering,
we'd have x g f, which shows exactly in what order things are evaluated.

;-)


> Actually, that's one of the reasons I prefer UFCS function chaining
> over nested calls.

Fortunately for me, I got used to UFCS-style function chaining when
learning jQuery. (Yes, Javascript actually proved beneficial in that
case, shockingly enough.)


T

-- 
Prosperity breeds contempt, and poverty breeds consent. -- Suck.com


More information about the Digitalmars-d mailing list