Open MovGP0 opened 1 year ago
Thanks, @MovGP0
Massive pull request, a lot of stuff going on here! Some stuff I'd be glad to merge, other that I don't like too much. Was this done by some kind of automated code correction?
From skipping over parts of the code, here are the things I dislike (basically my personal coding style preferences):
is not null
instead of != null
var
for basically everything. Especially on types like int
, float
and double
I like to be explicit. And for (var i = 0; ...)
instead of for (int i = 0; ...)
just doesn't feel right :-)nullable
.NET feature, but having >1k warnings about it is rather annoying. Who's gonna fix this? Enabling the feature for new projects makes sense, but not so much for old projects.I'll have a second, closer look at this PR in the next days.
The use of
is not null
instead of!= null
Those have a different meaning:
is not null
checks if the variable is null!= null
uses the overload of the !=
operator to check against null
, but it's not ensured by the runtime that this is correct. Therefore, the is not null
operator is recommended.
Using
var
for basically everything.
The use of var
is recommended because it makes refactorings easier. The type is still shown by modern IDEs, so no information is lost. Just might take some time to get used to it.
having >1k warnings about it is rather annoying
Nullability-bugs are the most common form of bugs in code. Unfortunately, the nullability issues won't get fixed without those warnings.
Therefore, the
is not null
operator is recommended.
Agree.
The use of
var
is recommended because it makes refactorings easier. The type is still shown by modern IDEs, so no information is lost. Just might take some time to get used to it.
I do use var
all the time, but not on the value types mentioned. Especially for numeric types, writing the type explicitly makes the code easier/faster to comprehend (at least for me).
I had a detailed look at all the code changes. I hope we agree, that opening such a large pull request without prior discussion is not optimal. Having coding style changes that we partly disagree on as main content, I think I'm not going to merge at this point. I'm not sure if it makes sense trying to fix these issues, but here are few more things I noticed:
Enums.cs
to Enums
subdirectory?using
without fully qualified namespace (I know it works, but I prefer writing the full namespace).internal
for classes whilst not necessary?Vertex?
in TriangleWriter.WriteElements()
).var
with struct types (default
vs default(Otri)
in many places).if (edge is null) continue;
in DcelMesh.IsConsistent()
changes semantics of the method (should return false
or throw to match previous behaviour).BoundedVoronoi
(I actually forgot it was there, so thanks for the reminder).As mentioned in my first comment, I would like to apply parts of the changes. Let me know what you think would be the best way to proceed, so that your contribution doesn't go unnoticed.
did the following cleanup:
Note: additional cleanup is required to fix all the nullable issues