2011/11/17 Don Clugston <[email protected]>:
> On 17 November 2011 11:09, kenji hara <[email protected]> wrote:
>> Withdraw a previous statement, I still argue that is better to apply
>> result of inference into mangleof.
>> First of all, the pure/safe/nothrow inference runs against only
>> function literals and template functions.
>
> This is true at present. But are we confident that it will never apply
> to anything else?
>
>> For function literal, its
>> type determines in the place its written.For template function, its
>> type determines in its instantiation.Both of cases can always see
>> their function bodies.
>
> Are we happy to say that when full type inference is used, it does NOT
> invoke safe/pure/nothrow inference?
Template function instantiation and function literal type inference
always also invoke attribute inference.
They are inseparable.
> immutable fptr = &foo!(7);
> immutable fptr2 = (){ return 0; }
>
> That is, both fptr and fptr2 will always be impure, @system, and throw?
> Or does it invoke safe/pure/nothrow inference? In which case the
> situation I mentioned arises.
Maybe you are worried about breaking pure/safe/nothrow-ness silently,
but it does not happen.
Because AutoDeclaration always invoke the semantics of its
initializer, just for its type inference.
Then, in types of fptr and fptr2, function type attributes should
always be inferred based on their initializers.
(I know bug 6963, current dmd does not invoke attribute inference of
declaration in module level.)
Through semantic processing over the modules, types and attributes are
always guaranteed.
Kenji Hara
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals