Liste des Groupes | Revenir à l misc |
On 29/08/2024 13:24, David Brown wrote:<snipping for brevity>On 28/08/2024 21:27, Bart wrote:On 28/08/2024 19:48, David Brown wrote:
It's just too 'open'. The contents of foo look like they're leaking into the rest of the program. As it is, someone looking at this in the future wanting to a a new statement to 'if a:' might think it ends before the comments since that 'anewstmt' is too far from the main body.It does not /need/ delimiters.
It needs delimiters:
def foo(a, b, c) :
if a :
if b :
if c :
doThis()
end
bnewstmt
end
# comment
# comment
anewstmt
end
end
Now you know that 'if a' doesn't end at that blank line, because no 'end' has been seen for it.I have, as I have said in several posts, added a "return" to make code clearer. I probably wouldn't have added them if Python had explicit block delimiters - I rarely have a plain "return" at the end of C functions (with no return type).
So I will add a "return" at the end (with a single tab indent, in this case). If it is not the end of the function, I will sometimes use a "pass" to pull back the indent level.So you have problems too. Would you have needed 'return' if 'end's had been used in the original?
Ah, so it is better to invalidate all the work done by these million programmers so far, along with all the tools, books, courses, documentation, etc., than to say that people writing big functions might want to add an occasional comment? Yes, I can see how that makes perfect sense.Of course, being a sane software developer, I do most of my programming using editors that are suitable for software development. Most professional carpenters use hammers for their nails, rather than bashing them in with stones - it's the same thing, really.How about just fixing the ******* language? That must be better than a million programmers wasting time creating their own fixes.
>>>
And yet another, of more significance, if that after you've indented a block, it may now merge into an adjacent block that was already at that new indent. If you later need to revert that first block back to it's original position, you'd better make sure you mark that boundary.
>
So mark the boundary. Add a blank line. Put a comment line describing the steps of the function. You are making up problems for which you already have good solutions that you would be using in any programming language.
Sure. We all have opinions about all sorts of things. Some people even have /informed/ opinions, that might be relevant to other people.Having made your own language(s) gives you no more and no less right to comment about features of other languages that you like or dislike.I had my opinions even before I used my own stuff.
One thing I despised was the begin-end business in Algol60 and Pascal, which has the same nuisance as braces in C-like languages.You don't like whitespace based blocks, and you don't like explicit delimiters for blocks. Maybe you just don't like structured programming? (Not all programming languages are structured.)
I didn't like writing 'end else begin' any more than '} else {'. My stuff (and a few languages have picked up on it), uses just 'else', which also limits the placement possibilities when you have one token rather than three.Ah, it is the need to press a couple of extra keys that you despise so much?
That's great. But being interested in languages, their design, and their features does not mean having an obsession about calling their features "flaws".Your problem here is that you are obsessed with finding things that you want to see as misfeatures, design flaws, or problems in other languagesYes. I'm into language design. But I'm also interested in aspects of it that many disregard, such as microfeatures, or ease of deployment.
For someone who doesn't use programming languages much (other than perhaps your own ones), you certainly spend a lot of time complaining about them!- and then obsess about how you can find new ways to make it more difficult to "work around" them.Fortunately I don't need to work with them much. If I did, I would find the means to make them tolerable.
For every programmer involved in changing and developing the Fortran language, there are a thousand programmers who use it - whichever version of it they find best for their job. Now, it is important that these one-in-a-thousand programmers are there, improving the language. But most of us are in the 999-in-a-thousand group that /use/ the language. (In that one-in-a-thousand I am including the people who actively take part in discussions or proposals for changing the language, but not people who just moan about stuff in discussion groups.)Don't you ever just accept that a language is the way it is, and it is perfectly useable that way?Well, I used Fortran IV for a year. But presumably lots of people weren't that happy with it as we've since had Fortran 77, 90, 95, 2008, 2018 and 2023.
It's not just me!
So don't use it if you don't like it. Mushy peas are an ill-advised choice - I choose not to eat them, rather than to go to cookery groups and tell everyone how horrible they are.Or think that perhaps other people in the world know better than you do about how they want their language to work? Has it never occurred to you that the people behind a given language - such as Python - considered various alternatives and decided that making it the way they did was the best choice overall for the language they wanted?Python is full of ill-advised choices. And it's become almost as much of a monster as C++, with a million incompatible features bolted on.
I'm not surprised that mere matters of syntax have low priority.Yes, and no one takes your opinions seriously. Do you think there might be some reason for that?
>Funny, I can complain about lots of languages that I never use!
As Bjarne Stustroup said, there are two kinds of programming languages - those that people complain about, and those that no one uses.
>
Les messages affichés proviennent d'usenet.