auto storage class - infer or RAII?

Bill Baxter dnewsgroup at billbaxter.com
Sun Nov 12 15:52:44 PST 2006


Sean Kelly wrote:
> Bill Baxter wrote:
>> Walter Bright wrote:
>>> Carlos Santander wrote:
>>>
>>>> I don't think they're valid concerns (meaning they're subjective, 
>>>> not everyone will have those ideas), but I think we (the D 
>>>> community) just want a way to clearly differentiate both meanings of 
>>>> auto. So, choose any two words: auto/scope, var/auto, def/scoped, 
>>>> foo/bar, and let's move on.
>>>
>>>
>>> I think the auto/scope is probably the best idea.
>>>
>>>> Also keep in mind that your option #5 (auto c = Class()) doesn't 
>>>> seem to be a popular proposal (based on what has been said in the ng).
>>>
>>>
>>> I'm a bit surprised at that, but the negative reaction to it is 
>>> pretty clear.
>>
>> And I'm a bit surprised by your surprise, given that it creates a 
>> special case rule for one particular, not-so-common situation, *AND* 
>> at the same time breaks static opCall.
> 
> What is the special case here?
> 
>     int i  = 5;       // scoped int
>     int* j = new int; // dynamic int
> 
>     MyClass c = MyClass();     // scoped class
>     MyClass d = new MyClass(); // dynamic class

That doesn't look particularly consistent to me.
In one case you have int vs int*, the other case you have MyClass for 
both.

But I could live with it if it weren't for that fact that x = MyClass() 
already has another meaning in D.

--bb



More information about the Digitalmars-d mailing list