Passing delegate indirectly to createLowLevelThread doesn't work

Tejas notrealemail at gmail.com
Mon Jul 26 17:32:55 UTC 2021


On Monday, 26 July 2021 at 17:21:04 UTC, Adam D Ruppe wrote:
> On Monday, 26 July 2021 at 17:14:45 UTC, Tejas wrote:
>> Yeah after reading the error diagnostics carefully I realized 
>> that the compiler is inferring many attributes when passing 
>> ```func``` directly but not when passing via delegate
>
> Well, technically, it is inferred there too, but since you 
> specified `void delegate()` it implicitly casts to that and 
> drops the detail.
>
> Similar to the difference between like
>
> Object o = new MyClass;
> // now o is still Object since the class implicitly casted and 
> thus drops the extensions in the child class
>
> and
>
> auto c = new MyClass;
> // no conversion requested there, c has the full type of MyClass

Thank you very much for further explaining this :D


More information about the Digitalmars-d-learn mailing list