Fl4m3Ph03n1x

Fl4m3Ph03n1x

Background

In a post I made about having static types in Elixir, someone mentioned the tool Gradualizer. This came as a surprise to me, as though I have seen and read quite a lot about Dialyzer, I have never seen an Elixir book mention Gradualizer.

Questions

I understand Gradualizer aims to provide static typing for erlang (and I suppose Elixir) via gradual typing, while Dialyzer takes a different approach.

But as someone who doesn’t understand the differences to both systems, this is new terrain.

  1. What is the main purpose of Gradualizer in regards to its ancestor? (to replace Dialyzer, be a competitor, improve upon it…)
  2. What are the main differences between one tool and the other?
  3. Why should I move to Gradualizer when Dialyzer has been the de facto tool for typing in erlang/elixir since… well, forever?
  4. Is Gradualizer ready for usage in real projects? (I understand it isn’t, please correct me if I am mistaken)

Showing Posts 1 to 10

LostKobrakai

LostKobrakai

Dialyzer was build on the idea of success typing. This makes so that dialyzer can work even without user input, just based on code itself. It also tries to not report false positives quite heavily. But it comes with the downside of not detecting many of the error cases other static typing systems can detect. (The link below even argues that dialyzer is not a type system)

Gradualizer is a completely different approach. Afaik it doesn’t do type inference, so unless you manually provide typespecs it does nothing. But for the places you do provide them, it’ll statically check for errors even beyond what dialyzer would be able to detect or would acknowledge. The other big part between the lines is that you can gradually add type safety to your systems. It’ll work with as much typespecs as the code does provide.

For more details see this one:
https://github.com/josefs/Gradualizer/blob/master/talks/talk.md#comparison-with-dialyzer

Essentially both tools try to detect errors, but do that in quite different ways with therefore quite different tradeoffs.

dimitarvp

dimitarvp

Have you used both tools in concert in a project? I’m curious since I’m considering it.

LostKobrakai

LostKobrakai

I have not. I’ve just seen the talk about gradualizer.

egze

egze

Are there any tutorials/articles how to use gradualizer with Elixir?

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

@OvermindDL1 created Gradualixir ( GitHub - OvermindDL1/gradualixir: Gradualizer Mix Wrapper · GitHub ). Right now I think it is the best shot at using Gradualizer with Elixir. If you have any questions you can probably ask him.

OvermindDL1

OvermindDL1

I think gradualixir is in a slightly broken state due to recent changes in gradualizer (again), PR’s to fix welcome, and I probably need to track specific commits instead of master until gradualizer publishes it’s first release. :sweat_smile:

But when it works you just run mix gradualizer to scan your whole project or mix gradualizer files.beam morefiles.beam path/**/to/files/*.beam, recommend to do individual files for now to work on errors at a time to fix things (when it’s in a working state). Gradualixir itself passes gradualizer (and dialyzer) with flying colors though. :grinning_face_with_smiling_eyes:

egze

egze

I heard the Running in Production podcast where you talked about Gradualizer and other stuff. Very nice episode :slight_smile: You seem to follow the development of Gradualizer closely, do you know when it will stable enough to use and what the current state is?

OvermindDL1

OvermindDL1

Seems to be progressing fairly quickly, dev seems to have slowed lately as most of it is pretty well done now, mostly just needs more typespecs fixing broken typespecs. Other than that it’s usable now for most things, just more typespecs, lol.

Rich_Morin

Rich_Morin

The most recent commit to Gradualixir was almost two years ago. Can someone give me an idea of its current status and prospects? Is anyone using it as a production tool?

-r

Rich_Morin

Rich_Morin

(crickets…)

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews