Skip to content

length function is confusing #17

Closed

Description

@BurningWitness

Under Windows length appears to refer to the number of underlying bytes instead of the number of 16-bit codepoints, which is at odds with the rest of the API (and other libraries, e.g. text). numWord, even though it is present in the Short.Word16 module, is not exposed in a cross-platform fashion.

Activity

  1. hasufell commented on May 20, 2024

    @hasufell
    Member

    What function are you referring to exactly?

  2. hasufell commented on May 20, 2024

    @hasufell
    Member

    You are right: https://hackage.haskell.org/package/os-string-2.0.2.2/docs/System-OsString.html#v:length

    All functionss in OsString under windows deal with Word16 boundaries. Length should too.

  3. added
    bug
    on May 20, 2024
  4. added a commit that references this issue on May 23, 2024
    9aa11e1
  5. BurningWitness commented on May 24, 2024

    @BurningWitness
    Author

    Since this directly changes the behavior of the length function, shouldn't this have been a major version bump?

  6. hasufell commented on May 24, 2024

    @hasufell
    Member

    How so? PVP doesn't specify what to do on behavior changes.

  7. BurningWitness commented on May 24, 2024

    @BurningWitness
    Author

    The decision tree on the website has "Did the behavior of any exported functions change?" as one of the questions.

  8. hasufell commented on May 24, 2024

    @hasufell
    Member

    The decision tree is irrelevant. Please refer to the actual specification text.

    For more information see:

  9. BurningWitness commented on May 24, 2024

    @BurningWitness
    Author

    I would simply argue here that since you're obviously changing what length does this is a breaking change (and thus requires a major version bump). I argue for this even knowing that the documentation on the function is quite ambiguous (after all "length" could have always referred to the number of underlying code points and everyone using it could've assumed it to work that way, but never tested under Windows).

    This is however not a "please refer to the actual specification text" matter, as the pvp#55 issue you've linked is specifically an ongoing discussion of what the spirit of the PVP is. As such there is no agreement on the matter and whether or not to consider the change in question breaking is currently merely maintainer preference.

  10. hasufell commented on May 24, 2024

    @hasufell
    Member

    Thanks for your input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions