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

File generators #9

Closed
diamondburned opened this issue Jun 20, 2021 · 0 comments · Fixed by #13
Closed

File generators #9

diamondburned opened this issue Jun 20, 2021 · 0 comments · Fixed by #13
Labels
enhancement New feature or request

Comments

@diamondburned
Copy link
Owner

Preamble

For a while, gotk4 has alwayws generated everything into one large file. This
has several advantages of being faster to compile and having a lot more
manageable folder (one that doesn't have a hundred files lying around).

Problem

The lack of a separation of files makes sane versioning almost impossible to do
with build tags. In gotk3, everything added after a certain version will always
be added into another build tag to allow building the library without requiring
the latest version everywhere. This has come in handy several times in the past,
such as Pango's attributes being too new for certain outdated distros like
Ubuntu or Debian.

Furthermore, despite having a lot less files in a folder, it became much harder
to jump to a line where an error has occured. Often times, the build output may
point to lines that are 4 or 5 digits long, which makes it very hard to access
the error.

The gigantic file size of a single output file also means that it is now
impossible to directly jump to the source code from the documentation page, as
GitHub will refuse to render a file that large. The user will have to view the
raw file and manually search around, which is very inconvenient.

Solution

Ideally, not only should different routines such as type resolving and
converting be in different packages, they should also be completely decoupled
from the namespace generator entirely. Instead, they should use interfaces that
allow them to do that, similarly to a contract of some sort. This goal is very
similar to issue #8.

Once this has been done, a new file generator could simply be made that extends
the namespace generator to be used. The new generator should never be given
directly to the type resolving routines, but it should still contain its own
side effects to be written to the top of the file, such as imports.

@diamondburned diamondburned added broken Changes that require refactoring enhancement New feature or request and removed broken Changes that require refactoring labels Jun 20, 2021
diamondburned added a commit that referenced this issue Jul 4, 2021
This commit closes #9 by adding the new girgen/file.go FileGenerator,
which is completely refactored from the ground up to be much smaller,
cleaner and side effects-free.

This commit closes #8 as well by introducing the SourceNamespace and
CurrentNamespace API inside typeconv.Converter, which allows the
converter to pick the right namespace for resolving and generating.
diamondburned added a commit that referenced this issue Jul 4, 2021
This commit closes #9 by adding the new girgen/file.go FileGenerator,
which is completely refactored from the ground up to be much smaller,
cleaner and side effects-free.

This commit closes #8 as well by introducing the SourceNamespace and
CurrentNamespace API inside typeconv.Converter, which allows the
converter to pick the right namespace for resolving and generating.
diamondburned added a commit that referenced this issue Jul 4, 2021
This commit closes #9 by adding the new girgen/file.go FileGenerator,
which is completely refactored from the ground up to be much smaller,
cleaner and side effects-free.

This commit closes #8 as well by introducing the SourceNamespace and
CurrentNamespace API inside typeconv.Converter, which allows the
converter to pick the right namespace for resolving and generating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant