September 24, 2019 Re: We need something like source_location in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Tuesday, 24 September 2019 at 11:32:03 UTC, Jacob Carlborg wrote:
> On Tuesday, 24 September 2019 at 10:36:53 UTC, guy hebert wrote:
>
>> Have you got the solution.
>
> A __traits has been implemented: https://dlang.org/changelog/2.088.0.html#getloc
>
> --
> /Jacob Carlborg
Does that solve the issue?
can it stand in for the caller location?
|
September 25, 2019 Re: We need something like source_location in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefan Koch | On Tuesday, 24 September 2019 at 15:15:22 UTC, Stefan Koch wrote: > On Tuesday, 24 September 2019 at 11:32:03 UTC, Jacob Carlborg wrote: >> On Tuesday, 24 September 2019 at 10:36:53 UTC, guy hebert wrote: >> >>> Have you got the solution. >> >> A __traits has been implemented: https://dlang.org/changelog/2.088.0.html#getloc >> >> -- >> /Jacob Carlborg > > Does that solve the issue? > can it stand in for the caller location? No - how would you get the caller symbol? It's completely useless for this purpose. Personally I use Fence _ = Fence(), string file = __FILE__, size_t line = __LINE__, but that's obviously awkward in that it's not composable. Other things that don't work: void foo(Loc loc = Loc(__FILE__, __LINE__)), because __FILE__ and __LINE__ are substituted by explicitly checking whether the default value *is that symbol*. They cannot be composed. That's why we do need something like __LOCATION__. PS: You should ignore anyone on the topic unless they're linking a run.dlang.io with working code. PPS: https://run.dlang.io/is/B5eK59 |
September 26, 2019 Re: We need something like source_location in D | ||||
---|---|---|---|---|
| ||||
Posted in reply to FeepingCreature | On Wednesday, 25 September 2019 at 07:16:21 UTC, FeepingCreature wrote:
> On Tuesday, 24 September 2019 at 15:15:22 UTC, Stefan Koch wrote:
>> On Tuesday, 24 September 2019 at 11:32:03 UTC, Jacob Carlborg wrote:
>>> On Tuesday, 24 September 2019 at 10:36:53 UTC, guy hebert wrote:
>>>
>>>> Have you got the solution.
>>>
>>> A __traits has been implemented: https://dlang.org/changelog/2.088.0.html#getloc
>>>
>>> --
>>> /Jacob Carlborg
>>
>> Does that solve the issue?
>> can it stand in for the caller location?
>
> No - how would you get the caller symbol? It's completely useless for this purpose
Sigh. I expected as much.
Let's get a proper built-in location struct please.
|
Copyright © 1999-2021 by the D Language Foundation