June 25, 2018
On Sunday, 24 June 2018 at 23:08:15 UTC, aliak wrote:
> On Sunday, 24 June 2018 at 11:27:12 UTC, Basile B. wrote:
>> On Saturday, 23 June 2018 at 06:24:29 UTC, Basile B. wrote:
>>> On Saturday, 23 June 2018 at 06:18:53 UTC, user1234 wrote:
>>>> On Saturday, 23 June 2018 at 05:09:13 UTC, aedt wrote:
>>>>> On Saturday, 23 June 2018 at 04:45:07 UTC, user1234 wrote:
>>>>>> [...]
>>>>>
>>>>> Same thing as the following"
>>>>> return a && b;
>>>>>
>>>>> I'm not saying to drop parens completely, I'm saying why is it not optional. D seems to have no problem with x.to!string or std.lines
>>>>
>>>> I agree that this would be in adequation with certain stuff of the D syntax, such as parens-less single template parameter. Someone has to make a DIP for this
>>>
>>> Maybe but this is a simple parser thing. For example after reading the discussion here i have tested the idea in my toy programming language (https://github.com/BBasile/styx/commit/83c96d8a789aa82f9bed254ab342ffc4aed4fd88) and i believe that for D this would be as simple ( < 20 SLOC, w/o the tests).
>>>
>>>> otherwise we're good for one of this sterile NG discussion leading to nothing, i.e intellectual mast... well guess the word.
>>>
>>> I'm tempted to try this in DMDFE. Change is simple enough so that if it get rejected no much time is lost.
>>
>> FYI this works fine, as expected it's just some small parser changes.
>> I didn't touch to for and foreach for now. I think that SwitchStatement is a candidate too.
>>
>> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d
>>
>> However note that there's a nice thing with the phobos style that won't be that nice anymore:
>>
>> if (condition)
>>     action();
>> ----^
>>
>> if condition)
>>     action();
>> ---^
>> ----^
>>
>> It's not nicely aligned anymore !
>
> Wow nice, that was quick, would it be much more to make it so that braces are required with if statements that do not start with an open paren?

It's in the commit.


June 25, 2018
On Monday, 25 June 2018 at 10:36:46 UTC, Basile B. wrote:
> On Sunday, 24 June 2018 at 23:08:15 UTC, aliak wrote:
>> On Sunday, 24 June 2018 at 11:27:12 UTC, Basile B. wrote:
>>> On Saturday, 23 June 2018 at 06:24:29 UTC, Basile B. wrote:
>>>> On Saturday, 23 June 2018 at 06:18:53 UTC, user1234 wrote:
>>>>> On Saturday, 23 June 2018 at 05:09:13 UTC, aedt wrote:
>>>>>> On Saturday, 23 June 2018 at 04:45:07 UTC, user1234 wrote:
>>>>>>> [...]
>>>>>>
>>>>>> Same thing as the following"
>>>>>> return a && b;
>>>>>>
>>>>>> I'm not saying to drop parens completely, I'm saying why is it not optional. D seems to have no problem with x.to!string or std.lines
>>>>>
>>>>> I agree that this would be in adequation with certain stuff of the D syntax, such as parens-less single template parameter. Someone has to make a DIP for this
>>>>
>>>> Maybe but this is a simple parser thing. For example after reading the discussion here i have tested the idea in my toy programming language (https://github.com/BBasile/styx/commit/83c96d8a789aa82f9bed254ab342ffc4aed4fd88) and i believe that for D this would be as simple ( < 20 SLOC, w/o the tests).
>>>>
>>>>> otherwise we're good for one of this sterile NG discussion leading to nothing, i.e intellectual mast... well guess the word.
>>>>
>>>> I'm tempted to try this in DMDFE. Change is simple enough so that if it get rejected no much time is lost.
>>>
>>> FYI this works fine, as expected it's just some small parser changes.
>>> I didn't touch to for and foreach for now. I think that SwitchStatement is a candidate too.
>>>
>>> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d
>>>
>>> However note that there's a nice thing with the phobos style that won't be that nice anymore:
>>>
>>> if (condition)
>>>     action();
>>> ----^
>>>
>>> if condition)
>>>     action();
>>> ---^
>>> ----^
>>>
>>> It's not nicely aligned anymore !
>>
>> Wow nice, that was quick, would it be much more to make it so that braces are required with if statements that do not start with an open paren?
>
> It's in the commit.

https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d#diff-cd066d37445cac534313c0137c2d4bbeR5599
June 25, 2018
On Monday, 25 June 2018 at 10:38:49 UTC, Basile B. wrote:
> On Monday, 25 June 2018 at 10:36:46 UTC, Basile B. wrote:
>> On Sunday, 24 June 2018 at 23:08:15 UTC, aliak wrote:
>>>
>>> Wow nice, that was quick, would it be much more to make it so that braces are required with if statements that do not start with an open paren?
>>
>> It's in the commit.
>
> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d#diff-cd066d37445cac534313c0137c2d4bbeR5599

Indeed! Totally missed that! PR Itttt!!! :D
July 01, 2018
On Sunday, 24 June 2018 at 23:40:56 UTC, Timoses wrote:
> The others may be rewritten to not have a leading "!" as well, e.g.
>
>> if (!(t1.ty == Tarray && t2.ty == Tarray && needsDirectEq(t1, t2))
>
> if (t1.ty != Tarray || t2.ty != Tarray || ...)

Yes, but you might make a mistake, and sometimes it makes more intuitive sense to read it in a non-minimized form. This type of change is also much harder to review. Consider why the change got checked into dmd, without it being minimized at the time or in a later pull.

C# supports `if !(`.
July 02, 2018
On Monday, 25 June 2018 at 12:19:15 UTC, aliak wrote:
> On Monday, 25 June 2018 at 10:38:49 UTC, Basile B. wrote:
>> On Monday, 25 June 2018 at 10:36:46 UTC, Basile B. wrote:
>>> On Sunday, 24 June 2018 at 23:08:15 UTC, aliak wrote:
>>>>
>>>> Wow nice, that was quick, would it be much more to make it so that braces are required with if statements that do not start with an open paren?
>>>
>>> It's in the commit.
>>
>> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d#diff-cd066d37445cac534313c0137c2d4bbeR5599
>
> Indeed! Totally missed that! PR Itttt!!! :D

What i would make if i was a new comer. Language changes must be formally specified with a DIP. I don't especially want to write it but if one of the of the paren-less statements 'partisan' wants to then you can count on me if at a time an  implementation is required (even as demo in a first time).
July 02, 2018
On Sunday, 1 July 2018 at 12:02:03 UTC, Nick Treleaven wrote:
> On Sunday, 24 June 2018 at 23:40:56 UTC, Timoses wrote:
>> The others may be rewritten to not have a leading "!" as well, e.g.
>>
>>> if (!(t1.ty == Tarray && t2.ty == Tarray && needsDirectEq(t1, t2))
>>
>> if (t1.ty != Tarray || t2.ty != Tarray || ...)
>
> Yes, but you might make a mistake, and sometimes it makes more intuitive sense to read it in a non-minimized form. This type of change is also much harder to review. Consider why the change got checked into dmd, without it being minimized at the time or in a later pull.
>
> C# supports `if !(`.

and it wouldn't be hard for D to support it too: https://github.com/dlang/dmd/pull/8440
It just requires someone to step up and write the DIP.
July 04, 2018
On Saturday, 23 June 2018 at 04:45:07 UTC, user1234 wrote:
> There is this case that requires parens:
>
>     if a && b c;
>
> Is there a missing && or not ? It seems obvious for a human but compiler parsers are "apparatchiks", i.e rules are rules. That being said this would work by allowing parens for disambiguation.

Why not just require either parens or brackets?
July 04, 2018
On Monday, 2 July 2018 at 20:28:06 UTC, Seb wrote:
> On Sunday, 1 July 2018 at 12:02:03 UTC, Nick Treleaven wrote:
>> On Sunday, 24 June 2018 at 23:40:56 UTC, Timoses wrote:
>>> The others may be rewritten to not have a leading "!" as well, e.g.
>>>
>>>> if (!(t1.ty == Tarray && t2.ty == Tarray && needsDirectEq(t1, t2))
>>>
>>> if (t1.ty != Tarray || t2.ty != Tarray || ...)
>>
>> Yes, but you might make a mistake, and sometimes it makes more intuitive sense to read it in a non-minimized form. This type of change is also much harder to review. Consider why the change got checked into dmd, without it being minimized at the time or in a later pull.
>>
>> C# supports `if !(`.
>
> and it wouldn't be hard for D to support it too: https://github.com/dlang/dmd/pull/8440
> It just requires someone to step up and write the DIP.

Since ! is used to pass template params... I'd rather use it for parameterized keywords in the same way, for instance:

if!likely(...)
if!unlikely(...)

It would standardize the existing practice of "__builtin_expect".
Also it you really wanted, you could add something like:

if!not(...)


July 04, 2018
On 24.06.2018 13:27, Basile B. wrote:
> 
> FYI this works fine, as expected it's just some small parser changes.
> I didn't touch to for and foreach for now. I think that SwitchStatement is a candidate too.
> 
> https://github.com/BBasile/dmd/commit/5455a65c8fdee5a6d198782d1f168906b59e6d3d

if (a+b)*c == d { ... }
July 05, 2018
On Wednesday, 4 July 2018 at 14:37:49 UTC, Timon Gehr wrote:
> if (a+b)*c == d { ... }

Error: found `{` when expecting `;` following statement

Adding the semi-colon, `*c == d;` would likely cause:
Error: `*c == d` has no effect

Also multiplying (a+b) by a pointer is illegal, and c is probably a pointer if it can be dereferenced. In theory a UDT could define opUnary!"*" and opBinary!"*", is that likely?