Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop special casing InlineString1 #80

Merged
merged 3 commits into from
Jul 23, 2024

Commits on Jul 12, 2024

  1. Stop special casing InlineString1

    I was looking into fixing JuliaStrings#15 but realized that the special casing of `InlineString1` to only have one byte makes that not work. I would say that the current special casing of `InlineString1` creates quite a bit of confusing behavior:
    
    ```
    julia> InlineString("") |> typeof
    String3
    
    julia> InlineString("a") |> typeof
    String1
    ```
    
    Why would an empty string take more place than a one letter string?
    
    ```
    
    julia> String1("")
    ERROR: ArgumentError: string too large (0) to convert to String1
    Stacktrace:
     [1] stringtoolong(T::Type, n::Int64)
       @ InlineStrings ~/.julia/packages/InlineStrings/xUsry/src/InlineStrings.jl:321
     [2] String1(x::String)
       @ InlineStrings ~/.julia/packages/InlineStrings/xUsry/src/InlineStrings.jl:208
     [3] top-level scope
       @ REPL[4]:1
    
    julia> String3("")
    ""
    ```
    
    Wut?
    
    There is nothing in the documentation that indicates this type of special behavior.
    
    I'm sure there is some reason for doing this since so much pain seems to have been gone through to do it but I thought I would put up this PR nonetheless.
    
    Fixes JuliaStrings#73
    Fixes JuliaStrings#72
    KristofferC committed Jul 12, 2024
    Configuration menu
    Copy the full SHA
    e375be8 View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2024

  1. Configuration menu
    Copy the full SHA
    19df12f View commit details
    Browse the repository at this point in the history
  2. fixup formatting

    KristofferC authored Jul 23, 2024
    Configuration menu
    Copy the full SHA
    43745f1 View commit details
    Browse the repository at this point in the history