Question about RAII.
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Wed Jul 5 04:08:52 PDT 2006
Derek Parnell wrote:
> On Wed, 05 Jul 2006 01:36:54 +0100, Bruno Medeiros wrote:
>
>> Derek Parnell wrote:
>>
>> I'm not sure if you're just asking that without regards to the previous
>> code, you're if asking that because you may have misunderstood the
>> previous code.
>
> Yep. I did misunderstand. My mistake, but I can see the 'trick' now. Is
> this method endorsed by Walter or is this just an artifact of the RAII
> implementation?
>
Well, actually, now that I recall the spec, that behavior isn't valid:
"Assignment to an auto, other than initialization, is not allowed."
But since the auto mechanism is under consideration to have some
changes, the future behavior might be different and allow something like
this. Or not at all.
For instance, if we have an auto that instead of being applied to
variables, is applied to values, like this:
auto Bar();
Foo foo = auto Foo();
then how would one cancel the Foo() destruction? A new mechanism would
be required, but then it might become a little awkward.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list