file and debug info all in one place?

Amex Amex at gmail.com
Sun May 26 17:46:07 UTC 2019


On Sunday, 26 May 2019 at 02:06:21 UTC, Exil wrote:
> On Saturday, 25 May 2019 at 19:29:25 UTC, Amex wrote:
>> __FILE__, __LINE__, etc...
>>
>> we have to use these as template parameters
>>
>> Why not just make every function have this info available in a 
>> "hidden" struct? No need to mess around with any extra 
>> bloating of the function signature.
>
> Not really sure what you mean, but you don't need to use 
> templates for this. You can just pass the parameters in through 
> the function parameters instead. No template bloat.
>
> Assuming you want to know the values of those variables at the 
> call site then that would be bad anyways. As now every function 
> would have to pass this extra meta data. The function name, 
> line of code, name of the module, basically all of it will need 
> to be stored in this hidden struct and passed even when it 
> might never even be used. Otherwise it would just complicate 
> when you do or don't need to pass the struct. It's better as it 
> is now, you only pay for it when you need it.

No, it wouldn't... you don't have to do this now. You are simply 
adding template parameters to your functions only to get compiler 
information. There is no point in doing that. The compiler can 
easily fill out all that information silently and do...

And you don't have to pay for it when not using it... if you 
don't reference the struct then it doesn't need to be generated.



More information about the Digitalmars-d mailing list