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

Codegen: remove Im* prefix restriction on structs #138

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

gucio321
Copy link
Collaborator

Idk why was that restriction there, but after removing it, much more function is generated

@gucio321 gucio321 marked this pull request as ready for review April 19, 2023 09:42
@AllenDang
Copy link
Owner

As i recall, Im* prefix means that struct kind of public and without that prefix means it's internal

@gucio321
Copy link
Collaborator Author

As i recall, Im* prefix means that struct kind of public and without that prefix means it's internal

Oh, ok I see, but, since #99, we should generate everything internal, shouldn't we?

@AllenDang
Copy link
Owner

@gucio321 Frankly, I think auto-generator should respect the public/private rule in imgui (an API is marked as private for a reason I think). If some internal API is really needed for a good reason, one could export it by hand like util.h, util.cpp and util.go did.

@gucio321
Copy link
Collaborator Author

@gucio321 Frankly, I think auto-generator should respect the public/private rule in imgui (an API is marked as private for a reason I think). If some internal API is really needed for a good reason, one could export it by hand like util.h, util.cpp and util.go did.

@AllenDang I see, but I think we should change this attitude for a few reasons:

  • we already expose everything from imgui_internal (which is supposed to be unexported I think)
  • consider C privacy rules: despite something is intended to be private, it is not private in fact (if developer needs it, he can use it). In go it is arbitrary detemined whether something is public or private

Thats why I suppose we should have everything exported, notify our users, that something is not supposed to be exported in imgui (e.g. add a comment over function/type declaration or prefix it with Internal) and let them decide whether they want to use it or not. Over that I suppose that if someone uses cimgui-go he is rather familiar with C++ version and knows consequences of using internal stuff.

@AllenDang
Copy link
Owner

@gucio321 Frankly, I think auto-generator should respect the public/private rule in imgui (an API is marked as private for a reason I think). If some internal API is really needed for a good reason, one could export it by hand like util.h, util.cpp and util.go did.

@AllenDang I see, but I think we should change this attitude for a few reasons:

  • we already expose everything from imgui_internal (which is supposed to be unexported I think)
  • consider C privacy rules: despite something is intended to be private, it is not private in fact (if developer needs it, he can use it). In go it is arbitrary detemined whether something is public or private

Thats why I suppose we should have everything exported, notify our users, that something is not supposed to be exported in imgui (e.g. add a comment over function/type declaration or prefix it with Internal) and let them decide whether they want to use it or not. Over that I suppose that if someone uses cimgui-go he is rather familiar with C++ version and knows consequences of using internal stuff.

Ok, you got me, let's do it, expose everything

@gucio321
Copy link
Collaborator Author

greate, so @AllenDang so go ahead and get it merged!

Copy link
Owner

@AllenDang AllenDang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AllenDang AllenDang merged commit 28d4043 into AllenDang:main Apr 26, 2023
@gucio321 gucio321 deleted the codegen branch April 26, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants