std.range's put on arrays needs to change
Kostiantyn Tokar
tokarkonstantyn at yandex.ua
Sun Jun 26 06:33:13 UTC 2022
On Saturday, 25 June 2022 at 23:44:59 UTC, WebFreak001 wrote:
> I strongly feel that this behavior is very inconsistent and
> unexpected for most users and should be changed. I think we
> should deprecate simple arrays/slices on `put` and rename the
> method for those.
>
> I propose put with slices should be renamed to `putInto`.
What should I do if I want to preallocate a slice and copy some
input range into it? I wouldn't be able to use
`std.algorithm.copy` for this simple purpose, because it uses
`put` internally.
BTW, isn't it a breaking change? It changes semantics of `put`
into a slice, and it wouldn't be available in a `@nogc` context.
I don't like special casing of slices from all other output
ranges. Basically you need to provide analogues for `putInto` of
`isOutputRange` and all standard functions that use `put`, like
`std.algorithm.copy`, for this sole reason.
So why to change this if `std.array.appender` exists?
More information about the Digitalmars-d
mailing list