Variable declaration primary expression
Andre
andre at s-e-a-p.de
Tue Jan 21 16:59:12 UTC 2025
On Monday, 20 January 2025 at 20:41:42 UTC, IchorDev wrote:
> Someone brought up this clever idea here:
> https://github.com/dlang/dmd/pull/20653#issuecomment-2581474608
> What does everyone think about being able to declare variables
> in expressions? Is there any pre-existing syntax that blocks us
> from being able to easily do this?
If I understand it correctly this would solve my issue
https://github.com/dlang/dmd/issues/18890
```d
with (auto p = new Panel())
{
parent = this;
text = "bla";
with (new Button())
{
parent = p; // Here p is needed
text = "bla2";
}
}
```
The syntax `with (auto p = new Panel())` is currently not allowed.
More information about the dip.ideas
mailing list