RFC: 2 enhancement DIPs that need feedback
Basile B.
b2.temp at gmx.com
Tue May 13 09:04:07 UTC 2025
On Monday, 12 May 2025 at 23:29:36 UTC, Meta wrote:
> On Monday, 12 May 2025 at 23:23:27 UTC, Monkyyy wrote:
>> On Monday, 12 May 2025 at 23:13:23 UTC, Meta wrote:
>>> Hello, I've been working on a couple different DIPs that
>>> propose various enhancements to D.
>>>
>>> [...]
>>
>> I think dip 2 is far more important, dip 1 has work arounds
>> and I dislike the complexity around constructors as is
>
> Please leave your feedback in the respective threads I linked.
> Thank you!
I'll drop a comment here anyway because it doesn't fit to the DIP
section I think.
D really needs "variable declaration" as expressions. My opinion
is that here you are again faced to a special case that the
general case, i.e "variable declaration" as expression, would
have solved.
```d
(auto a, auto b) = call(); // two VarDeclExp in the LHS
```
Let me enumerate all the cases we have now. You can exceptionally
declare variable as expression in
- the IfStatement
- the WithStatement
- the WhileStatement
- the SwitchStatement
and now what is proposed is another case: as tuple element.
Cant just people open their eyes ? That language construct tends
to become a well defined expression.
A little joke to finish, I occasionally use that thing to count
if something new is worth:
```d
printf("for the %dnth time\n", static int count++);
```
Yeah that kind of things work when you have "variable
declaration" as expression.
More information about the Digitalmars-d
mailing list