On Wednesday, 26 August 2020 at 15:57:37 UTC, Cecil Ward wrote:
Ah! That’s the vital missing piece - I didn’t realise it was
like a template - I just thought it was an ordinary plain
anonymous function, not a generic. All makes sense now.
Fun fact: you can see the "de-sugared" version of
On Monday, 17 August 2020 at 04:30:08 UTC, H. S. Teoh wrote:
On Mon, Aug 17, 2020 at 12:20:24AM +, Cecil Ward via
Digitalmars-d-learn wrote:
In a lambda, how do we know what types the arguments are? In
something
like
(x) => x * x
It's implemented as a template, whose argument types
On Mon, Aug 17, 2020 at 12:20:24AM +, Cecil Ward via Digitalmars-d-learn
wrote:
> In a lambda, how do we know what types the arguments are? In something
> like
> (x) => x * x
It's implemented as a template, whose argument types are inferred based
on usage context.
> - there I just
On 8/16/20 8:27 PM, Adam D. Ruppe wrote:
On Monday, 17 August 2020 at 00:20:24 UTC, Cecil Ward wrote:
In a lambda, how do we know what types the arguments are? In something
like
(x) => x * x
In that the compiler figures it out from usage context. So if you pass
it to a int
On Monday, 17 August 2020 at 00:20:24 UTC, Cecil Ward wrote:
In a lambda, how do we know what types the arguments are? In
something like
(x) => x * x
In that the compiler figures it out from usage context. So if you
pass it to a int delegate(int), it will figure x must be int.
- there
In a lambda, how do we know what types the arguments are? In
something like
(x) => x * x
- there I just don’t get it at all. Can you write
(uint x) => x * x
I’m lost.
Cecil Ward.