-
Notifications
You must be signed in to change notification settings - Fork 608
Feature request: Bring back newtypes instead of type aliases #1393
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Motivation
Before 0.29, Foundation::HWND and friends were defined as wrappers around a usize/isize or something else. It made code a little verbose but it was very easy to differentiate values and to see exactly what was what.
This is now impossible and can easily lead to confusion when passing defaults/values defined far away.
For example, I liked to use Type::default() or HWND(0) because it made the type very clear, even in code reviews where type hint are hover docs are missing.
Drawbacks
Verbose, probably worse compile times.
Rationale and alternatives
Keep current format.
Additional context
One thing that was missing was Binary operations, like Or/And/Xor for such types. Since those are now type aliases, that makes them available by default, which is nice. Maybe find a way to have both ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request