Replies: 2 comments 4 replies
-
|
FWIW I've also been writing a library implementation using code gen and also ran into this issue. It does have a downstream impact of causing a breaking change in libraries and it would pin implementations to older library versions if they need to support deprecated fields. Obviously less of an issue right now because of how green field the project is, but I think down the road it will be a pain point. |
Beta Was this translation helpful? Give feedback.
-
Is this a bad thing? If you update the library, that implies that you want to be up-to-date with the newest standard. Say that the deprecated field was an enum. For things to work, you would then also need to keep the file in the enum values in the repository. You could then end up with a lot of dead code in the specification. In code libraries, functions are first marked as deprecated, and then they can also completely removed after some time. While I agree that it is a good idea to leave the field around for a bit when marked as deprecated, I would say that ultimately, we do want to fully remove it from the spec. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to make a suggestion regarding the data definition for deprecated fields, for example: https://github.com/prusa3d/OpenPrintTag/blob/9fa7e5e2ac2686feea1ca52c0016fa37bd631520/data/main_fields.yaml#L112
I have been working on an implementation of this standard in golang (https://github.com/cjbearman/openprinttag). I have chosen to use code generation to generate representations of the different tag regions, giving the user definitive methods to retrieve and set each field value.
My concern is that the representation of the deprecated fields appears to be just the declaration that the field used to exist but has been deprecated - information about the name, type and so forth has been omitted.
In my opinion, and certainly as it relates to my implementation, this choice has the potential to cause issues in the case where code generation is used. Specifically, should a field become deprecated and the prior record of type, name and other associated parameters is removed from the definition, code generation would no longer be able to include the representation of the field in it's generated code. This causes issues to people using the code when they update to the new version, because functions previously available related to the field will no longer be present, thus causing compilation failure and the need to update code.
In my opinion, it would be better to retain the full context for each deprecated field, and simply mark it as deprecated. In this way, comments and deprecation flags can be added by code generation to the associated functions, to alert the user. In addition, checkers (such as opt-check) can provide more meaningful insight if the field continues to be used.
Beta Was this translation helpful? Give feedback.
All reactions