Re: Nested delegates and closure allocations

2024-01-17 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 January 2024 at 17:21:12 UTC, FeepingCreature wrote: Correct. [...] Thanks, I think I understand.

Re: Nested delegates and closure allocations

2024-01-16 Thread FeepingCreature via Digitalmars-d-learn
On Tuesday, 16 January 2024 at 15:39:07 UTC, Anonymouse wrote: If I make a `scope` variable of the delegate and pass *it* to `receiveTimeout`, there no longer seems to be any mention of the closure in the error (given 2.092 or later). ```d void foo(Thing thing) @nogc { void

Re: Nested delegates and closure allocations

2024-01-16 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 16 January 2024 at 13:45:22 UTC, FeepingCreature wrote: Am I safe as long as I don't do something like, pass `` as an argument to `std.concurrency.receive`? Yes. Thank you. And to make sure I don't misunderstand the spec; in the case I *do* have a delegate I want to pass

Re: Nested delegates and closure allocations

2024-01-16 Thread FeepingCreature via Digitalmars-d-learn
On Tuesday, 16 January 2024 at 10:56:58 UTC, Anonymouse wrote: I'm increasingly using nested delegates to partition code. ```d void foo(Thing thing) { void sendThing(const string where, int i) { send(thing, where, i); } sendThing("bar", 42); } ``` ... 3. Those

Nested delegates and closure allocations

2024-01-16 Thread Anonymouse via Digitalmars-d-learn
I'm increasingly using nested delegates to partition code. ```d void foo(Thing thing) { void sendThing(const string where, int i) { send(thing, where, i); } sendThing("bar", 42); } ``` ...where the nested `sendThing` sometimes returns something, sometimes doesn't.