pass-by-ref semantics for structs (was Deque impl.)
monarch_dodra
monarchdodra at gmail.com
Fri Feb 1 11:18:48 PST 2013
On Friday, 1 February 2013 at 19:10:26 UTC, Rainer Schuetze wrote:
>
>
> On 01.02.2013 09:06, Dmitry Olshansky wrote:
>> 01-Feb-2013 00:32, Rainer Schuetze пишет:
>>>
>>>
>>> - how do you reference count immutable containers? You'll
>>> have to cast
>>> the payload to mutable and assume it is not in read-only
>>> memory.
>>
>> Containers of immutables can have ref-count easily.
>> And I'd say fully immutable containers are rare case and can
>> rely on GC.
>
> Do you want different implementations of the containers
> depending on the mutable/immutable/shared modifier? Would that
> be possible?
You can only do that on the qualifier of the *parameters*, not
the container itself.
This is not possible because an S "is a" const(S). If the
implementation of an S was different from a const(S), then you'd
violate that. At best, a const(S) is an S with restricted
possibilities, bot not *different* possibilities.
More information about the Digitalmars-d
mailing list