DMD can implicitly convert class pointer to the bool. Is it bug or terrible feature?
ilya-stromberg
ilya-stromberg-2009 at yandex.ru
Mon Nov 25 01:39:13 PST 2013
On Monday, 25 November 2013 at 04:35:10 UTC, Andrei Alexandrescu
wrote:
> On 11/24/13 8:27 PM, Craig Dillabaugh wrote:
>> Would it be possible to introduce a global scope of sorts that
>> had to be explicitly referenced when one wanted to define or
>> use
>> a global variable. I haven't thought of how this might
>> interface
>> with other D features, but something along the lines of:
>>
>> @global int my_gobal_var; //Gets added to global scope.
>>
>> //Then any globals would have to be referenced as:
>> global.my_global_var = 7;
>>
>> Makes for a bit of extra typing, and would mess with any module
>> named 'global', but it might work?
>
> To put it bluntly, many things are possible but it seems the
> best is to do nothing here. We're in good shape.
I personally like Craig Dillabaugh's sugestion. But we can use
`.` operator for this because it alredy used for call global
functions and, probably, should break nothing. Like this:
int my_gobal_var;
.my_global_var = 7;
Is it possible?
More information about the Digitalmars-d
mailing list