-
Notifications
You must be signed in to change notification settings - Fork 103
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
Redesign SDLEnums to not be objects #20
Comments
I have come up with a (completely untested) possible method of doing this. See the following gist for an example. https://gist.github.com/joeljfischer/67bd1d4da444e948cb5d There are still objects here, each SDLEnum object holds a single (enforced by a singleton pattern) dictionary held in it's overridden To the developer, all they ever need to deal with are the public enum values. This will help with enforcing correct values and will be very fast, since they're just integers. At runtime, when we need to, we'll convert back and forth for the protocol. |
hi, Joel Thanks for your gist. I'll hold on them and try it tomorrow and keep you Thanks |
Hey Yingang, I would not recommend trying to implement the ideas presented in the gist into the library at this point. To actually do so would require a lot of work and changes to many places in the library. Many/all enums would need to be altered to work in the manner described, and lower level changes to message creation and parsing would need to be implemented. The gist was intended strictly as a presentation of ideas for discussion for now. |
Note that all |
Closed in favor of #425 |
…L-872 to master * commit '7dab7f4d8d51142e5705adf894e62965780142a0': Control session has to be stopped on main thread, not receive queue.
Lots of enum objects permanently in memory now, could do conversion between String Enum <–> Integer Enum instead. Less memory overhead, probably more CPU overhead, likely negligible. Removes an enormous amount of code.
Right now, Enums are designed as objects. From what I understand, there are a few reasons for this:
See the comment below for more details.
Also, see #425, perhaps just
typedef EnumName NSString
and stringly typed constants?The text was updated successfully, but these errors were encountered: