On 04/01/18 22:47, Nathan Froyd wrote: > This is very doable, it just requires some build system hackery: we > accept preprocessed/generated WebIDL files, and generated IDL files > would require basically the same approach. I can help with the build > system hackery if you want to continue pursuing this approach.
If it's possible then I think it would be worth pursuing. With this approach the constants would be held together with the methods within the interface object/class versus three separate entities of my current approach (the interface object/class, a C++ enum and a JS object). Having everything in one place is definitely a better approach from a code design perspective (and would prevent potential issues such as including the interface definition but not the header with the enum declaration). We'd also retain the other advantages such as the ability to add further metadata to the declaration, having the constants generated instead of written by hand, etc... The only drawback I can think of is that we'd lose the ability to use an enum in C++ for extra type safety. But that really isn't a big deal. For crash annotations it mattered because the JS interface is built on top of an already exposed C++ one which could be made type-safe. For observers the interface used is always the generated one which - being the same for JS and C++ - cannot use C++ enums directly anyway. Gabriele
signature.asc
Description: OpenPGP digital signature
_______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform