News for hackers. Stuff that matters.
Re:C23 is finished: Here is what is on the menu by j-krieger on Friday August 05, 2022 @05:38AM (#32353723)
Namespaces can enforce good project structure. If you're using A::B::C and A::B::D you can be 100% that both C and D definitely live under B, and your editor can work with that as well.
Re:C23 is finished: Here is what is on the menu by jstimpfle on Friday August 05, 2022 @05:52AM (#32353841)
> you can be 100% that both C and D definitely live under B

And that brings you what benefit exactly? I've seen a number of projects that are preoccupied about "proper nesting", while it is 99% bureaucratics and all those projects are still a mess.

The benefits of "living under this or that" are technically zero, and with respect to human factors are minimal given that 1) you can get most of the organizational benefits of namespaces by doing A_B_C, and 2) you can also add new members to proper namespaces from external files in most languages, including C++, so there really isn't a difference w.r.t "knowing for sure".

Re:C23 is finished: Here is what is on the menu by j-krieger on Saturday August 06, 2022 @03:22AM (#32365802)
The benefit is a nice mental model of where what function lives (if you don‘t overdo it). This type of packaging also lends itself to module systems, a thing I desperately wish for in C
Re:C23 is finished: Here is what is on the menu by jstimpfle on Saturday August 06, 2022 @08:57AM (#32367680)
This type of "packaging" is completely orthogonal to module systems. It's merely a syntactic discipline that adds one more complication to deal with even where it has zero benefit.

You could say that the C/C++ systems already has "modules" if you look at object files and header files. Of course, they are a limited kind of modules because they are a bit low-level and C has the preprocessor problem, making it slow to "import" modules. But none of that has to do with namespaces.

Re:C23 is finished: Here is what is on the menu by astrange on Friday August 05, 2022 @03:17PM (#32360677)
Well, they enforce having a lot of project structure. Java and C# use their namespaces to ensure that everything useful is under five layers of pointless names like System.Collections.com.net.org.ArrayList.

I think not having namespaces may be an effective way to prevent enterprise programming from happening.

Re:C23 is finished: Here is what is on the menu by j-krieger on Saturday August 06, 2022 @03:21AM (#32365794)
Yea, I‘ve got to be honest in that I don‘t understand Java or C# hierarchies.

Node.js and Rust do module systems just fine.