Giter Site home page Giter Site logo

Elixir support about gradualizer HOT 6 CLOSED

josefs avatar josefs commented on June 1, 2024
Elixir support

from gradualizer.

Comments (6)

OvermindDL1 avatar OvermindDL1 commented on June 1, 2024 5

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'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. :-)

from gradualizer.

OvermindDL1 avatar OvermindDL1 commented on June 1, 2024 3

@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 (-pa .../path/to/elixir/ebin).

I plan to PR my plugin here sometime, just not got around to it yet, way busy in real life. ^.^;

from gradualizer.

josefs avatar josefs commented on June 1, 2024 1

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.

from gradualizer.

lpil avatar lpil commented on June 1, 2024

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.

from gradualizer.

OvermindDL1 avatar OvermindDL1 commented on June 1, 2024

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?).

from gradualizer.

jeremyowensboggs avatar jeremyowensboggs commented on June 1, 2024

@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:

~/d/blaster2 (BV2-66-display-on-screen-for-technical-issues)> ../Gradualizer/gradualizer _build/dev/lib/blaster/ebin/Elixir.Blaster.Cart.beam
escript: exception error: undefined function elixir_erl:debug_info/4
  in function  beam_lib:chunks_to_data/7 (beam_lib.erl, line 652)
  in call from beam_lib:read_chunk_data/3 (beam_lib.erl, line 521)
  in call from beam_lib:read_chunk_data/2 (beam_lib.erl, line 509)
  in call from gradualizer_file_utils:get_forms_from_beam/1 (/Users/jowens/dev/Gradualizer/_build/default/lib/gradualizer/src/gradualizer_file_utils.erl, line 36)
  in call from gradualizer:type_check_file/2 (/Users/jowens/dev/Gradualizer/_build/default/lib/gradualizer/src/gradualizer.erl, line 40)
  in call from gradualizer:'-type_check_files/2-fun-0-'/4 (/Users/jowens/dev/Gradualizer/_build/default/lib/gradualizer/src/gradualizer.erl, line 99)
  in call from lists:foldl/3 (lists.erl, line 1263)

from gradualizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.