On Tuesday, 13 May 2025 at 09:04:07 UTC, Basile B. wrote:
>(auto a, auto b) = call(); // two VarDeclExp in the LHS
Please no... If we can't have auto (a, b) = call();
then we better not have it at all...
May 20 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Tuesday, 13 May 2025 at 09:04:07 UTC, Basile B. wrote: >
Please no... If we can't have |
May 20 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dejan Lekic | On Tuesday, 20 May 2025 at 09:33:40 UTC, Dejan Lekic wrote: >On Tuesday, 13 May 2025 at 09:04:07 UTC, Basile B. wrote: >
Please no... If we can't have Why not allow both? |
May 20 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to jmh530 | On 5/20/25 11:59, jmh530 wrote:
> On Tuesday, 20 May 2025 at 09:33:40 UTC, Dejan Lekic wrote:
>> On Tuesday, 13 May 2025 at 09:04:07 UTC, Basile B. wrote:
>>>
>>> ```d
>>> (auto a, auto b) = call(); // two VarDeclExp in the LHS
>>> ```
>>
>> Please no... If we can't have `auto (a, b) = call();` then we better not have it at all...
>
> Why not allow both?
>
>
Both variants work with the design proposed in the DIP, but Basile's alternative proposal by default would allow at most one of these, which is what Dejan was objecting to.
|
May 20 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timon Gehr | On 5/14/2025 9:56 AM, Timon Gehr wrote:
> Go ahead and implement it. It's harder, not a simplification. Suddenly, whenever you are parsing any expression, you will have to take into account the possibility that it is actually a variable declaration. The way DMD deals with lvalues is also ill-equipped to allow this to be added easily. Furthermore, you now have to do proper scope handling for short-circuiting operations.
There's also a problem with handling destruction of the declaration.
|
May 22 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Wednesday, 21 May 2025 at 04:55:50 UTC, Walter Bright wrote: >On 5/14/2025 9:56 AM, Timon Gehr wrote: >Go ahead and implement it. It's harder, not a simplification. Suddenly, whenever you are parsing any expression, you will have to take into account the possibility that it is actually a variable declaration. The way DMD deals with lvalues is also ill-equipped to allow this to be added easily. Furthermore, you now have to do proper scope handling for short-circuiting operations. There's also a problem with handling destruction of the declaration. I dont think so. I consider that, based on default initialization, which has to always happen, even if an AndAnd LHS has evaluated to true and then that the RHS is a VarDeclExp, then its matching variable is always destructible. To be clear the AST for
is to be thought as
In practice that scenario almost never happen, since VarDeclExp are 99% of the time used for pointers or simple numeric types. |
May 23 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Thursday, 22 May 2025 at 09:31:51 UTC, Basile B. wrote: >On Wednesday, 21 May 2025 at 04:55:50 UTC, Walter Bright wrote: >On 5/14/2025 9:56 AM, Timon Gehr wrote: >Go ahead and implement it. It's harder, not a simplification. Suddenly, whenever you are parsing any expression, you will have to take into account the possibility that it is actually a variable declaration. The way DMD deals with lvalues is also ill-equipped to allow this to be added easily. Furthermore, you now have to do proper scope handling for short-circuiting operations. There's also a problem with handling destruction of the declaration. I dont think so. I consider that, based on default initialization, which has to always happen, even if an AndAnd OrOr >LHS has evaluated to true and then that the RHS is a VarDeclExp, then its matching variable is always destructible. To be clear the AST for
is to be thought as
>
}
plus do people often use |
May 23 Re: RFC: 2 enhancement DIPs that need feedback | ||||
---|---|---|---|---|
| ||||
Posted in reply to Basile B. | On Friday, 23 May 2025 at 07:15:05 UTC, Basile B. wrote: >plus do people often use Yes, because any "if(x)" is lowered to "if(x.opCast!bool)" for all custom types. Same for every occurence of !x, loweredto !(x.opCast!bool). |