May 02, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 5/2/2015 11:17 AM, deadalnix wrote:
> Back with some data, this change indeed discovered one bug in SDC. This was not
> the first one I'm aware of the confusing behavior, and looking for it in PR,
> still we have at least one case left.
I don't doubt that the change will discover a bug here and there.
|
May 02, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On 5/2/2015 7:37 AM, Martin Nowak wrote:
> On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote:
>> I suspect this kind of change and check would be appropriate for a D linter,
>> and not be part of the core language.
>
> Yes it would fit nicely into a static analyzer, but DMD is currently the only
> semantic analyzer we have.
I know. The warnings were supposed to be a static analyzer, but quickly turned into core language behavior.
|
May 02, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On 5/2/2015 4:06 AM, Vladimir Panteleev wrote:
> On Saturday, 2 May 2015 at 09:20:50 UTC, Jonathan M Davis wrote:
>> The only problem I see with making the change has been a couple
>> of very vocal folks
>> [...]
>> (since it's Andrei and Cybershadow who are complaining)
>
> "You either die a hero, or live long enough to see yourself become the villain."
Ironic, as I recently watched the series "Oppenheimer".
|
May 02, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Saturday, 2 May 2015 at 14:37:08 UTC, Martin Nowak wrote:
> On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote:
>> I suspect this kind of change and check would be appropriate for a D linter, and not be part of the core language.
>
> Yes it would fit nicely into a static analyzer, but DMD is currently the only semantic analyzer we have.
dscanner exists
hopefully SDC will improve D tooling.
|
May 03, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to weaselcat Attachments: | On Sat, 02 May 2015 19:56:49 +0000, weaselcat wrote:
> On Saturday, 2 May 2015 at 14:37:08 UTC, Martin Nowak wrote:
>> On Friday, 1 May 2015 at 19:45:18 UTC, Walter Bright wrote:
>>> I suspect this kind of change and check would be appropriate for a D linter, and not be part of the core language.
>>
>> Yes it would fit nicely into a static analyzer, but DMD is currently the only semantic analyzer we have.
>
> dscanner exists
dscanner doesn't do full semantic analysis. and you need that, with full type inference, to catch all cases.
|
May 04, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Friday, 10 April 2015 at 10:14:43 UTC, Martin Nowak wrote:
> if (arr) -> if (!arr.empty)
>
> It's much clearer and also what you need to write when you work with ranges.
Maybe rename it "opEmpty" then.
Try to keep language protocols and library conventions separate.
|
May 04, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad Attachments: | On Mon, 04 May 2015 10:27:47 +0000, Ola Fosheim Grøstad wrote:
> On Friday, 10 April 2015 at 10:14:43 UTC, Martin Nowak wrote:
>> if (arr) -> if (!arr.empty)
>>
>> It's much clearer and also what you need to write when you work with ranges.
>
> Maybe rename it "opEmpty" then.
>
> Try to keep language protocols and library conventions separate.
or at least move it to "object.d", so i don't have to import "std.range" to get this check working.
|
Copyright © 1999-2021 by the D Language Foundation