-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Geometry interface with sum-type #87
Conversation
Note: I've self-reviewed this and am happy with the current CL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Only concern is that unsafe package is not guaranteed for back-compatibility. But it is a small portion of code. Should be easy to change.
Thanks for reviewing @Den3. Agreed, using the The alternative was to replace the |
This change replaces the
Geometry
interface with a newGeometry
type that can hold exactly one geometry value (i.e. it's a sum-type/variant/tagged-union). It also replaces theAnyGeometry
type.The new type is implemented as a pointer to the underlying geometry, along with a tag to indicate the type of geometry that it is.
Using the existing
Geometry
interface has a bunch of problems:A tagged union seems like a better match to the actual use-case.