delegates/lambas do not pick up calling convention

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 9 18:18:42 PDT 2017


On 8/9/17 7:52 PM, Johnson Jones wrote:
> given somethign like Threads.threadsAddIdle
> 
> which takes an extern(C) int (void*)
> 
> we can't seem to do
> 
> threadsAddIdle((void*) { }, null);

Because D tries to avoid situations where the type depends on the usage. 
The implied type is based solely on the expression (in most cases, there 
are a few cases where it is affected by usage).

FYI I also code in swift, and I run into situations all the time where 
the compiler can't figure out types for a statement because it hits some 
weird corner case that causes too much recursion in the compiler. In 
those cases, the compiler says "please split up your statement into 
multiple lines". So I'm kind of glad D doesn't go this route, as nice as 
it is conceptually.

-Steve


More information about the Digitalmars-d-learn mailing list