A syntax oddity 3000

R

r

-------------------------------------
A C language odditty 3000 (contents)
-------------------------------------
1. The Dawn of C (skipped)
2. The Luncy of C's syntax
3. Jupiter Mission, C in the 21st centry
4. Elegance and Beyond the Infinite


void warning {
If you worship the C/++ language(s) religiously and think it is the
perfect language "as is" {then stop reading immediately because you
may get offended! }

else {if you like the C/++ languages and think it could use some
improvements {then read on my brother! For we shall bring the archaic
C into the 21st century with much glory! -- kicking and screaming if
necessary ;-)}
}

---------------------------
2.The Luncy of C's syntax
---------------------------

[ground control to major tom]
Of the many asinine redundancies within the language called C, i find
the the syntax most disturbing. Observing from an outside perspective,
it seems that spoon feeding the compiler is more important than
readability of source code! And i cannot completely understand the
logic(or lack there of) behind this design choice.

Specifically i am referring to the redundant use of braces over
indention and the redundant declaring of variable types. Both of which
have a much more elegant solution that put the burden on your compiler
and in turn makes for much more readable code!



//-- Braces --\\

First lets talk about braces. Braces are as ugly on people as they
are in source code(just ask Ugly Betty!).

When you litter source with braces the eye has a hard time reading
the actual code. And besides, do you know anyone that writes C code
without also using indention? Well there may be a few sadomasochist
out there but i would think the vast majority uses indention even
though the language does not force it!

So, if clearly many many people see the advantage of indention over
braces, why has the language not dropped the redundant braces and
forced all to use indention to denote a block?

And why would any programmer do that which is not forced upon them?
Well because they get a good return value from such efforts --
readable code!

Ok!, Ok! for backward compatability and S&M practictioners reasons we
could do...

#include indention


//-- Variables --\\

Secondly the asinine declaration of variable types is nothing more
than a way to quickly muddy up even the most simple of code! Integers,
strings, floats, and Constants can be "typed" by the compiler, no need
to declare them. You may ask yourself...?

"""How on Gods green earth can a stupid compiler determine what a
variable type is without me declaring it first"""

....easy, you handle this at the syntactic level!

-Strings: are any repetition of any chars delimited by "
-Integers: are any repetitions of chars in the set {0123456789} and
are NOT delimited by " or '
-Floats: are in the set {integer} and have a single <period> char in
them AND are NOT delimited by " or '
-Constants: use all caps (VALUE = 10)


//-- Tribal Warfare --\\

Another problem with free form languages is this constant warring of
which free form paradigm should be followed (yes, i'll bet none of you
have experienced this before *sarcasm*)

In a "free form" language such as C you get so many personal opinions
on how braces should be styled...

Cprogrammer1: Braces should go here!
Cprogrammer2: No! they should go there!
Cprogrammer3: No! your both wrong!

Lets put an end to the madness once and for all. Force indentation or
at least give the programmer a choice between archaic redundancies and
elegant beauty.

Some say coding style and clean syntax is an art, i say it is a
necessity. Why you ask? Well so everyone can clearly and quickly
understand everyone else's code. Currently you C programmers are like
poor old major tom, just floating aroung in a tin can, your syntax has
left you blue, and you just don't know what to do?! but your circuit's
dead, there's something wrong, can you hear me major tom?


---------------------------------------
Jupiter Mission, C in the 21st centry
---------------------------------------
Here are three version of a very simple function. You decide which is
easier on the eye.

// el feo!
static void* function( obj)
{
newobj = convert(obj);
if (obj && newobj)
{
DECREF(newobj);
return obj;
} else {
if (newobj) {
DECREF(newobj);
}
ErrorClear();
return 0;
}
}
}


// el malo!
static void* function( obj) {
newobj = convert(obj);
if (obj && newobj) {
DECREF(newobj);
return obj;}
else {
if (newobj) {
DECREF(newobj);}
ErrorClear();
return 0;
}


#using indention
#using clear_syntax
#using your_brain_and_not_your_back!

// el muy bueno!
def function(obj)
newobj = convert(obj)
if obj and newobj
DECREF(newobj)
return obj
elif newobj
DECREF(newobj)


----------------------------------------
Syntax Elegance and Beyond Infinity
----------------------------------------

And now with the chains of redundancy broken a new evolutionary path
has been laid before your eyes. You are reborn as the starchild.
Master of your coding universe!

....This is Major tom to Ground Control
....I'm doing so much more!
....because I'm writing code in a most intelligent way-ah
....And the code looks very elegant tody-ah-ah!

The black monolith of evolutions next step is before you. Will you be
intelligent enough to use the knowledge contained within, or run away
with tail tucked, you be be the judge...?
 
B

Balog Pal

r said:
-------------------------------------
A C language odditty 3000 (contents)
-------------------------------------
1. The Dawn of C (skipped)
2. The Luncy of C's syntax
3. Jupiter Mission, C in the 21st centry
4. Elegance and Beyond the Infinite
....

Wow, someone has too much time to waste here.
C/C++ has a zillion problems practicioners know well (or poorly), the few
you picked are noted but does not make in the first ~250. Btw the
type-related real-life problems are finely addressed in C++0x introducing
auto.

What I don't get -- the urge to transform every language to something else.
You have Python, it has the stuff you want, use that.
 
R

r

"r" <[email protected]>> ------------------------------------- (snip)
What I don't get -- the urge to transform every language to something else.
You have Python, it has the stuff you want, use that.

True, python did forge the revolutionary path to simplistic
syntactical elegance and exceptionally clean coding style. Of which i
base my post on the great values of that language. However, changing
the syntax and coding style of a language does not change the actual
language in any negative ways, quite the contrary! C/++ will perform
exactly as before EXCEPT with out all the crufty syntaxes and spurious
stylings!

Ok!, Ok!, the syntax changes might add ~0.00001% increase to compile
time, but i can manage to wait that long, can you

;-)
 
K

Krice

When you litter source with braces the eye has a hard time reading
the actual code.

You have. Pretty good trolling, only if you knew what you were
talking about, but you have no clue.
 
B

Bo Persson

r said:
True, python did forge the revolutionary path to simplistic
syntactical elegance and exceptionally clean coding style. Of which
i base my post on the great values of that language. However,
changing the syntax and coding style of a language does not change
the actual language in any negative ways, quite the contrary! C/++
will perform exactly as before EXCEPT with out all the crufty
syntaxes and spurious stylings!

There is the slight problem of all exisiting code, which might not
follow the new syntax rule. Some people might even have used different
width settings for the tab character.

How would you handle that?


Bo Persson
 
R

r

There is the slight problem of all exisiting code, which might not
follow the new syntax rule. Some people might even have used different
width settings for the tab character.

How would you handle that?

Simple, you can use any indention you like (\s*n) as long as you stay
consistent. Indention is the only system that allows both personal
freedom and community reponsability at the same time!

Certain freedoms should be allowed (like indent width) certain
freedoms should not (free form gibberish code). Freedom is good.
Unbridled freedom is Bad!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top