Re: opBinary : Static ifs or specialization?

2020-06-24 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 24 June 2020 at 09:01:28 UTC, claptrap wrote: On Wednesday, 24 June 2020 at 00:53:58 UTC, H. S. Teoh wrote: On Tue, Jun 23, 2020 at 11:53:36PM +, claptrap via If your implementations are based on built-in operators, you could use mixins to unify the implementations into

Re: opBinary : Static ifs or specialization?

2020-06-24 Thread claptrap via Digitalmars-d-learn
On Wednesday, 24 June 2020 at 00:53:58 UTC, H. S. Teoh wrote: On Tue, Jun 23, 2020 at 11:53:36PM +, claptrap via If your implementations are based on built-in operators, you could use mixins to unify the implementations into one, e.g.: Ah yeah thats useful, to expand a bit what about

Re: opBinary : Static ifs or specialization?

2020-06-23 Thread Meta via Digitalmars-d-learn
On Tuesday, 23 June 2020 at 23:53:36 UTC, claptrap wrote: So you have opBinary and half a dozen operators to implement. Do you use a separate method for each operator or do you have one method and a big static if else if to select code path? I assume they are functionally equivalent? So its

Re: opBinary : Static ifs or specialization?

2020-06-23 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jun 23, 2020 at 11:53:36PM +, claptrap via Digitalmars-d-learn wrote: > So you have opBinary and half a dozen operators to implement. Do you > use a separate method for each operator or do you have one method and > a big static if else if to select code path? [...] If your

opBinary : Static ifs or specialization?

2020-06-23 Thread claptrap via Digitalmars-d-learn
So you have opBinary and half a dozen operators to implement. Do you use a separate method for each operator or do you have one method and a big static if else if to select code path? I assume they are functionally equivalent? So its just about style?