Tsoding - How Not to Market Your Language Features
Derek Fawcus
dfawcus+dlang at employees.org
Wed Apr 2 20:15:43 UTC 2025
On Wednesday, 2 April 2025 at 17:34:11 UTC, Walter Bright wrote:
> On 4/2/2025 8:16 AM, Timon Gehr wrote:
>> Can you show the code that you mean or give a more accurate
>> time stamp? I only see the _delegate's_ parameter `i` at
>> 1:19:41, which does not lead to shadowing, as the only actual
>> parameter in scope within `opApply` is `dg`.
>
> The foreach of an opapply is rewritten by dmd into a delegate.
> If the shadowing is not detected, this would be why.
>
> I actually regret this design. It's overly complex, and I
> always have to look up how to write an opApply function.
>
> It could be done with ranges, if the ranges internally
> implemented some sort of stack.
Other than the perceived complexity, is there any other issue
with the approach?
It actually struck me as reasonably sensible. Interestingly, the
Go maintainers essentially took the same approach to generalizing
their "for ... range" mechanism.
More information about the Digitalmars-d
mailing list