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
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 😄
Hello! I noticed
simplifile
uses quite a lot oftarget
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: