Re:C/C++ Pointer Declaration Syntax – It makes sense
by eru on Tuesday February 21, 2012 @10:02AM
(#3616660)
You can probably hack together a nice language around C. Sort of like CoffeeScript around JavaScript. While you are at it, might as well throw the option of significant indentation into it---like in Haskell, but not mandantory like in Python.
Re:C/C++ Pointer Declaration Syntax – It makes sense
by groovy2shoes on Tuesday February 21, 2012 @10:09AM
(#3616690)
> You can probably hack together a nice language around C.
That's been done at least twice already -- for some (very debatable) values of 'nice'. See C++ and Objective-C.
Functions could be declared in simpler ways:
C doesn't do currying by default, so I don't really care wether the return type goes before or after the arguments. But the name of the function should definitely be on the right of its own type, so we still follow the golden rule. Function definition would be equally simple: Note the similarity with Now you want a pointer to a function? Easy: you just prefix (or postfix, depending on your ultimate choice) the type with a star: Structure (and class) declaration could also use a bit of makup: There, the syntax of types is much nicer, and easier to parse (it doesn't really matter for C, but C++ could really use some love).Also worthy of mention is, this syntax above is less restricted than the ANSI one. However, the semantic restrictions still hold. This declaration for instance would be syntactically valid, but semantically bogus:
It could work if C were ducked typed. :-)