Time Nick Message 11:54 PtiLuky Hi guys, was the "do not use 'using namespace' in any header file" already discussed? It is a quite important good practice that is not respected in Luanti project ("using namespace irr::" is used very very often in .h). 11:54 PtiLuky Cleaning that may require quite a lot of (small and trivial) changes, and could be simplified by using aliases on each type, like "using f32 = irr::f32;". 11:54 PtiLuky Are you guys aware of that and plan to keep it or change it? 11:59 sfan5 it has not been discussed 12:12 PtiLuky Ok, so about that you can find many articles that will explain further why it's wrong to have "using namespace" in a header file, but the short version is that it will leak across every file that include the said .h, Which is exactly against the point of having a namespace in the first place. 12:12 PtiLuky It can also lead to a mess, for instance we can't have a "ILogger" class in any project that will include one of our files (starting with luanti project itself) because the "irr::" namespace elements are basically all moved to the global namespace 12:12 PtiLuky "Using namespace" is usually ok in .cpp and in local scopes (like inside a function). 12:13 PtiLuky It can be managed in smaller projects, but when a project gets bigger, the "using namespace" in .h files can really become more problematic 12:18 sfan5 well the namespace is under our control so nothing will suddenly appear and break something else. and there are no other projects including stuff from luanti, because luanti is not a library. 12:19 sfan5 so while it could be cleaned to satisfy a best practice up our development time is better spent elsewhere 12:21 PtiLuky Okay I see, sounds sensible. 12:21 PtiLuky Then let's be careful to not let other new "using namespace" be added, specially other than "irr" (for which it's kinda too late, it is already leaking to the whole project). 12:21 PtiLuky good for me then, thanks for the answer 13:07 MTDiscord PtiLuky: the f32 one in particular is just using irr::f32; 13:08 MTDiscord You can import a type like that if you're not renaming it. 14:23 rubenwardy I think we see these namespaces as pointless and want to remove them everywhere. It would definitely bad to be doing `using namespace std;` for example 14:32 PtiLuky TBH everything could be in a namespace such as "mt" so if later a part of the engine can be reused or extended in another project it's good, and everything inside the namespace can access other things without any issues. But the namespace "irr::" definitely seems useless here, yes 14:40 MTDiscord that is/should be a deprecated namespace 14:47 MTDiscord Removing the irr namespace seems like a good idea to me. I don't think it really adds anything besides verbosity at the moment, and it is not third-party controlled (like std) either. 16:21 MTDiscord #16309 16:21 ShadowBot https://github.com/luanti-org/luanti/issues/16309 -- Remove `irr` namespace by appgurueu