Repository navigation
Add @Type builtin - #3111
Add @Type builtin#3111
Conversation
6114c3d to
73387d6
Compare
73387d6 to
b4fd04b
Compare
7174901 to
70ae090
Compare
There was a problem hiding this comment.
Is there some way to set this up such that if that enum ever changes, we'll get a compile error here, or at least something easily debuggable?
There was a problem hiding this comment.
I think what I would do is define the enum values of builtin.Size in some data structure, then generate both the builtin code and an enum that the C++ compiler can use. Then instead of using hardcoded values of 0, 1, 2, and 3, you could use something like BUILTIN_SIZE_ONE BUILTIN_SIZE_MANY BUILTIN_SIZE_SLICE and BUILTIN_SLICE_C.
But this design would take a bit of work, I would think it would warrant a separate PR. Unless you have a simpler idea?
There was a problem hiding this comment.
I have a simpler idea: static_assert. As long as we get a compile error nearby the code that needs to be changed, everything is fine.
679a427 to
9633196
Compare
9633196 to
b728cb6
Compare
Implement proposal #2907 (ability to create primitive types from TypeInfo, but not necessarily aggregate types)
Because of existing/surrounding code...this PR mostly wrote itself.
Let me know if you'd like me to implement any more types.