Closed 0xEAB closed 1 month ago
I’d like to hear your opinion on this, @adamdruppe.
My motivation behind this change is to get arsd to act more or less like a drop-in replacement and make it more convenient to use. While I tried to make it work like the previous implementation for most cases, I don’t have any data on this change’s actual impact on backwards compatibility, to be honest.
I’ve updated this patch. Not sure what to do with it. No longer sure whether it adds value.
No longer sure whether it adds value.
Well, it removes an anonymous union. Could be an advantage.
@adamdruppe Any comments/suggestions? :)
i kinda forgot about this one lol lemme look at it again
well looking it back over it looks ok enough. i can go ahead and merge if you wanna
Any suggestions to improve it?
In its current form, this is a breaking change suitable for arsd 12 or a later major release.
getter+setter vs. union
Color.components
is turned intoubyte[4]
. Unlike an anonymous union, this works with CTFE as well.r
,g
,b
,a
andasUint
are turned into getter + setter functions.A sufficiently good optimizing compiler will generate the same code for these as it would previously have with the union. (Note that this cannot be confirmed with DMD’s built-in profiler as it’s implementation will poison any getter/setter functions.)
alias this
The alias this stems from my codebase which did use it to simplify certain implementation details. I’m not sure whether it’s a good thing or even worth it.