Phobos: __FILE__ as template default parameter
Johan Engelen via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 19 14:11:59 PDT 2016
On Sunday, 19 June 2016 at 20:37:02 UTC, Dicebot wrote:
> On 06/19/2016 11:33 AM, Johan Engelen wrote:
>> On Sunday, 19 June 2016 at 08:06:09 UTC, Dicebot wrote:
>>> This important feature and can't be simply removed. For
>>> example, std.experimental.logger also relies on it.
>>
>> Do you mean it relies on __FILE__ being a template parameter
>> (instead of a runtime default parameter, like enforce)?
>>
>>> It needs to be fixed instead.
>>>
>>> Two immediate workarounds that come to mmy mind:
>>>
>>> 1. Make __FILE__ relative to import path
>>> 2. Always emit new symbol to object file if __FILE__ is
>>> involved
>>
>> I also thought about 2. It would fix the second (non-Phobos)
>> example.
>>
>> -Johan
>
> Another option would be to treat functions relying on __FILE__
> as template argument as force inline ones.
Yes, but it's a flaky solution I think.
For LDC that would work (I think we can pretty much inline
anything the user throws at us). I don't know about DMD.
More information about the Digitalmars-d
mailing list