Skip to content
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

[C++ code gen, dictionary] Make instance names more consistent #349

Open
bocchino opened this issue Nov 9, 2023 · 0 comments
Open

[C++ code gen, dictionary] Make instance names more consistent #349

bocchino opened this issue Nov 9, 2023 · 0 comments
Labels
code generation Issues related to code generation

Comments

@bocchino
Copy link
Collaborator

bocchino commented Nov 9, 2023

When an instance I is defined in a module M, the name of the instance is M_I. However, the code generation is not entirely consistent:

  1. In the dictionary, the name becomes I instead of M_I. This makes the name shorter, but it can create ambiguity because it deletes the module prefix. E.g., M_I and N_I have the same name I in the dictionary. We should be consistent and use M_I in this case; a user who wants the unqualified name I can define the instance I outside of any module scope.
  2. In the generated C++, the name becomes I inside the namespace M and M_I outside the namespace M. This makes it hard to write initialization code that works in all cases. Instead of M_I we should use a C++ namespace qualifier M::I.

We can fix (1) as we develop the new JSON dictionary. We can fix (2) by updating fpp-to-cpp.

@bocchino bocchino added the code generation Issues related to code generation label Nov 16, 2023
@bocchino bocchino added this to To do in Fixes and Enhancements via automation Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code generation Issues related to code generation
Projects
Development

No branches or pull requests

1 participant