[DIP1000] Something I don't quite understand regarding 'scope'

Stanislav Blinov stanislav.blinov at gmail.com
Mon Jun 29 12:12:47 UTC 2020


On Monday, 29 June 2020 at 06:21:43 UTC, ag0aep6g wrote:

> Since `local` and `writeln` are templates, the attributes for 
> their parameters are inferred from their bodies. `local!(int*)` 
> doesn't do anything with the parameter, so it's inferred as 
> `scope`. `writeln!(int*)` apparently does something that 
> prevents `scope` from being inferred.

Thanks. It would appear indeed that inference fails for some 
reason. Explicitly marking args as 'scope' for `writeln` and 
`File.write` lets them compile. I wonder if there's a way to find 
exactly what it is in either of those that prevents the compiler 
from inferring 'scope'.


More information about the Digitalmars-d-learn mailing list