Phobos: __FILE__ as template default parameter

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 20 01:10:19 PDT 2016


On 06/20/2016 01:13 AM, Johan Engelen wrote:
> On Sunday, 19 June 2016 at 21:40:20 UTC, David Nadlinger wrote:
>> On Sunday, 19 June 2016 at 21:13:00 UTC, Johan Engelen wrote:
>>> On Sunday, 19 June 2016 at 21:11:59 UTC, Johan Engelen wrote:
>>>> (I think we can pretty much inline anything the user throws at us)
>>>
>>> (as long as it is not a naked asm function)
>>
>> Another example is `alloca`, which you might not want to inline.
> 
> And also variadic functions, for which Dicebot needs __FILE__ to be a
> template param..............

It is template-based variadic list though in all Phobos cases. This is
one of logger examples I was referring to :
https://github.com/dlang/phobos/blob/master/std/experimental/logger/core.d#L202-L216

How about defining semantics like "try inlining if possible, fallback to
always emitting symbol to object file otherwise"? That would also allow
compatible implementation in dmd.

My reasoning for proposing that is that for all legitimate cases I'd
have to use __FILE__ as a template argument I'd also want the symbol
inlined to prevent the bloat. After all CT computation such functions
tend to contain 1-2 lines of runtime code only.


More information about the Digitalmars-d mailing list