If you could make any changes to D, what would they look like?

jmh530 john.michael.hall at gmail.com
Wed Oct 20 17:27:45 UTC 2021


On Wednesday, 20 October 2021 at 10:26:52 UTC, IGotD- wrote:
> On Wednesday, 20 October 2021 at 10:23:27 UTC, SealabJaster 
> wrote:
>>
>> So something like `int^` to denote a GC pointer, and `int*` 
>> for a raw pointer?
>
> Something like that, which is exactly the syntax of "Managed 
> C++".

What is the benefit of different pointer types?

If you have a function that takes a pointer but doesn't make any 
allocations or anything, then you would need to have two versions 
of it to work with each type. This introduces a similar issue as 
what led to inout. It might make some kind of generics with type 
erasure that can handle all of these cases more useful.


More information about the Digitalmars-d mailing list