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

Generate mutually-exclusive types depending on its version #14

Closed
diamondburned opened this issue Jul 4, 2021 · 2 comments
Closed

Generate mutually-exclusive types depending on its version #14

diamondburned opened this issue Jul 4, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@diamondburned
Copy link
Owner

Right now, type generators for classes, interfaces and records all generate its methods in the same file as the declaration, which means that methods added later will be grouped into the same unversioned file.

The solution seems to be to generate one additional file containing the base version that wouldn't be included if any versioning build tags are provided. This is because we cannot define methods in addition to existing ones if we're declaring everything inside an interface, so the interface declarations will have to be mutually exclusive somehow.

An example:

gtkwidget.go

// go:build cgo && !gtk-3.32
type Widget interface {
    BaseMethod()
}

gtkwidget-3.32.go

//go:build cgo && gtk-3.32
type Widget interface {
    BaseMethod()
    NewlyAddedMethod()
}
@diamondburned diamondburned changed the title Decouple method generation from generators Generate mutually-exclusive types depending on its version Jul 4, 2021
@diamondburned
Copy link
Owner Author

As of right now, the generator cannot generate versioned files at all, even if the code is seemingly there. The feature isn't considered to be complete, however, so it's technically not broken.

@diamondburned
Copy link
Owner Author

Replaced by #24.

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

No branches or pull requests

1 participant