What is Nostr?
Josh Jersild /
npub1qag…mtda
2023-05-23 21:57:02
in reply to nevent1q…q3ut

Josh Jersild on Nostr: npub16y5jd…wym3t C# actually has one critical flaw in my mind with strings, is that ...

npub16y5jdh5pxyqcvknyw70n2l5sr725zhv0n46mtr5lkmr0uz4xsnlqywym3t (npub16y5…ym3t) C# actually has one critical flaw in my mind with strings, is that its strings are just effectively arrays of UTF-16 code units. UTF-16 is (imo) bad as a raw representation because it's *almost* always correct - almost every Unicode character (especially those in most common languages) fits in a single utf-16 unit, so it's easy to get complacent about "oh this thing might only be half of a true Unicode character" and then you end up splitting a string mid-character and the Problems start.

If everything fit cleanly in UTF-16, though, yeah, it's otherwise great to use! Really a smart choice to effectively treat them as immutable values, eliminates a whole class of having to reason through "am I changing this string or making a new one" issues.
Author Public Key
npub1qagdvy4rej4vzc5uv8wftzyuw73an7zfm2qu5fap6nj67nqmzlws3umtda