November 16, 2021
On Tuesday, 16 November 2021 at 17:52:10 UTC, Andrei Alexandrescu wrote:
> At least in theory it could mark pages as read-only. Current compilers do that for statically-initialized constant data, but not for anything else.

Would require annoying bookkeeping for small allocations.  Obvious route is on every allocation you unprotect/reprotect; that's slow.  Alternately you can make one rw mapping and one ro mapping; write the newly created data through rw space, but return a pointer to ro space.  But then you are technically not 'immutable'.
November 30, 2021

On Friday, 12 November 2021 at 12:31:03 UTC, Steven Schveighoffer wrote:

>

One of the prerequisites to doing reference counting is to have a mutable piece of data inside an immutable piece of data.

-Steve

I've been thinking and the origin of a reference counted type should be mutable or
const and never immutable. Make it illegal to create immutable reference counted types.

Then Andrei can apply its cheat codes to const and only const. Never to immutable.

So const(RCType) and never immutable(RCType);

I believe there is const and shared const. So immutable remains immutable forever
and ever and ever.

November 30, 2021
On Tuesday, 16 November 2021 at 19:39:02 UTC, Elronnd wrote:
>
> Would require annoying bookkeeping for small allocations.  Obvious route is on every allocation you unprotect/reprotect; that's slow.  Alternately you can make one rw mapping and one ro mapping; write the newly created data through rw space, but return a pointer to ro space.  But then you are technically not 'immutable'.

I'll give you a hint: Don't do many small allocations. There is an overhead regardless of RC or not.


1 2 3 4 5 6 7 8 9 10 11
Next ›   Last »