Docs: Section on local variables
Timon Gehr
timon.gehr at gmx.ch
Fri Apr 20 05:54:13 PDT 2012
On 04/20/2012 12:07 PM, Jakob Ovrum wrote:
> On Friday, 20 April 2012 at 09:55:04 UTC, Nick Sabalausky wrote:
>
>> It's funny, I once argued strongly in favor of this *against* Walter.
>> I lost
>> of course ;) IIRC, his argument was that it would require perfect flow
>> analysis and that's too difficult and expensive.
> My argument was that it
>> didn't need to be, and perhaps even *shouldn't* be, perfect. He felt that
>> would end up being a PITA with false errors, and I felt that C#
>> demonstrates
>> it isn't a PITA. Meh, I don't want to re-debate it though.
>
> Yeah, I am aware of Walter's previous statements on this. I think it's
> ridiculous that he wants his language inferior to virtually every one of
> its modern contemporaries in this aspect based on implementation issues.
Why do you think it is an implementation issue? D already requires an
implementation to have flow-analysis.
> I like D's well-defined default-initialization and I think it's great
> for global storage, TLS and class/struct fields, but I think local
> variables require a hybrid approach. It doesn't matter if the
> implementation isn't perfect;
It certainly does. Compiler errors for non-issues hamper productivity
and are good for nothing.
> it's better than the alternative, which is
> our current abysmal situation.
>
'abysmal'? Seriously? This could go either way, and personally, I like
the current way better.
Maybe the implementation could be non-conservative: The warning would
pop up only if it can be proven by flow-analysis that a local variable
is accessed without preceding explicit initialisation. Anyway, why would
this be such a huge deal?
More information about the Digitalmars-d
mailing list