RFC: moving forward with @nogc Phobos

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 30 05:29:55 PDT 2014


On 9/30/14, 3:41 AM, Peter Alexander wrote:
> On Tuesday, 30 September 2014 at 08:34:26 UTC, Johannes Pfau wrote:
>> What if I don't want automated memory _management_? What if I want a
>> function to use a stack buffer? Or if I want to free manually?
>
> Agreed. This is the common case we need to solve for, but this is memory
> allocation, not management. I'm not sure where manual management fits
> into Andrei's scheme. Andrei, could you give an example of, e.g. how
> toStringz would work with a stack buffer in your proposed scheme?

There would be no possibility to do that. I mean it's not there but it 
can be added e.g. as a "manual" option of performing memory management. 
The "manual" overloads for functions would require an output range 
parameter. Not all functions might support a "manual" option - that'd be 
rejected statically.

> Another thought: if we use a template parameter, what's the story for
> virtual functions (e.g. Object.toString)? They can't be templated.

Good point. We need to think about that.


Andrei




More information about the Digitalmars-d mailing list