Closed jasongraffius closed 1 year ago
I don't think of the constant syntax as an attribute of the data itself, but as an attribute of the environment where it will be used. Would it be possible to implement this as a command-line option?
I do agree that the constant syntax/style/case can vary based on the environment, but I'd say it's also part of the data itself for a few reasons:
SHOUTY_CASE
already binds a name/style to the data implicitly.USB_1
vs USB1
example, and it would be difficult to resolve this in a command line argument alone.That being said, I think an approach to support something like being able to have a file in a "canonical" format/style but set/override the style at build time could still be supported in future work by allowing build-time command line options to set/add/override attributes in the AST or the IR after parsing. I can open a new issue for further discussion on that if we want to discuss going down that route.
I don't think of the constant syntax as an attribute of the data itself, but as an attribute of the environment where it will be used. Would it be possible to implement this as a command-line option?
I do agree that the constant syntax/style/case can vary based on the environment, but I'd say it's also part of the data itself for a few reasons:
- The existing
SHOUTY_CASE
already binds a name/style to the data implicitly.- Alternatives like packed structs are inherently binding a name/style to the data, and would require modifying the source to alter. This is also true of other serialization languages like protobuf.
- There can be name collisions in some cases, like the
USB_1
vsUSB1
example, and it would be difficult to resolve this in a command line argument alone.That being said, I think an approach to support something like being able to have a file in a "canonical" format/style but set/override the style at build time could still be supported in future work by allowing build-time command line options to set/add/override attributes in the AST or the IR after parsing. I can open a new issue for further discussion on that if we want to discuss going down that route.
I opened #85 for a feature that has been intended from when I first designed the attribute system: overlay files, so that you can add attributes without altering the original .emb
file. That is out of scope for this feature.
I opened #85 for a feature that has been intended from when I first designed the attribute system: overlay files, so that you can add attributes without altering the original
.emb
file. That is out of scope for this feature.
Excellent, I agree the .emboverlay
system would cover that use case. I'll leave this discussion out of this design doc in that case.
I don't think of the constant syntax as an attribute of the data itself, but as an attribute of the environment where it will be used. Would it be possible to implement this as a command-line option?