Liste des Groupes | Revenir à cl c |
On 03/12/2024 19:42, Bart wrote:
code the reading is important order people to.It really /does/ matter - regardless of what the language allows or does not allow.>
Why?
Or, if you prefer,
Order is important to people reading the code.
The compiler spends milliseconds reading the code. Programmers spend hours, days, or more reading the code. It's not particularly important if the language requires a particular order or not, except in how it helps or hinders the programmer in their order of the code.You've lost me.
And it is certainly the case that different programmers will prefer different ways to order and arrange their code - but that does not stop it being important. When you write code, write it for human readers - otherAnd here I've lost track of what this particular complaint about me is about. But it looks like it would apply to the majority of the world's programmers.
I've already made it clear what I think is wrong about your solution - the jumbling of namespaces. (And /please/ don't harp on about C's system again - the fact that C does not have a good way of handling namespaces does not suddenly make /your/ version good.)It's used to avoid cluttering code with ugly xxx:: qualifiers, and save some typing at the same time. That's pretty much it.
All it does is allow you to write F() instead of A.F(). You can do the same thing in C++ (there it saves you writing A::), by doing this (AIUI):(You mean "using namespace A;". It's no problem that you don't know the right syntax for C++, but I'm correcting it in case you want to try anything on godbolt.org.)
>
using A;
Yes, C++ /allows/ you to do that - if you explicitly choose to do so for a particular namespace. Thus if you are going to use identifiers from a namespace often, and you are confident it will not lead to conflicts, then you can do so. C++ "using namespace A;" is commonly used in a few circumstances:
Having every module in a program automatically pull in every exported identifier from every other module in the program is not structured or modular programming - it is anarchy.In the 'subprogram'. The structure is there.
You get an error if you try to use "F", as it is ambiguous.Same here.
(Defining a new local function F is also an error even if F is never called.)That I don't do, as it is the typical and expected behaviour when you have shadowing of names in an outer scope; generally it is not reported.
This crashes. This program is impossible to write in my language when both modules are part of the program.I'm sorry, I thought you meant if a sane C programmer wrote good code but accidentally had conflicting types. C is not as tolerant of idiots as some languages.
So it's a lot more fool-proof.
If you are a fool, you should probably avoid programming entirely.Fuck you. Obviously you're going to shoot down whatever I say, trash whatever I have achieved, because .... I've really no idea.
Languages and tools should try to be accident-proof, not fool-proof.And yet my product IS fool-proof. So again, fuck you.
Les messages affichés proviennent d'usenet.