auto storage class - infer or RAII?
Sean Kelly
sean at f4.ca
Sun Nov 12 14:34:06 PST 2006
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
The only thing better would be if the ctor syntax applied to concrete
types as well. Then templates could almost be generic in how they dealt
with types.
That said, I do appreciate your concern about static opCall. As a
somewhat bizarre suggestion that would break the consistency illustrated
above:
MyClass c = new(scope) MyClass(); // scoped class
MyClass d = new MyClass; // dynamic class
I don't really like this, but it would work with the existing placement
new syntax and doesn't require any new keywords either.
Sean
More information about the Digitalmars-d
mailing list