Re: How can overloads be distinguished on attributes alone?

2023-08-01 Thread Quirin Schroll via Digitalmars-d-learn
while it may very well be possible to do something along the lines of what you're looking for, I strongly suspect that it's simply not worth it. You might have gotten me wrong. I don’t want to do something with it, I wondered if overloading based on attributes is a thing one has to con

Re: How can overloads be distinguished on attributes alone?

2023-07-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, July 31, 2023 4:55:44 AM MDT Quirin Schroll via Digitalmars-d-learn wrote: > Apparently, functions can be overloaded solely distinguished by > attributes: > ```d > void f(ref int x) pure { x = 1; } > void f(ref int x) { x = 2; static int s; ++s; } > ``` > > I thought that, maybe, a

Re: How can overloads be distinguished on attributes alone?

2023-07-31 Thread bachmeier via Digitalmars-d-learn
On Monday, 31 July 2023 at 16:52:03 UTC, Dennis wrote: On Monday, 31 July 2023 at 16:09:11 UTC, bachmeier wrote: Is there a reason it would be difficult to make this not compile? No, except that might result in code breakage. The only way you could have code breakage is if you have ``` void

Re: How can overloads be distinguished on attributes alone?

2023-07-31 Thread Dennis via Digitalmars-d-learn
On Monday, 31 July 2023 at 16:09:11 UTC, bachmeier wrote: Is there a reason it would be difficult to make this not compile? No, except that might result in code breakage.

Re: How can overloads be distinguished on attributes alone?

2023-07-31 Thread Dennis via Digitalmars-d-learn
On Monday, 31 July 2023 at 10:55:44 UTC, Quirin Schroll wrote: What am I missing here? The duplicate definition check doesn't consider whether a function is actually unambiguously callable (without e.g. traits getOverloads), it only prevents creating the same linker symbol multiple time. So

How can overloads be distinguished on attributes alone?

2023-07-31 Thread Quirin Schroll via Digitalmars-d-learn
Apparently, functions can be overloaded solely distinguished by attributes: ```d void f(ref int x) pure { x = 1; } void f(ref int x) { x = 2; static int s; ++s; } ``` I thought that, maybe, a `pure` context calls the `pure` function and an impure context calls the impure function, but no:

Re: On Attributes

2017-11-27 Thread user1234 via Digitalmars-d-learn
On Monday, 27 November 2017 at 20:07:08 UTC, A Guy With a Question wrote: On Monday, 27 November 2017 at 19:41:03 UTC, Adam D. Ruppe wrote: On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a One thing that is bugging me is having to mark up all of my declarations with attributes. Meh,

Re: On Attributes

2017-11-27 Thread A Guy With a Question via Digitalmars-d-learn
On Monday, 27 November 2017 at 19:41:03 UTC, Adam D. Ruppe wrote: On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a One thing that is bugging me is having to mark up all of my declarations with attributes. Meh, you could also just ignore the attribute crap. Only reason I ever mess wit

Re: On Attributes

2017-11-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 27 November 2017 at 19:10:04 UTC, A Guy With a One thing that is bugging me is having to mark up all of my declarations with attributes. Meh, you could also just ignore the attribute crap. Only reason I ever mess with them is if someone who is using them tries to use my code... oth

Re: On Attributes

2017-11-27 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Nov 27, 2017 at 07:10:04PM +, A Guy With a Question via Digitalmars-d-learn wrote: > Hi again! > > I've been trying to do my best to write idiomatically. One thing that > is bugging me is having to mark up all of my declarations with > attributes. Which means I'm having to remember t

Re: On Attributes

2017-11-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/27/17 2:10 PM, A Guy With a Question wrote: Hi again! I've been trying to do my best to write idiomatically. One thing that is bugging me is having to mark up all of my declarations with attributes. Which means I'm having to remember them all. It's a bit much to keep in my head with eve

On Attributes

2017-11-27 Thread A Guy With a Question via Digitalmars-d-learn
Hi again! I've been trying to do my best to write idiomatically. One thing that is bugging me is having to mark up all of my declarations with attributes. Which means I'm having to remember them all. It's a bit much to keep in my head with every function. Is there a good way to reverse this (