Skip to content

Add Virtual Functions #1

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

Open
Fizzixnerd opened this issue Oct 29, 2024 · 0 comments
Open

Add Virtual Functions #1

Fizzixnerd opened this issue Oct 29, 2024 · 0 comments
Assignees

Comments

@Fizzixnerd
Copy link
Owner

Peering a little at what gdext did, we need to add support for virtual functions (like _process) in order to make this worthwhile.

Here are my current thoughts:

One approach which I'm entertaining, at least at first, is to use a separate ppx for virtual functions, something like let%goverride. This has the same drawbacks as the gdext issue above for the first, less-type safe approach. Specifically, there would be no way to ensure that a virtual method defined in OCaml matched the method signature of the method we are meant to be overriding.

Another approach is to, like in gdext above, enumerate each classes virtual methods, and override them specifically. While generating the code that enumerates the virtual methods, it would be (hopefully) pretty easy to grab their intended signatures too, and compare with the signature given to the ppx.

The nice thing here is we can perform all these extra checks in the previous paragraph at a later date and only provide let%goverride for now. I think this incremental approach is the one we will take for now

@Fizzixnerd Fizzixnerd self-assigned this Oct 29, 2024
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

No branches or pull requests

1 participant