On Friday, 5 January 2018 at 03:11:42 UTC, jmh530 wrote:
It also occurs to me that you could have a region for (completely) const/immutable data (not sure if you need to do this as a subregion within a precise region), assuming the GC can get that information. Transitive const/immutable means that pointers to this data cannot modify it. GC strategies that normally require write barriers wouldn't need them here.
In std.experimental.allocator, I was thinking that in something like GCAllocator you could have the allocate function be a template that changes the behavior based on the the type you are trying to create. So for instance, if you are creating a const/immutable object do one thing and if creating a mutable object do something else. However, it looks like the allocate function is not templatized so it might require a bit of modification to get it work. It also mean the allocator would depend on the type it is trying to create, which may not be a design they want to pursue.
I noticed there is a second parameter in allocate in IAllocator for TypeInfo. This is for run-time type info, but I don't see an example for it.
