Allocatoin policy in Phobos - Was: Vote for std.process

Steven Schveighoffer schveiguy at yahoo.com
Fri Apr 12 10:51:56 PDT 2013


On Fri, 12 Apr 2013 13:37:50 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> On 4/12/2013 5:52 AM, Manu wrote:
>> Just to be clear, I'm not arguing optimisation for performance here,  
>> I'm arguing
>> intolerance for __unnecessary__ allocations as a policy, or at least a  
>> habit.
>> There's a whole separate thread on the topic of fighting unnecessary  
>> garbage,
>> and having the ability to use D with strict control over the GC and/or
>> allocation in general.
>>
>> If std functions have no reason to allocate, why should they?
>
> Absolutely right. All phobos functions should not allocate unless  
> absolutely necessary.

Define "absolutely."  For example, there was an objection to accepting an  
AA as an "environment" map to std.process.spawnX functions because even  
though reading the AA would not require allocation, allocation would  
certainly be required to build the AA.  Is that acceptable?  Certainly we  
could invent a new non-allocating map type and accept that instead.

I think we need clearer lines drawn here, if they are to be respected.

-Steve


More information about the Digitalmars-d mailing list