http://d.puremagic.com/issues/show_bug.cgi?id=10008
--- Comment #3 from Kenji Hara <[email protected]> 2013-04-29 17:26:09 PDT --- (In reply to comment #2) > OK, this explains why function from templated struct is deduced to have all > attributes. But this tells nothing about another case. I understand that Z.foo > is not required to be @safe/pure/nothrow because it isn't marked as such, but > on the other hand S.foo() is also not marked and clearly there is > contradiction > here. Short answer is that it is just same as the difference between: void foo() {} and void bar()() {} Both don't have attributes explicitly, but bar would be inferred to @safe/pure/nothrow when it is instantiated. --- There is an essential difference between template functions and non-template ones. For the former, the actual function attributes of instantiated code is not pre-deterministic. Ultimately, it would depend on the arguments which is given on the template parameters. Attribute inference for the instantiated functions is necessary for making function attributes more convenient. On the other hand, the functions out of the template declaration should be "as is". You can hide the function body in the library file for the separate compilation, and just only declaring function signatures in di file. Therefore, we cannot/should not apply attribute inference for normal functions. The contradiction you feel comes from the essential difference that I described in above. Thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
