-
Notifications
You must be signed in to change notification settings - Fork 35
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
Elixir support #73
Comments
People have already experimented with running the Gradualizer on Elixir programs! The way we can currently support this is as follows: beam files compiled with the debug_info flag includes an "abstract form" of the program, which Gradualizer can use as a basis for typechecking. As luck would have it, the Elixir compiler includes the abstract form when compiling programs. So the Gradualizer can easily be run on beam files originating from Elixir programs. Now, I haven't tried to type check any Elixir programs myself. But from what I understand it is already possible to typecheck quite a few programs although there are a few wrinkles that need to be sorted out for full Elixir support. Don't take my work for it though. I'd love to see people trying out Gradualizer for Elixir and reporting any success and/or problems they have. Ideally, also submitting patches to fix any encountered problems. Unfortunately, I don't have any bandwidth to work on Elixir support and the main contributors are focused on finalizing typechecking for Erlang so that we can make a beta release. But I'd be happy to have people contribute Elixir support as well. |
I've done it, it works well enough sans Gradualizer is still missing some types but those are being added over time. :-) I've been waiting for someone to make a mix plugin to use Gradualizer, then you could do it all at once and built-in'ish, I might get around to it sometime when I get some free time. :-) |
Makes sense! Is there an option for languages such as LFE? It compiles to Core directly and I believe do not have the same abstract form as Erlang and Elixir as a result. |
I've not actually checked about LFE, @rvirding would be the one to ask there, but from my understanding the abstract form's should be the same for everything that compiles to the BEAM via any method as long as they add in the debug chunk (which I'm not sure if LFE does, but I would expect it to do so considering LFE is made by @rvirding?). |
@OvermindDL1 How did you get it running with Elixir? I have it compiled, but when I try to use it my elixir directory, I get:
|
@jeremyowensboggs I made a mix plugin at: https://github.com/overminddl1/gradualixir That error means that you didn't link in the Elixir library location ( I plan to PR my plugin here sometime, just not got around to it yet, way busy in real life. ^.^; |
Hello!
I was wondering if there would be any interest in/possibility of adding Elixir support to Gradualizer?
Semantically they are near identical languages that use the same typespecs, so I feel the same tool could be applied to both. I can think of two main differences:
Elixir has Lisp style macros. To handle this type checking could be performed after macro resolution so no knowledge of that system is required.
Elixir has protocols, which are slightly similar to Haskell's typeclasses and have no equivalent in Erlang. This could be ignored, at least to start.
I've not yet read any of the Gradualizer source- does this feature seem realistic and achiveable?
Cheers,
Louis
The text was updated successfully, but these errors were encountered: