We need something like source_location in D

FeepingCreature feepingcreature at gmail.com
Wed Jul 31 06:27:10 UTC 2019


On Wednesday, 31 July 2019 at 03:54:13 UTC, Nicholas Wilson wrote:
> On Wednesday, 31 July 2019 at 01:39:05 UTC, Andrej Mitrovic
>> I know __traits(getLocation) got implemented recently, but 
>> it's not very useful in this context because it returns a 
>> tuple (https://github.com/dlang/dmd/pull/10013). I don't see 
>> an easy way to use it in function parameters.
>
> It returning a tuple is not the problem because they auto 
> expand :
>

Making it a struct would be beneficial for another reason: the 
two members of the tuple are string and int. Since we're abusing 
default parameters here, note that those are both really common 
types that are very easy to pass accidentally. A dedicated data 
type avoids this issue.



More information about the Digitalmars-d mailing list