May I introduce `lazy with`?

Steven Schveighoffer schveiguy at gmail.com
Fri Nov 25 21:25:51 UTC 2022


On 11/25/22 3:58 AM, Quirin Schroll wrote:
> Steven’s claims are based on what the spec [Statement § With 
> Statement](https://dlang.org/spec/statement.html#with-statement) says 
> what should happen:
>>  Within the with body the referenced object is searched first for 
>> identifier symbols.
> 
> And a little later:
>> Use of `with` object symbols that shadow local symbols with the same 
>> identifier are not allowed.
> 
> So, Steven seemingly didn’t test and read the spec section completely 
> and the compiler has a bug: The `static foreach` is the greedy one here 
> and `with` never gets to see `member` as a plain identifier.

I can't test what doesn't exist. The post I responded to relates to a 
proposal for `with` that automatically uses it for the case statements.

See here: https://forum.dlang.org/post/tlb8a4$1m2k$1@digitalmars.com

I also assume that Timon has worked through the problem correctly. In 
any case, my goal was to try and shed some light on what Timon was 
getting at, which Walter seemed not to be understanding.

-Steve


More information about the Digitalmars-d mailing list