# Bikeshedding: Name of package with AbstractStrings based on NTuples

**URL:** https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881
**Category:** General Usage
**Tags:** question, bikeshed
**Created:** [September 27, 2022, 5:50pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881 "2022-09-27T17:50:23Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 27, 2022, 5:50pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/1 "2022-09-27T17:50:23Z")

</div>

I’m in the process of creating a new package for strings based on `NTuple`s. It is similar in concept to InlineStrings.jl, but it uses `NTuple{N,UInt8}` instead of primitives. It allows for more variation in `N`. In part, it is intended for interop with C where fixed sized strings are sometimes represented by `char str[N]`.

Currently, I have called this package [**NStrings**](https://github.com/mkitti/NStrings.jl).

[Others](https://github.com/mkitti/NStrings.jl) have proposed

- TupleStrings
- StaticStrings

Do you have another idea? Please let me know below. Let the [bikeshedding](https://en.wiktionary.org/wiki/bikeshedding) begin [1].

[1] Tone is hard to convey in text. I’m being jovial. That said I would earnestly like to hear your ideas.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [September 27, 2022, 5:58pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/2 "2022-09-27T17:58:51Z")

</div>

`StaticCharStrings` or `CharStrings`?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 27, 2022, 6:02pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/3 "2022-09-27T18:02:20Z")

</div>

Why `Char`? The tuples do not consist of `Char`s.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [September 27, 2022, 6:40pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/4 "2022-09-27T18:40:13Z")

</div>

> [@mkitti](#):
>
> `char str[N]`.

I mean…

UInt8 and C Char are the same thing and I doubt you gonna use this for C Unicode? (because if it were unicode it wouldn’t be `char str[N]` in C

---

<div class="post-metadata">

### Author: ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)
#### Post date: [September 27, 2022, 6:40pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/5 "2022-09-27T18:40:59Z")

</div>

CCharTuples?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 27, 2022, 6:47pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/6 "2022-09-27T18:47:12Z")

</div>

> [@jling](#):
>
> I mean…
> 
> UInt8 and C Char are the same thing and I doubt you gonna use this for C Unicode? (because if it were unicode it wouldn’t be `char str[N]` in C

C interop is a particular application, but this meant to cover Julia strings in general.

```julia
julia> str = "This is a Julia string with multiple NUL bytes \0\0\0\0"
"This is a Julia string with multiple NUL bytes \0\0\0\0"

julia> NString(Tuple(codeunits.(str)))
"This is a Julia string with multiple NUL bytes \0\0\0\0"

julia> NString(Tuple(codeunits.(str))) == str
true

julia> length(str)
51

julia> Tuple(codeunits.(str))
(0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x4a, 0x75, 0x6c, 0x69, 0x61, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x20, 0x4e, 0x55, 0x4c, 0x20, 0x62, 0x79, 0x74, 0x65, 0x73, 0x20, 0x00, 0x00, 0x00, 0x00)

```

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 27, 2022, 6:53pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/7 "2022-09-27T18:53:52Z")

</div>

> [@jling](#):
>
> UInt8 and C Char are the same thing and I doubt you gonna use this for C Unicode?

I disagree, I think you’d definitely want the storage to consist of UTF-8 code units so that it can store unicode.

This is also important for C interoperability, since typically C `char*` strings these days are actually UTF8-encoded Unicode — i.e. a `char` is a code unit, not a `Char` (Unicode codepoint). (This is basically true everywhere but Windows, and even on Windows people are starting to use UTF8 more.)

---

<div class="post-metadata">

### Author: ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)
#### Post date: [September 27, 2022, 7:07pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/8 "2022-09-27T19:07:01Z")

</div>

UTF8TupleStrings?

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 27, 2022, 7:10pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/9 "2022-09-27T19:10:09Z")

</div>

> [@dlakelan](#):
>
> UTF8TupleStrings

Julia’s ordinary `String` type is UTF-8, so I think it’s reasonable to assume that this is the default for any new string type and doesn’t need to be in the type name unless you’re using a different encoding.

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [September 27, 2022, 7:46pm UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/10 "2022-09-27T19:46:01Z")

</div>

I’d advocate in favour of `StaticStrings`, because I think it’s really informative.

When I see the name StaticStrings, I immediately associate it with packages like StaticArrays.jl, and this is essentially the StaticArray version of a string anyways.

NStrings.jl on the other hand is a really uninformative name as far as I’m concerned. All strings have N elements. What’s important and useful about these strings is not N, but the fact that they’re static.

---

<div class="post-metadata">

### Author: ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)
#### Post date: [September 28, 2022, 4:12am UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/11 "2022-09-28T04:12:03Z")

</div>

Is this essentially the same thing/type as [FixedSizeStrings.jl/FixedSizeStrings.jl at master · JuliaComputing/FixedSizeStrings.jl · GitHub](https://github.com/JuliaComputing/FixedSizeStrings.jl/blob/master/src/FixedSizeStrings.jl), right? Which seems also a good name 😉

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 28, 2022, 4:19am UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/12 "2022-09-28T04:19:58Z")

</div>

Yes, although FixedSizeStrings.jl seems to assume that a `Char` corresponds to a single codeunit, which is wrong for UTF-8.

```julia
julia> s = "สวัสดี"
"สวัสดี"

julia> using NStrings, FixedSizeStrings

julia> NString(s)
"สวัสดี"

julia> FixedSizeString(s)
ERROR: InexactError: trunc(UInt8, 3626)

```

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 28, 2022, 4:51am UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/13 "2022-09-28T04:51:23Z")

</div>

Another approach would be merging with an existing package. Does anyone have any opinions on that?

---

<div class="post-metadata">

### Author: ![fabiangans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiangans/32/2624_2.png) [@fabiangans](https://discourse.julialang.org/u/fabiangans)
#### Post date: [September 28, 2022, 6:44am UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/14 "2022-09-28T06:44:06Z")

</div>

I think you might be able to cover both representations by using an additional type parameter for the encoding, see for example this implementation

> <https://github.com/JuliaIO/Zarr.jl/blob/master/src/MaxLengthStrings.jl>

In this case we cover both UTF8 and ASCII string types. BTW thanks for making this package, maybe Zarr.jl can use it so we don’t have to maintain our own implementation there anymore.

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [September 28, 2022, 7:24am UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/15 "2022-09-28T07:24:50Z")

</div>

> [@mkitti](#):
>
> Another approach would be merging with an existing package.

Could this be considered a rewrite of FixedSizeStrings.jl? If so, it’s pretty good name.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [September 28, 2022, 7:48am UTC](https://discourse.julialang.org/t/bikeshedding-name-of-package-with-abstractstrings-based-on-ntuples/87881/16 "2022-09-28T07:48:31Z")

</div>

> [@fabiangans](#):
>
> I think you might be able to cover both representations by using an additional type parameter for the encoding, see for example this implementation
> 
> [https://github.com/JuliaIO/Zarr.jl/blob/master/src/MaxLengthStrings.jl](https://github.com/JuliaIO/Zarr.jl/blob/master/src/MaxLengthStrings.jl)

UTF-8 is a backwards compatible superset of ASCII, so StaticStrings.jl does support both just as Julia Strings do.
