Thread overview
UFC creating name conflict
Oct 09, 2021
Chris Piker
Oct 09, 2021
Paul Backus
Oct 09, 2021
Chris Piker
October 09, 2021

Hi D

I have and old C structure that I have to wrap that has a member named '.seconds', and in the module that handles this I also have conversion functions to go from an internal time representation to struct SysTime values.

Unfortunately importing core.time brings in a seconds function, which due to UFC is confused with a structure member of the same name.

How can I explicitly tell the compiler that I'm referring to:

thing.seconds  # The structure member

and not

seconds(thing) # the function

?

Currently my code fails to compile due do this ambiguity.

Thanks for any advice you can give. My google searches with the qualifier site:dlang.org weren't turning up any hits.

October 09, 2021

On Saturday, 9 October 2021 at 21:26:52 UTC, Chris Piker wrote:

>

Unfortunately importing core.time brings in a seconds function, which due to UFC is confused with a structure member of the same name.

How can I explicitly tell the compiler that I'm referring to:

thing.seconds  # The structure member

and not

seconds(thing) # the function

?

Currently my code fails to compile due do this ambiguity.

A struct member always takes priority over a UFCS function, so there must be something else going on that you've left out of your explanation. Can you post a complete example that we can use to reproduce your issue?

October 09, 2021

On Saturday, 9 October 2021 at 21:37:27 UTC, Paul Backus wrote:

>

On Saturday, 9 October 2021 at 21:26:52 UTC, Chris Piker wrote:

>

A struct member always takes priority over a UFCS function, so there must be something else going on that you've left out of your explanation. Can you post a complete example that we can use to reproduce your issue?

Ah. That's good to know, and comforting.

Turns out this was an embarrassingly hasty post on my part. I was going by memory on the struct names and was just plain wrong. Struct member was .second not .seconds. The fact that I didn't get a "no member named seconds..." style error confused me for a bit.

Problem solved. Thanks for the quick response,