-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Generate aliases that resolve to the latest minor version of the data type #193
Comments
My own experience also indicates that it would be valuable to be able to omit the minor version number in some cases. Dropping the major version may cause nasty consequences since there is no wire compatibility guarantee across different major versions, but the minor one is usually safe to omit making the implementation default to the latest one. This idea does not need to be limited to C only, of course. However, if we did it the way you described, C/C++ applications that leverage different minor versions of a data type would violate the ODR since there would be different definitions under the same name available in different files. A robust solution is to make Nunavut emit an alias for every major version of every data type that simply resolves to the latest minor version; such alias necessarily has to be placed in a separate file. For example, if you have
@thirtytwobits do you support this? @Cherish-forever would you like to work on this? |
@pavel-kirienko |
@thirtytwobits if you greenlighted this we could ask @Cherish-forever to help us implement it. |
@Cherish-forever and @pavel-kirienko , yeah. I think this makes a lot of sense. |
So @Cherish-forever would you like to work on this? |
Just to clarify, work for this is done in Python but needs to be implemented here for C and C++. |
@thirtytwobits How would you go about implementing this for C++? We need to extend the list of data types for which we generate outputs with aliases. Given a list of DSDL types that contains This issue is kinda important right now because the high-level interfaces in libcyphal are going to depend on DSDL-generated types, and we don't want them to depend on a specific minor version (at least not always). |
We could overload the namespace concept such that, when enabled in C++ generation, we generate
Is this what we're looking for here? |
Yes. |
(for C++ and C this should be the same. I'll discuss c++ here) In
Setting
This is a bit ugly, I admit. The alternative would require changes to the core to enable a "generate latest minor of major only" where the generator itself would only emit (for our example) Thoughts? |
I think this is superior to the namespace header ( |
I think nunavut generate source file without version, so that user application will don`t care about protocol version.
user application include by different protocol version header file to change protocol version.
application code will use the variable or struct or api without version.
The text was updated successfully, but these errors were encountered: