July 12, 2016 Re: Evaluation order of "+=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On 7/12/16 5:15 AM, Johan Engelen wrote:
> On Tuesday, 12 July 2016 at 07:57:37 UTC, Johan Engelen wrote:
>> On Tuesday, 12 July 2016 at 02:27:04 UTC, deadalnix wrote:
>>>
>>> There was a very lenghty discussion about this in the past. DMD is
>>> correct on that one. The semantic is such as :
>>>
>>> int plusEqual(ref int a, int b) {
>>> a = a + b;
>>> return a;
>>> }
>>
>> Thanks.
>> Could this be added to the spec please?
>
> https://github.com/dlang/dlang.org/pull/1429
Great, thanks. I added a comment to that, which in turn caused a bug report. What does the community think? -- Andrei
|
July 12, 2016 Re: Evaluation order of "+=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to kink | On Tuesday, 12 July 2016 at 16:17:18 UTC, kink wrote:
> On Tuesday, 12 July 2016 at 02:27:04 UTC, deadalnix wrote:
>> There was a very lenghty discussion about this in the past. DMD is correct on that one.
>
> Great, so after that very lengthy discussion, why did nobody add a frigging test?! Argh.
For what it's worth, the test is in SDC's test suite.
|
July 12, 2016 Re: Evaluation order of "+=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Tuesday, 12 July 2016 at 18:44:44 UTC, deadalnix wrote:
> On Tuesday, 12 July 2016 at 16:17:18 UTC, kink wrote:
>> On Tuesday, 12 July 2016 at 02:27:04 UTC, deadalnix wrote:
>>> There was a very lenghty discussion about this in the past. DMD is correct on that one.
>>
>> Great, so after that very lengthy discussion, why did nobody add a frigging test?! Argh.
>
> For what it's worth, the test is in SDC's test suite.
Thanks for letting us know. I'll try to copy them.
|
July 12, 2016 Re: Evaluation order of "+=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On 12 July 2016 at 01:04, Johan Engelen via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> LDC recently changed the evaluation order of "+=" (I think unintentionally, some other eval order problems were fixed). Now, it is different from DMD. I am going to argue that I think DMD's order is more useful in the context of fibers, and would like your opinion.
>
When I said stabilize references, I meant references, not *all* side effects. :-)
Assuming that the last conversations I had with kinke are related to this.
|
July 13, 2016 Re: Evaluation order of "+=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On 12.07.2016 19:20, Andrei Alexandrescu wrote:
> On 7/12/16 5:15 AM, Johan Engelen wrote:
>> On Tuesday, 12 July 2016 at 07:57:37 UTC, Johan Engelen wrote:
>>> On Tuesday, 12 July 2016 at 02:27:04 UTC, deadalnix wrote:
>>>>
>>>> There was a very lenghty discussion about this in the past. DMD is
>>>> correct on that one. The semantic is such as :
>>>>
>>>> int plusEqual(ref int a, int b) {
>>>> a = a + b;
>>>> return a;
>>>> }
>>>
>>> Thanks.
>>> Could this be added to the spec please?
>>
>> https://github.com/dlang/dlang.org/pull/1429
>
> Great, thanks. I added a comment to that, which in turn caused a bug
> report. What does the community think? -- Andrei
int main() {
int sum=0;
int return1_add9tosum() {
sum += 9;
return 1;
}
sum += return1_add9tosum();
return sum;
}
pragma(msg, main()); // 1
|
July 13, 2016 Re: Evaluation order of "+=" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On 13 July 2016 at 07:20, Timon Gehr via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> On 12.07.2016 19:20, Andrei Alexandrescu wrote:
>>
>> On 7/12/16 5:15 AM, Johan Engelen wrote:
>>>
>>> On Tuesday, 12 July 2016 at 07:57:37 UTC, Johan Engelen wrote:
>>>>
>>>> On Tuesday, 12 July 2016 at 02:27:04 UTC, deadalnix wrote:
>>>>>
>>>>>
>>>>> There was a very lenghty discussion about this in the past. DMD is correct on that one. The semantic is such as :
>>>>>
>>>>> int plusEqual(ref int a, int b) {
>>>>> a = a + b;
>>>>> return a;
>>>>> }
>>>>
>>>>
>>>> Thanks.
>>>> Could this be added to the spec please?
>>>
>>>
>>> https://github.com/dlang/dlang.org/pull/1429
>>
>>
>> Great, thanks. I added a comment to that, which in turn caused a bug report. What does the community think? -- Andrei
>
>
> int main() {
> int sum=0;
>
> int return1_add9tosum() {
> sum += 9;
> return 1;
> }
> sum += return1_add9tosum();
> return sum;
> }
>
> pragma(msg, main()); // 1
>
I see you've found more cases where runtime and ctfe do things differently. ;-)
|
Copyright © 1999-2021 by the D Language Foundation