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

Remove target annotation #32

Merged

Conversation

giacomocavalieri
Copy link
Contributor

Hello! I noticed simplifile uses quite a lot of target annotations, that is highly discouraged.

simplifile is a great package and my guess is a lot of people interested in ffi will probably have a look at its source code so I think it's for the best to follow Louis' recommendation to never use target and set a good example on how to write ffi for two targets at the same time.

This PR:

  • removes the target annotation by moving the error casting in the JS-specific code (rather than implementing it in Gleam and having it as a no-op for the erlang target)
  • renames the external functions to match the corresponding Gleam definitions

@bcpeinhardt
Copy link
Owner

Ah weird, I didn't realize you could import stuff from your own build dir into your ffi, but yeah that cleans things up nicely, thanks @giacomocavalieri, fabulous as always 😄

@bcpeinhardt bcpeinhardt merged commit bc15b34 into bcpeinhardt:main Jun 25, 2024
1 check passed
@giacomocavalieri giacomocavalieri deleted the remove-target-annotation branch June 25, 2024 20:01
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