Hacker News new | ask | show | jobs
by ghusbands 17 days ago
I find it striking that the article provides this enthusiastic example of a new feature:

  HashSet<string> names =
      [with(StringComparer.OrdinalIgnoreCase), "Alice", "ALICE", "Bob"];
  Console.WriteLine(names.Count); // Writes "2"
It's "good" that we have a hashset with syntactically four entries and no error/warning about duplicate keys and it ends up with just two and that there's an entry "with(...)" that's not actually an entry. And that's even before we get into how something called a StringComparer is providing a hash function and how OrdinalIgnoreCase is an underdefined upper-casing system rather than a true case-folding one, even if those are historical.
1 comments

That `with` inside of the collection expression feels really weird to me, I would have expected it before or after it.