News for hackers. Stuff that matters.
Re:The Absolute Minimum Every Software Developer Must Know A... by moelf on Monday October 02, 2023 @11:24AM (#37739346)

  > The only modern language that gets it right is Swift:
arguably not true:

  julia> using Unicode

  # for some reason HN doesn't allow emoji
  julia> graphemes(" ")
  length-1 GraphemeIterator{String} for " "

  help?> graphemes
  search: graphemes

  graphemes(s::AbstractString) -> GraphemeIterator


  Return an iterator over substrings of s that correspond to the extended graphemes in the string, as defined by Unicode UAX #29. (Roughly, these are what users would perceive as single characters, even though they may contain more than one codepoint; for example a letter combined
  with an accent mark is a single grapheme.)
Re:The Absolute Minimum Every Software Developer Must Know A... by gwbas1c on Monday October 02, 2023 @11:40AM (#37739548)
Julia is not a major language like Swift.
Re:The Absolute Minimum Every Software Developer Must Know A... by JRaspass on Monday October 02, 2023 @11:55AM (#37739793)
Raku also gets it right.
Re:The Absolute Minimum Every Software Developer Must Know A... by SyrupThinker on Monday October 02, 2023 @12:03PM (#37739946)
I imagine the author would disagree with that because it does not have the “right” behavior by default.

For example indexing and length of the string are done by codeunit. [1]

On the other hand Rakus Str type does behave similarly to Swifts: indexing, length and iteration by grapheme; view methods for specific encodings. [2]

[1]: https://docs.julialang.org/en/v1/base/strings/ [2]: https://docs.raku.org/type/Str#routine_chars