range methods on associative arrays
Steven Schveighoffer
schveiguy at gmail.com
Sat Jul 2 23:13:43 UTC 2022
On 7/2/22 5:51 PM, WebFreak001 wrote:
> On Saturday, 2 July 2022 at 21:18:06 UTC, Steven Schveighoffer wrote:
>> This idea misunderstands what a range is.
>>
>> In order for an AA to be considered a "range", each popFront should
>> remove the element from the AA.
>>
>> We don't want that. Just use the range accessors.
>>
>
> arrays/slices are also not ranges and get special-cased (or at least
> have compatibility functions in std.range.primitives) to be used with
> range code, I don't see any reason why not to do this with maps as well,
> which are a first class feature of the language.
arrays/slices are ranges. They are actually the essential range type.
Also, an AA is fundamentally different. I can popFront on a slice, and
it doesn't affect other slices. If I popFront an element from an AA, it
affects all other references to that AA.
-Steve
More information about the Digitalmars-d
mailing list