April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | "Vladimir Panteleev" wrote in message news:swjdkyjsurpjdqrvqonq@forum.dlang.org... > I don't know. The one in std.exception is probably due to an array being used as a condition for enforce. Yep, that's not nice. From what I can see the warning in the template constraint is ignored, and so the call succeeds. I don't know how to force a failure there with a warning. |
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Wed, 29 Apr 2015 22:44:22 -0400, Steven Schveighoffer wrote:
> On 4/29/15 8:35 PM, Martin Nowak wrote:
>> Occasionally I'm using if (auto ary = func()), despite the fact that
>> the semantics are wrong, but it's nice and short and works as long a
>> func always returns null instead of empty slices.
>
> I wonder if it's possible to fix this, as it is, IMO, the only legitimate drawback of this change. Could we make the following work?
>
> if((auto ary = func()).length)
>
> -Steve
I would have though this would work:
if(auto x = foo(), !x.empty)
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 4/30/15 4:46 AM, Daniel Murphy wrote:
> "Vladimir Panteleev" wrote in message
> news:ajrysqkjmlqjlmkipboz@forum.dlang.org...
>
>> On Wednesday, 29 April 2015 at 19:15:46 UTC, Jonathan M Davis
>> wrote:
>> > but std.allocator is definitely not your average code
>>
>> OK, I'm tired of hearing this argument.
>
> It's valid though.
I think we need to stop here. I'll make the PR today for reverting this language change. We can't handle D like a semester science project, because for as long as we do we won't have credibility.
This trickle of teeny-bit breaking changes for the sake of touted benefits must stop.
In the future please do not make breaking changes without my and Walter's approval.
Thanks,
Andrei
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 30 April 2015 at 17:08, Andrei Alexandrescu via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On 4/30/15 4:46 AM, Daniel Murphy wrote:
>>
>> "Vladimir Panteleev" wrote in message news:ajrysqkjmlqjlmkipboz@forum.dlang.org...
>>
>>> On Wednesday, 29 April 2015 at 19:15:46 UTC, Jonathan M Davis wrote:
>>> > but std.allocator is definitely not your average code
>>>
>>> OK, I'm tired of hearing this argument.
>>
>>
>> It's valid though.
>
>
> I think we need to stop here. I'll make the PR today for reverting this language change. We can't handle D like a semester science project, because for as long as we do we won't have credibility.
>
> This trickle of teeny-bit breaking changes for the sake of touted benefits must stop.
>
> In the future please do not make breaking changes without my and Walter's approval.
>
>
At least enforce a behaviour in the frontend if you are going to revert.
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Iain Buclaw | On 4/30/15 8:51 AM, Iain Buclaw via Digitalmars-d wrote:
> At least enforce a behaviour in the frontend if you are going to revert.
How do you mean that? -- Andrei
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | "Andrei Alexandrescu" wrote in message news:mhtggg$26b5$1@digitalmars.com... > I think we need to stop here. I'll make the PR today for reverting this language change. We can't handle D like a semester science project, because for as long as we do we won't have credibility. > This trickle of teeny-bit breaking changes for the sake of touted benefits must stop. This breaking change prevents hard-to-find bugs. The fact that you needed to make trivial changes to 39 places in std.allocator doesn't negate this. |
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu Attachments:
| On Thu, Apr 30, 2015 at 8:08 AM, Andrei Alexandrescu via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
>
> This trickle of teeny-bit breaking changes for the sake of touted benefits must stop.
>
>
This is how you improve the language. You can disagree with the touted benefits, but without changes of this sort the language will never get better.
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 4/30/15 9:50 AM, Daniel Murphy wrote:
> "Andrei Alexandrescu" wrote in message
> news:mhtggg$26b5$1@digitalmars.com...
>
>> I think we need to stop here. I'll make the PR today for reverting
>> this language change. We can't handle D like a semester science
>> project, because for as long as we do we won't have credibility.
>
>> This trickle of teeny-bit breaking changes for the sake of touted
>> benefits must stop.
>
> This breaking change prevents hard-to-find bugs. The fact that you
> needed to make trivial changes to 39 places in std.allocator doesn't
> negate this.
Nothing negates that. It's a judgment call. Please let's stop here. Thanks. -- Andrei
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeremy Powers | On 4/30/15 10:10 AM, Jeremy Powers via Digitalmars-d wrote:
> On Thu, Apr 30, 2015 at 8:08 AM, Andrei Alexandrescu via Digitalmars-d
> <digitalmars-d@puremagic.com <mailto:digitalmars-d@puremagic.com>> wrote:
>
>
> This trickle of teeny-bit breaking changes for the sake of touted
> benefits must stop.
>
>
> This is how you improve the language.
No. -- Andrei
|
April 30, 2015 Re: if(arr) now a warning | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Thursday, 30 April 2015 at 11:43:06 UTC, Kagamin wrote:
> On Thursday, 30 April 2015 at 02:51:33 UTC, Vladimir Panteleev wrote:
>> OK, I'm tired of hearing this argument.
>
> Distinction between null and empty can be done, the problem is it doesn't fly in mainstream.
if (myslice is []) would wheck for null slice.
|
Copyright © 1999-2021 by the D Language Foundation