We have a partial copy of HashSet as it existed in the .NET Framework circa 2008 or something, with the following comment:
|
================================================================================================================== |
|
MSBUILD COMMENT: |
|
|
|
Ripped off from Hashset.cs with the following changes: |
|
|
|
* class renamed |
|
* unnecessary methods and attributes if-deffed out (code retained to help windiff, but indented) |
|
* require T implements IKeyed, and accept IKeyed directly where necessary |
|
* all constructors require a comparer -- an IEqualityComparer<IKeyed> -- to avoid mistakes |
|
* change Contains to give you back the found entry, rather than a boolean |
|
* change Add so that it always adds, even if there's an entry already present with the same name. |
|
We want "replacement" semantics, like a dictionary keyed on name. |
|
* constructor that allows the collection to be read-only |
|
* implement IDictionary<string, T> |
|
* some convenience methods taking 'string' as overloads of methods taking IKeyed |
|
|
|
Other than this it is modified absolutely minimally to make it easy to diff with the originals (in the Originals folder) |
|
to verify that no errors were introduced, and make it easier to possibly pick up any future bug fixes to the original. |
|
The care taken to minimally modify this means that it is not necessary to carefully code review this complex class, |
|
nor unit test it directly. |
|
================================================================================================================== |
The rationale for this odd pattern of fragmented dead code was to diff for future updates to HashSet -- but the live copy of HashSet here has since changed so substantially that it can likely hardly be diffed at all.
As a matter of healthy cleanup, I suggest to delete all the dead code.
There have also been several improvements to HashSet since the copy was done, for perf reasons - either obvious ones or to produce better codegen. It would be nice to copy them (again, without bringing dead code) for some small perf wins. I expect this will be fairly easy to do by eyeballing them side by side.
We have a partial copy of HashSet as it existed in the .NET Framework circa 2008 or something, with the following comment:
msbuild/src/Build/Collections/RetrievableEntryHashSet/HashSet.cs
Lines 19 to 39 in 6a79376
The rationale for this odd pattern of fragmented dead code was to diff for future updates to HashSet -- but the live copy of HashSet here has since changed so substantially that it can likely hardly be diffed at all.
As a matter of healthy cleanup, I suggest to delete all the dead code.
There have also been several improvements to HashSet since the copy was done, for perf reasons - either obvious ones or to produce better codegen. It would be nice to copy them (again, without bringing dead code) for some small perf wins. I expect this will be fairly easy to do by eyeballing them side by side.