Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-19 Thread Radu via Digitalmars-d
On Wednesday, 18 July 2018 at 22:44:33 UTC, aliak wrote: On Wednesday, 18 July 2018 at 12:10:04 UTC, Seb wrote: On Wednesday, 18 July 2018 at 03:40:08 UTC, Jon Degenhardt [...] [...] That point is still open for discussion, but at the moment rcstring isn't a range and the user has to

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread sarn via Digitalmars-d
On Wednesday, 18 July 2018 at 12:03:02 UTC, Eugene Wissner wrote: Therefore it shouldn't compile at all, but rcstring("ä")[].split("|") or rcstring("ä").byCodePoint.split("|") +1 to requiring an explicit byCodeUnit or whatever. For every "obvious" way to interpret a string as a range, you

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread aliak via Digitalmars-d
On Wednesday, 18 July 2018 at 12:10:04 UTC, Seb wrote: On Wednesday, 18 July 2018 at 03:40:08 UTC, Jon Degenhardt [...] and whether applications would use arrays and ranges of char together with rcstring, or rcstring would be used for everything. That point is still open for discussion, but

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Jacob Carlborg via Digitalmars-d
On 2018-07-18 13:37, Seb wrote: The problem here is this would also lead to very confusing behavior for newcomers, e.g. ``` "ä".split.join("|") == �|� ``` How about not giving access to operate on individual characters. If they need to do that they should operate on an array of bytes. Too

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, July 18, 2018 12:15:52 Seb via Digitalmars-d wrote: > Well, the problem of it being a range of char is that this might > lead to very confusing behavior, e.g. > > "ä".rcstring.split.join("|") == �|� > > So we probably shouldn't go this route either. I don't know. I'm fine with it

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread jmh530 via Digitalmars-d
On Wednesday, 18 July 2018 at 11:56:39 UTC, Seb wrote: [snip] Yes, Array is a reference-counted Array, but it also has a reference-counted allocator. I see. Is it really a good idea to make the ownership/lifetime strategy part of the container? What happens when you want to make nogc

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread jmh530 via Digitalmars-d
On Wednesday, 18 July 2018 at 11:56:39 UTC, Seb wrote: [snip] I think part of the above design decision connects in with why rcstring stores the data as ubytes, even for wchar and dchar. Recent comments suggest that it is related to auto-decoding. Yes rcstring doesn't do any auto-decoding

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Seb via Digitalmars-d
On Tuesday, 17 July 2018 at 18:09:13 UTC, Jonathan M Davis wrote: On Tuesday, July 17, 2018 17:28:19 Seb via Digitalmars-d wrote: On Tuesday, 17 July 2018 at 16:58:37 UTC, Jonathan M Davis wrote: > [...] Well, there are few cases where the range type doesn't matter and one can simply compare

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Seb via Digitalmars-d
On Wednesday, 18 July 2018 at 03:40:08 UTC, Jon Degenhardt wrote: On Tuesday, 17 July 2018 at 15:21:30 UTC, Seb wrote: So we managed to revive the rcstring project and it's already a PR for Phobos: https://github.com/dlang/phobos/pull/6631 (still WIP though) The current approach in short: -

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Eugene Wissner via Digitalmars-d
On Wednesday, 18 July 2018 at 11:37:33 UTC, Seb wrote: On Tuesday, 17 July 2018 at 17:41:05 UTC, Jacob Carlborg wrote: On 2018-07-17 17:21, Seb wrote: - _no_ range by default (it needs an explicit `.by!{d,w,}char`) (as in no auto-decoding by default) What do you think about this approach?

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Seb via Digitalmars-d
On Tuesday, 17 July 2018 at 18:43:47 UTC, jmh530 wrote: On Tuesday, 17 July 2018 at 15:21:30 UTC, Seb wrote: So we managed to revive the rcstring project and it's already a PR for Phobos: [snip] I'm glad this is getting worked on. It feels like something that D has been working towards

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Seb via Digitalmars-d
On Tuesday, 17 July 2018 at 17:41:05 UTC, Jacob Carlborg wrote: On 2018-07-17 17:21, Seb wrote: - _no_ range by default (it needs an explicit `.by!{d,w,}char`) (as in no auto-decoding by default) What do you think about this approach? Do you have a better idea? I vote for .by!char to be

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-18 Thread Andrea Fontana via Digitalmars-d
On Tuesday, 17 July 2018 at 16:58:37 UTC, Jonathan M Davis wrote: If it's not a range by default, why would you expect _anything_ which operates on ranges to work with rcstring directly? IMHO, if it's not a range, then range-based functions shouldn't work with it, and I don't see how they even

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, July 17, 2018 22:45:33 Andrei Alexandrescu via Digitalmars-d wrote: > On 7/17/18 12:58 PM, Jonathan M Davis wrote: > > If it's not a range by default, why would you expect_anything_ which > > operates on ranges to work with rcstring directly? > > Many functions do not care about the

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Jon Degenhardt via Digitalmars-d
On Tuesday, 17 July 2018 at 15:21:30 UTC, Seb wrote: So we managed to revive the rcstring project and it's already a PR for Phobos: https://github.com/dlang/phobos/pull/6631 (still WIP though) The current approach in short: - uses the new @nogc, @safe and nothrow Array from the collections

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread rikki cattermole via Digitalmars-d
On 18/07/2018 5:41 AM, Jacob Carlborg wrote: On 2018-07-17 17:21, Seb wrote: - _no_ range by default (it needs an explicit `.by!{d,w,}char`) (as in no auto-decoding by default) What do you think about this approach? Do you have a better idea? I vote for .by!char to be the default. I'm

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Andrei Alexandrescu via Digitalmars-d
On 7/17/18 12:58 PM, Jonathan M Davis wrote: If it's not a range by default, why would you expect_anything_ which operates on ranges to work with rcstring directly? Many functions do not care about the range aspect, but do care about the string aspect. Consider e.g. chdir.

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread jmh530 via Digitalmars-d
On Tuesday, 17 July 2018 at 15:21:30 UTC, Seb wrote: So we managed to revive the rcstring project and it's already a PR for Phobos: [snip] I'm glad this is getting worked on. It feels like something that D has been working towards for a while. Unfortunately, I haven't (yet) watched the

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, July 17, 2018 17:28:19 Seb via Digitalmars-d wrote: > On Tuesday, 17 July 2018 at 16:58:37 UTC, Jonathan M Davis wrote: > > On Tuesday, July 17, 2018 15:21:30 Seb via Digitalmars-d wrote: > >> [...] > > > > If it's not a range by default, why would you expect _anything_ > > which

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Jacob Carlborg via Digitalmars-d
On 2018-07-17 17:21, Seb wrote: - _no_ range by default (it needs an explicit `.by!{d,w,}char`) (as in no auto-decoding by default) What do you think about this approach? Do you have a better idea? I vote for .by!char to be the default. -- /Jacob Carlborg

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Seb via Digitalmars-d
On Tuesday, 17 July 2018 at 16:58:37 UTC, Jonathan M Davis wrote: On Tuesday, July 17, 2018 15:21:30 Seb via Digitalmars-d wrote: [...] If it's not a range by default, why would you expect _anything_ which operates on ranges to work with rcstring directly? IMHO, if it's not a range, then

Re: std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Jonathan M Davis via Digitalmars-d
On Tuesday, July 17, 2018 15:21:30 Seb via Digitalmars-d wrote: > So we managed to revive the rcstring project and it's already a > PR for Phobos: > > https://github.com/dlang/phobos/pull/6631 (still WIP though) > > The current approach in short: > > - uses the new @nogc, @safe and nothrow Array

std.experimental.collections.rcstring and its integration in Phobos

2018-07-17 Thread Seb via Digitalmars-d
So we managed to revive the rcstring project and it's already a PR for Phobos: https://github.com/dlang/phobos/pull/6631 (still WIP though) The current approach in short: - uses the new @nogc, @safe and nothrow Array from the collections library (check Eduardo's DConf18 talk) - uses