h a l f b a k e r yProfessional croissant on closed course. Do not attempt.
add, search, annotate, link, view, overview, recent, by name, random
news, help, about, links, report a problem
browse anonymously,
or get an account
and write.
register,
|
|
|
In programming, typing mathematical formulas can be a nuisance because of all of the parentheses. How do you keep track of them all?
Also, some programming languages, such as C and Lisp, are practically parentheses-based! (Well, in C, actually it's braces, but it's the same principle.)
What
would be good is a compiler that would show little numbers or something above parentheses to keep track of the levels. Or different colours for the text within. Or do away with parentheses altogether, instead saying "Level 1", "Level 2", etc.
As for indentation to keep track of levels, in theory it might be great, but in practice it royally sucks, because your lines are all shoved over to the right, and the lines have to be really short to fit on the screen!
PT ~bz
[bristolz,
Nov 11 2005, last modified Feb 05 2006]
Maybe something like this?
http://www.sloth.or...offeg/highlight.png [egnor, Jul 01 2002, last modified Oct 04 2004]
Or this.
http://crimsoneditor.com/ [angel, Nov 11 2005]
Please log in.
If you're not logged in,
you can see what this page
looks like, but you will
not be able to add anything.
Annotation:
|
|
How about an end of line "balancing bullet", pointing left (too many closed parentheses in argument) or __ right (need more closed parentheses in argument) that must be resolved before an end of text is encountered? |
|
|
Partially baked in many editors, which automatically highlight the corresponding closing brace when the cursor is on the opening brace. |
|
|
The PythonWin environment for Python does this particularly well; I've been known to edit C code with it to get the balancing on particularly hairy macro definitions right. |
|
|
(As an aside, Python uses indentation to _explicitly_ denote scope: no scoping braces or begin/end statements. Seems odd to begin with but feels very natural very quickly...) |
|
|
Well, I have seen math engines which track parenthesis pairs by color. One that I've seen will even show the innermost not-yet-closed parenthesis in boldface. |
|
|
As for text editors for programming languages, there are thousands (possibly millions) of those available that do various forms of context highlighting. One of those might already do something functionally equivalent to subscripting the opening and closing {braces|brackets|parentheses|angles}. If not, it shouldn't be too big of a leap to include such a feature. |
|
|
By the way, I feel your pain when it comes to indentation eating up your real estate. I usually indent only 2 or at most 3 spaces, and then only inside the braces (not a level for the braces and another for the contents, as some do). But I still see 1/3 to 1/2 of each line get wasted on white space. I like hard copy backups so I avoid lines over 80 characters wide. |
|
|
I wanted something similar to this for html braces (see Nested Tages HTML Editor) and am trying to persuade Mark, the author of Araneae (a HTML editor - see araneae.com) to include this in his next release. Since he's still accepting feature requests for version 5 you may want to suggest parenthesis tracking too. |
|
|
Syntax error line 324: Expected ")" |
|
|
I was just thinking about this very topic for C-based programming languages that use brackets. How about automatic closing bracket insertion, combined with highlighting? |
|
|
I like the idea of the Level 1... etc. and the "Nested Tags..." idea and was thinking: how about having levels be arbitrarily named by the user as a word label or even a symbol and then ended with a semicolon; as usual. [EXAMPLE: Level n;] After the initial labelling, something like a /level n; is inserted automatically and you just program in between. It would be more intuitive than mere brackets, and maybe the compiler could automatically transform this back to ordinary nested bracket code for the sake of space. Highlighting could be incorporated. |
|
|
When I learnt to program C, we were taught to type the opening brace, then the closing brace, and then fill in the stuff inbetween. This stops any annoying problems with forgetting to close your braces. |
|
|
Ugh. Practicality raises its ugly head yet again. |
|
|
[pottedstu]: That's the way I do it too;, also for constructions that require a closing 'tag', whether VB, HTML, or whatever. |
|
|
Something MS Visual Studio .NET should do in addition to showing squigleys(sp?) |
|
|
I would like to see indicators in the status bar (like the OVR, TRK, CAP, REC things in a word processor) -- but these would say "FOR" "WITH" "IF", etc. to remind you what clauses you're in the middle of. |
|
|
I too have adopted the "Shift-9-0-leftarrow" method of parentheses within my code. It's become so automatic that I don't even think about it anymore. |
|
|
Cheers for bristolz tractor! |
|
| |