Quote:Original post by Prefect
Quote:Original post by Eelco I want to write my code while its tree structure is rigidly enforced, thats all.
|
Bad idea. One of the things I remember from my programming language theory class is that there have been experiments with source code editors that rigidly enforce the structure of a program, and those experiments all failed because of horrible usability problems. Programmers just don't think that way.
Unfortunately I don't have a link handy to any of that research as that class was a long time ago. Still, if you are hell-bent on trying something like that anyway, maybe you can try to find that research and see if they made some mistake. Learn from history and all that.
Personally, I find it much more plausible that enforcing the structure really is just a bad idea. When you reorganize the structure of code you really want as much freedom as you can get, which includes transitioning through illegal states. |
Maybe you are right; I realize it would take a lot of getting used to. But I cannot think of any fundamentally compelling reason to recycle the closing bracket of a for loop I want to delete as the closing bracket of the function I was writing, even though thats what I might end up doing when allowed to.
As for simple expressions of the form x+y<(z+2)/3, they should definitely be freeform-typable; doing all that in an expression-tree editor would be madness; I have my equation-editing skillpoints maxed out, and its still a pain in the ass. Although being able to right-click such an expression and edit it in an expression-tree editor can be useful in some situations where you dont want to make your eyes bleed making sure all brackets are placed correctly.
But the coarse structure of your code; the class definitions, function definitions, loops, scopes; I really cant think of any good reason to have complete freedom there. Dont you hate it when you forgot one closing bracket somewhere; and thats all your compiler is able to tell you, usually indirectly by means of some end-of-file error?
I prefer C-style scope delimiting over BASIC because I hate writing more characters than necessary. On the other hand, I also hate ten consequtive closing brackets; 'Next i' may be a lot more typing, but what if that comes for free, with the identifier automatically updated, after merely typing 'for i', with the option to add break-conditions at the top AND bottom of your loop body, and the increment action at a default i++, in a logical place (besides your loop body), and being editable into a multiline statement? And who knows what other optional features hidden behind a mouseclick that will not tarnish the clarity of a simple loop but do increase my expressiveness?
Id say that improves both the clarity of my code AND my productivity. But I realize I might be wrong about the latter. Do you have any keywords to look up the research you mentioned?