[dmd-internals] Type mangling for deduced attributes

Don Clugston dclugston at googlemail.com
Thu Nov 17 01:57:30 PST 2011


On 17 November 2011 09:03, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Thursday, November 17, 2011 07:51:24 Rainer Schuetze wrote:
>> On 16.11.2011 15:35, Steve Schveighoffer wrote:
>> > Take this argument with a grain of salt, I have very little internal
>> > dmd knowledge.  But...
>> >
>> > Isn't deduction of pure/nothrow/safe restricted to templates?  Don't
>> > templates *require* availability of source?
>> >
>> > Just saying...
>> >
>> > -Steve
>>
>> I think it would be an unexpected restricton to limit pure/nothrow/safe
>> inference to templates. But if it is not, using di files instead of d
>> files will break code because inference very much depends on whether the
>> di-file generation emitted the code or not. Adding inferred attributes
>> to  the function declarations could help but it currently changes the
>> name mangling, breaking it again.
>
> It's _already_ restricted to templates and delegates. You _need_ it for
> templates, since whether they can be pure, nothrow, or @safe depends on their
> arguments, and the only way to do that without inference is to duplicate the
> template a bunch of times with each possible combination of pur,e nothrow, and
> @safe. Normal functions, however, do _not_ need the inference. Whether they
> can be pure, nothrow, or @safe doesn't change unless you change according to
> their arguments.
>
> In any case, I don't quite understand how this is an issue, since as Steve
> says, templates _require_ that their source be available.

Inference doesn't apply only to templates. It applies also to
delegate/function literals, and to function pointers.


More information about the dmd-internals mailing list