cgmath icon indicating copy to clipboard operation
cgmath copied to clipboard

condensed duplicate code for trait specialization using macros

Open hclarke opened this issue 7 years ago • 4 comments

I put all the "default" keyword stuff into a impl_fn! macro. that way, there's way less duplicate code for simd trait implementations

I also feel like there should be a "specialization" or "nightly" feature that's separate from "simd" (that simd enables/depends on). This patch doesn't include that, but makes it easier to implement, since there's only one macro to change

also made a BaseSigned trait so that you can use the trait implementation macros for Neg

hclarke avatar Aug 01 '17 05:08 hclarke

ping! @brendanzab

have any thoughts on this one?

I mainly did it because the first PR I submitted failed on the simd travis builds the first time, and I had to fix it by duplicating code. Doing it this way means that changes to the trait implementations only need to happen in one place, so it should reduce friction on future patches

hclarke avatar Aug 02 '17 20:08 hclarke

Woopsie, sorry I looked, thought it was awesome, then forgot to reply!

Yeah, I re-read the simd stuff a while back and got a tad confused. In fact I think a whole lot of our macro stuff is a bit ugly, so I'm glad you've been looking into it!

brendanzab avatar Aug 03 '17 07:08 brendanzab

these changes are in my queue. will probably get to it in the next few days thanks for feedback!

hclarke avatar Aug 09 '17 00:08 hclarke

@hclarke looks like the few days got stretched quite a bit :)

kvark avatar Jan 14 '19 16:01 kvark