Time |
Nick |
Message |
02:38 |
|
SFENCE joined #luanti-dev |
04:00 |
|
MTDiscord joined #luanti-dev |
04:10 |
|
SFENCE joined #luanti-dev |
04:36 |
|
fanshen joined #luanti-dev |
05:23 |
|
YuGiOhJCJ joined #luanti-dev |
08:21 |
|
PtiLuky joined #luanti-dev |
11:44 |
|
SpaceManiac joined #luanti-dev |
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 |
<herowl> PtiLuky: the f32 one in particular is just using irr::f32; |
13:08 |
MTDiscord |
<herowl> You can import a type like that if you're not renaming it. |
13:18 |
|
sugarbeet joined #luanti-dev |
14:04 |
|
turtleman joined #luanti-dev |
14:19 |
|
pmp-p_ joined #luanti-dev |
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 |
<the4spaceconstants2181> that is/should be a deprecated namespace |
14:47 |
MTDiscord |
<luatic> 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. |
15:44 |
|
SFENCE joined #luanti-dev |
16:12 |
|
SFENCE joined #luanti-dev |
16:13 |
|
basxto joined #luanti-dev |
16:21 |
MTDiscord |
<luatic> #16309 |
16:21 |
ShadowBot |
https://github.com/luanti-org/luanti/issues/16309 -- Remove `irr` namespace by appgurueu |
16:22 |
|
SFENCE joined #luanti-dev |
16:30 |
|
SFENCE joined #luanti-dev |
16:49 |
|
SFENCE joined #luanti-dev |
16:56 |
|
SFENCE joined #luanti-dev |
17:13 |
|
SFENCE joined #luanti-dev |
17:27 |
|
SFENCE joined #luanti-dev |
18:02 |
|
SFENCE joined #luanti-dev |
18:07 |
|
SFENCE joined #luanti-dev |
18:15 |
|
SFENCE joined #luanti-dev |
18:23 |
|
SFENCE joined #luanti-dev |
18:30 |
|
SFENCE joined #luanti-dev |
18:46 |
|
PtiLuky joined #luanti-dev |
19:27 |
|
SFENCE joined #luanti-dev |
20:26 |
|
turtleman joined #luanti-dev |
22:34 |
|
panwolfram joined #luanti-dev |
23:05 |
|
Eragon joined #luanti-dev |