Let's get the semantic around closure fixed.
deadalnix
deadalnix at gmail.com
Wed May 19 23:38:39 UTC 2021
On Wednesday, 19 May 2021 at 20:56:10 UTC, Paul Backus wrote:
> On Wednesday, 19 May 2021 at 19:01:59 UTC, Walter Bright wrote:
>> Languages like D also need to be useful, not just correct.
>> Having a hidden allocation per loop will be completely
>> unexpected for such a simple looking loop for a lot of people.
>> That includes pretty much all of *us*, too.
>
> If closures causing "hidden" allocations is problematic, from a
> language-design perspective, then it's problematic whether it
> occurs inside a loop or not. Either we should (a) deprecate and
> remove GC-allocated closures entirely, or (b) make them work
> correctly in all cases.
>
>> It's best to just return a compile error for such cases rather
>> than go to very expensive efforts to make every combination of
>> features work.
>
> This is the worst of both worlds: we still pay the price of
> having "hidden" allocations in our code, but we do not even get
> the benefit of having properly-implemented closures in return.
I couldn't have phrased this better.
Thanks.
More information about the Digitalmars-d
mailing list