-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Enums as specified do not cover interop situations well #21966
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
Comments
Added Area-Language, Triaged labels. |
This comment was originally written by @mhausner Note that in this rare case, you can simply use symbolic integer constants, e.g. const int INTERNAL_SERVER_ERROR = 500. |
This comment was originally written by [email protected] Enums in C++, C#, TypeScript, and D map to ints: http://msdn.microsoft.com/en-us/library/2dzy4k6e.aspx Protobufs are similar: https://developers.google.com/protocol-buffers/docs/proto#enum I'd prefer if Dart's enums were like that, too. If some external system considers MONDAY to be equal to 107 (real-word example), then you have to use that value, too. There is no way around it. If you use constants, you lose the tooling benefits. If you use metadata to glue the values to the enum, they get rather heavy and there are some glaring issues: import 'dart:mirrors'; class Enum { |
Duplicate of dart-lang/language#158 |
This issue was originally filed by [email protected]
Enums as specified do not cover interop situations well where there's an expectation that an enum can be associated with a particular value (e.g. pnacl, http status messages with gaps in ranges, Windows messages, etc).
Please provide any additional information below.
Originally mentioned in comment to Issue #21416
The text was updated successfully, but these errors were encountered: