auto storage class - infer or RAII?
Derek Parnell
derek at nomail.afraid.org
Sun Nov 12 23:29:13 PST 2006
On Mon, 13 Nov 2006 01:58:21 -0500, Chad J wrote:
> Walter Bright wrote:
>> The auto storage class currently is a little fuzzy in meaning, it can
>> mean "infer the type" and/or "destruct at end of scope". The latter only
>> has meaning for class objects, so let's look at the syntax. There are 4
>> cases:
>>
>> class Class { }
>>
>> 1) auto c = new Class();
>> 2) auto Class c = new Class();
>> 3) auto c = some_expression();
>> 4) auto Class c = some_expression();
>>
>> The ambiguity can be resolved by saying that if auto is used for type
>> inference, i.e. cases (1) and (3), then it does not mean RAII. If it is
>> not used for type inference, i.e. cases (2) and (4), then it does mean
>> RAII.
>>
>> In the future, I'd like the following to work:
>>
>> 5) auto c = Class();
>>
>> which would mean type inference *and* RAII.
>
> I'm going to chime in with the people who don't like (5). I'd much
> prefer reusing 'scope' or some such.
Has anyone worked out how to grep for instances of RAII and/or TI using
this proposed syntax? I mean if I wanted to locate all the places where I
was using (only) RAII, what would be the regular expression to do that? The
same with TI? I'm sure it can be done but I'm no RE guru.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
13/11/2006 6:26:08 PM
More information about the Digitalmars-d
mailing list