Thread overview | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 27, 2006 Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
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? |
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | Charles Fox skrev:
> 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?
Absolutely not!
Keep the brackets. Even making them mandatory for single statement if, is a better idea then removing them.
// Fredrik Olsson
|
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | 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?
I think it would be a big mistake, and quite possibly enough to turn me away from D despite the years I have put into it as a user. Doing this, we would sacrifice expressiveness, source portability, useful niche features such as anonymous scopes, and enter the world of ambiguous nesting levels. Python and D are two different galaxies. Python is not a systems language (technically, its interprative, and doesn't provide any low-level functionality that I recall). Scope-by-indentation is a good choice in that case, where the speed and blindness of parsing are paramount. It would be a massacre for D.
-- Chris Nicholson-Sauls
|
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | To be honest that's a really scary thought. I think the idea of whitespace having any syntactic meaning is bad. In any kind of language (in "real" languages like english whitespaces don't have any meaning either). I'd rather type those redundant braces over and over again - and keep the option of formatting the code how I think it's best for that particular piece of code. Sorry, but if Walter does that I'll delete my dmd folder immediatly, defragment my hard drive, redirect digitalmars.com to 127.0.0.1, make some self-hypnosis tapes with the text "There is no such thing as the D programming language" and listen to those tapes all night long :) Seriously, I would immediatly stop using D. Am 27.10.2006, 14:15 Uhr, schrieb Charles Fox <charles@SPAMMENOT.robots.ox.ac.uk>: > 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? -- Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/ |
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mike | > To be honest that's a really scary thought. I think the idea of whitespace having any syntactic meaning is bad. In any kind of language (in "real" Do you know the Whitespace Programming Language ? http://compsoc.dur.ac.uk/whitespace/index.php :-) |
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to mc | Yes :) I found it once via http://99-bottles-of-beer.net/language-whitespace-154.html Am 27.10.2006, 16:04 Uhr, schrieb mc <mco333@sympatico.ca>: >> To be honest that's a really scary thought. I think the idea of whitespace having any syntactic meaning is bad. In any kind of language (in "real" > > Do you know the Whitespace Programming Language ? > > http://compsoc.dur.ac.uk/whitespace/index.php > > :-) > -- Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/ |
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | 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?
This would destroy anonymous delegates, one of the best new features of D.
If this concerns you a lot, write a converter to read your source and add the brackets!
-DavidM
|
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | 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?
Yuck. That's one of the things that turns me off about Python. I would hate to see that in D.
|
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | 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? Honestly, I don't think this is a good idea. Linguistic ideals like this make wonderful goals for language development, but should be viewed as just that. Ultimately, *good* language comes from a blend of ideal and non-ideal parts that yield the overall character of the language. A good example of how redundancy can be healthy, is how spoken languages work. English, happens to be a wonderfully expressive language since it is jam-packed with redundancy. You don't get this effect with languages that are less hap-hazard in their design, even if they are easier to learn. But note that there aren't any perfectly redundant words, expressions or idioms in any langauge. Each one comes with a different history, usage and (obviously) alliteration or cadence. I think it's these subtle differences that are important, as they give additional weight and meaning to what would otherwise be just a redundant collection words. So how does this apply to programming languages? We spend the overwhelming majority of our time 'developing' software, through trying to understand it. A good chunk of that is reading our own, and other's works. You need all the clues you can get: comments, good function names and a style that takes advantage of the variability of the programming language itself. A less idiosyncratic grammar might help cut down the time spent understanding code. But, I can tell you from my own experience in hacking Trac code (python): it doesn't. Instead, with something like Python, one has to somehow derive additional meaning from the code called and invoked, rather than from the additional clues that a richer grammar can give. Code like this is sane, but lacks intangible factors like cadence, depth and soul. A personal example of mine: I can tell who has maintained a piece of code based on who wrote it - no comments needed. Ultimately, this comes down to these redundant and secondary language features that have marginal impact on the code's meaning like indentation and brace style. But that kind of 'fingerprinting' is loudest and most notable in C-style langauges, especially in Javascript (it practically has TIMTOWDI as a language foundation). You don't get this effect in less expressive, and less redundant grammars like Basic or Assembler. So there's a poetic component, if you will, that is lost when you root out such 'unneccesary' components. Again, this folds into any effort to the research and understanding phase of development. To invoke the old idiom "if it ain't broken, don't fix it." C-style syntax and character has been borrowed and used in countless other languages. Other language have lived, and died, after C was created and long before the present. Surely there's something to be said for how well it's syntax works? -- - EricAnderton at yahoo |
October 27, 2006 Re: Python-like tabs instead of curley brackets? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Charles Fox | 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/ |
Copyright © 1999-2021 by the D Language Foundation