Re: fixedstring: a @safe, @nogc string type

2022-01-12 Thread Moth via Digitalmars-d-announce
now available on dub: https://code.dlang.org/packages/fixedstring

Re: fixedstring: a @safe, @nogc string type

2022-01-12 Thread H. S. Teoh via Digitalmars-d-announce
On Wed, Jan 12, 2022 at 07:55:41PM +, Moth via Digitalmars-d-announce wrote: > On Tuesday, 11 January 2022 at 17:55:28 UTC, H. S. Teoh wrote: [...] > > One minor usability issue I found just glancing over the code: many > > of your methods take char[] as argument. Generally, you want > >

Re: fixedstring: a @safe, @nogc string type

2022-01-12 Thread Paul Backus via Digitalmars-d-announce
On Wednesday, 12 January 2022 at 19:55:41 UTC, Moth wrote: [snip] Another issue is the way concatenation is implemented. Since FixedStrings have compile-time size, this potentially means every time you concatenate a string in your code you get another instantiation of FixedString. This can

Re: fixedstring: a @safe, @nogc string type

2022-01-12 Thread Moth via Digitalmars-d-announce
On Tuesday, 11 January 2022 at 17:55:28 UTC, H. S. Teoh wrote: [snip] One minor usability issue I found just glancing over the code: many of your methods take char[] as argument. Generally, you want const(char)[] instead, so that it will work with both char[] and immutable(char)[]. No reason

Re: fixedstring: a @safe, @nogc string type

2022-01-12 Thread Moth via Digitalmars-d-announce
On Tuesday, 11 January 2022 at 12:22:36 UTC, WebFreak001 wrote: [snip] you can relatively easily find out how many bytes a string takes up with `std.utf`. You can also iterate by code points or graphemes there if you want to translate some kind of character index to byte position. HOWEVER

Re: fixedstring: a @safe, @nogc string type

2022-01-11 Thread Paul Backus via Digitalmars-d-announce
On Tuesday, 11 January 2022 at 17:55:28 UTC, H. S. Teoh wrote: Generally, I'd advise not conflating your containers with ranges over your containers: I'd make .opSlice return a traditional D slice (i.e., const(char)[]) instead of a FixedString, and just require writing `[]` when you need to

Re: fixedstring: a @safe, @nogc string type

2022-01-11 Thread H. S. Teoh via Digitalmars-d-announce
On Tue, Jan 11, 2022 at 11:16:13AM +, Moth via Digitalmars-d-announce wrote: > On Tuesday, 11 January 2022 at 03:20:22 UTC, Salih Dincer wrote: > > [snip] > > glad to hear you're finding it useful! =] One minor usability issue I found just glancing over the code: many of your methods take

Re: fixedstring: a @safe, @nogc string type

2022-01-11 Thread WebFreak001 via Digitalmars-d-announce
On Tuesday, 11 January 2022 at 11:16:13 UTC, Moth wrote: On Tuesday, 11 January 2022 at 03:20:22 UTC, Salih Dincer wrote: [snip] glad to hear you're finding it useful! =] hm, i'm not sure how i would go about fixing that double character issue. i know there's currently some wierdness with

Re: fixedstring: a @safe, @nogc string type

2022-01-11 Thread vit via Digitalmars-d-announce
On Tuesday, 11 January 2022 at 11:16:13 UTC, Moth wrote: On Tuesday, 11 January 2022 at 03:20:22 UTC, Salih Dincer wrote: [snip] glad to hear you're finding it useful! =] ... i know there's currently some wierdness with wchars / dchars equality that needs to be fixed [shouldn't be too much

Re: fixedstring: a @safe, @nogc string type

2022-01-11 Thread Moth via Digitalmars-d-announce
On Tuesday, 11 January 2022 at 03:20:22 UTC, Salih Dincer wrote: [snip] glad to hear you're finding it useful! =] hm, i'm not sure how i would go about fixing that double character issue. i know there's currently some wierdness with wchars / dchars equality that needs to be fixed [shouldn't

Re: fixedstring: a @safe, @nogc string type

2022-01-10 Thread Salih Dincer via Digitalmars-d-announce
On Monday, 10 January 2022 at 12:55:28 UTC, Moth wrote: have fun =] https://github.com/Moth-Tolias/fixedstring I try Fixedstring and, to my great relief I got the results I expected. Thank you, good luck with your work. So how to fix this double character issue: ```d FixedString!6 sugar =

Re: fixedstring: a @safe, @nogc string type

2022-01-10 Thread Moth via Digitalmars-d-announce
On Monday, 10 January 2022 at 14:06:27 UTC, Moth wrote: On Monday, 10 January 2022 at 13:12:13 UTC, jmh530 wrote: You might add some examples to the Readme.md good observation, i'll work on that. in the meantime the examples in the unittests should suffice. fixed. for those who don't

Re: fixedstring: a @safe, @nogc string type

2022-01-10 Thread Moth via Digitalmars-d-announce
On Monday, 10 January 2022 at 13:12:13 UTC, jmh530 wrote: You might add some examples to the Readme.md good observation, i'll work on that. in the meantime the examples in the unittests should suffice.

Re: fixedstring: a @safe, @nogc string type

2022-01-10 Thread jmh530 via Digitalmars-d-announce
On Monday, 10 January 2022 at 12:55:28 UTC, Moth wrote: hi all. i got fed up with the built-in string type having so many features unavailable in `@nogc` code, so i made my own. introducing fixedstring: a templated fixed-length array of `char`s, compatible with `@safe`, `@nogc`, and

Re: fixedstring: a @safe, @nogc string type

2022-01-10 Thread zjh via Digitalmars-d-announce
On Monday, 10 January 2022 at 12:55:28 UTC, Moth wrote: hi all. Good.Let's use `betterC`.