Python-like tabs instead of curley brackets?
Daniel Keep
daniel.keep.lists at gmail.com
Fri Oct 27 11:32:08 PDT 2006
Charles Fox wrote:
> I've been following D for a few years now, and I'd like to suggest ditching
> the (now completely redundant) curley brackets from the C-like syntax and
> borrowing Python's use of tabs to replace them. I see no reason to keep the
> curley brackets now we have nice editors that know about (and can display) tab
> characters. The ideal programming language should have no redundancy, you
> shouldn't have to say anything twice, and at present we are still repearting
> ourselves with both curley brackets and indentation! What do you think?
/delurk
/2cents
Curly-bracket languages are a pain because you end up with all those
redundant braces and parenthesis all over the place, when we all know
they're not *really* needed!
Offside-rule languages are a pain because any nested structure can't be
expressed inline, and you can end up with painful, subtle bugs, not to
mention lots of things play silly-buggers with whitespace since it's
"not important"!
Six of one, half a dozen of the other. Offside rule works for Python
because that's what it was designed with. C-style works for D because
that's what it was designed with.
Another interesting thing is Lua code: it doesn't require you to use an
explicit statement separator; it's smart enough to "know" where
statements start and end. And yet the majority of Lua code I've seen
uses those redundant semicolons and parenthesis. Why? Not really sure;
could be they're either so C-style brain-damaged they can't code without
compulsively hitting those keys (must... insert... delimiters...), or
they just like the additional explicitness.
I suppose in the end, it's all a matter of taste. D programmers seem to
like curly braces. It's as good a reason as any other :) If you want
to see what a language with little to no redundancy looks like, go take
a peek at APL. You may want to take a box of headache tablets with you...
-- Daniel
P.S. Also, I would suggest you go check out Nemerle:
<http://nemerle.org/Main_Page> - it's got both a C-style parser and a
Python-style parser. It's a very cool language, irrespective :P
P.P.S. You use TABs for Python code? What blasphemy! Everyone knows
that *FOUR SPACES* is superior to those pathetic tab characters! :3
--
Unlike Knuth, I have neither proven or tried the above; it may not even
make sense.
v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
More information about the Digitalmars-d
mailing list