nim-stack-strings icon indicating copy to clipboard operation
nim-stack-strings copied to clipboard

Add len type generic param

Open elcritch opened this issue 7 months ago • 1 comments

Makes a new base type StackStringBase[T; Size: static Natural] that has a generic parameter for the string length size.

For backwards compatibility purposes, StackString[N: static Natural] is defined as a type alias type StackString*[Size: static Natural] = StackStringBase[Natural, Size].

There is a compile time check in the constructor functions (like stackStringOfCap) that gives a compile time error if T is not large enough to hold Size characters. Unfortunately I couldn't find a way get the compiler to do the check in the type itself.

elcritch avatar May 03 '25 03:05 elcritch

I've been pretty busy recently, I'll review and test this out when I wake up tomorrow. Sorry for the delay, and thank you for the PR.

termermc avatar May 09 '25 06:05 termermc