3 ms·
What you mean by the OOP side of things? I find superlong indented blocks in Python a bit awkward, although can't explain why. When I look at a long class defi
by mojuba 18y ago
What you mean by the OOP side of things?
I find superlong indented blocks in Python a bit awkward, although can't explain why. When I look at a long class definition, for example, it just begs to be closed with end or "}". Small blocks though look definitely better without the block braces.
I'm thinking about introducing an optional end and leaving it to the taste of a programmer. Not sure yet.
- ErrantX 18y agoThat's quite a good idea. My point with braces is that you dont have to indent the code then - which is dangerous :) I have inherited a couple of PHP and C projects that have taken weeks just to indent to be readable - before i can even begin to work on them! (admittedly that is more of a PHP problem). Forced indentation makes definite that everything is obvious: addign curly braces is purely asthetic IMO :D
- davidw 18y ago(defun indent-buffer () "Indent entire buffer" (interactive) (indent-region (point-min) (point-max) nil))
- bkudria 18y agoAmen.
- queensnake 18y agoThe Unix 'indent' command has come a long way in the last few years, too.
- potatolicious 18y agoI don't think it's the job of the programming language to enforce style. Proper code style should always be used, but should not be forced upon the coder, and that's my major objection to Python syntax.
- ljlolel 18y agoI don't think it's the job of human beings to enforce style. Proper code style should always be used automatically, but should not force the coder to waste a second thinking about it. The coder should think purely about the logic of the program, and that's my major objection to C.
- anthonyb 18y agoSo proper code style should be forced on the maintainer instead?
- llimllib 18y agoPython already has an optional end: def something: alpha() omega() #end I think introducing it as a special case, with no semantic value, into your parser would be an extremely poor idea.
- mojuba 18y agoTrue, except #end doesn't verify you are at the correct level of indentation. This, instead, would be more appropriate: def something: ... end def but then it makes indentations insignificant altogether.
- llimllib 18y agoThat would indeed make it semantically valuable. I assume you'd have "end while", "end if", etc? I can't say I'm a fan, but at least you'd be making it mean something if you did that. (Also: why make it optional at that point? Seems like it should be required for simplicity's sake)
- mojuba 18y agoShell/Ruby style (if ... endif) is not even considered because I'm no fan of it either. I think it already lost the battle to both C and Python styles. It would be nice, however, to have some optional verification mechanism that allowed you to stay minimalist for as long as you wish, and to use closing tags for verification and/or aesthetical reasons - for example, when closing a superlong block.
- newt0311 18y agoWoah... Be wary of that attitude for there lies the path to C++ hell. Like people say, the path to hell is paved with good intentions.