mmport80

mmport80

Is Dialyzer worth the effort?

I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort.

It’s not as easy to use as type inference in statically typed functional languages, and you don’t get as much bang for the buck with its super optimistic success typing.

Perhaps some sort of saner alternative would be an option for Elixir 2.0?

I often think Clojure is the closest language to Elixir - Clojure spec and gradual typing sound v interesting.

Thoughts? Perhaps Dialyzer is better than I give credit, would like to hear some good counter-arguments ; )

Most Liked

Qqwy

Qqwy

TypeCheck Core Team

I fully agree with @PatNowak. The usage of @specs goes further than using Dialyzer. I find it very helpful that functions clearly indicate what input/output they receive, especially because Elixir is dynamically typed.

Dialyzer’s main purpuse, in my opinion, is to make sure that the written @specs match the function’s implementations. I completely agree that it is less nice to use than typing in a statically typed language, but even when not using Dialyzer, do not underestimate the @spec.

PatNowak

PatNowak

Dialyzer won’t work in many cases, but the most important for me if I see @spec above the function definition is that I’ more confident what should be input and output for that function. It’s easier to see one line of typespec than to analyze function’s behavior.

bobbypriambodo

bobbypriambodo

I pretty much share the sentiment. Having types guide your development is a benefit I get when developing with OCaml, Haskell, Java, etc.

I tried to get the typechecking more streamlined with my dev by integrating Dialyxir as a linter in Atom. I was surprised at first that it doesn’t exist already, but as I developed the package myself I can guess why anyone doesn’t bother; it’s kinda slow, even for a small project built on top of Phoenix, and the output is not easily parse-able. I finally just create a command using process-palette that will run mix dialyzer and I execute it every once in a while.

I however agree that the @specs helps a whole lot as documentation, especially when it shows on atom-elixir’s autocomplete. Types are great ^^

Where Next?

Popular in Discussions Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
mbenatti
Following https://github.com/tbrand/which_is_the_fastest |> https://raw.githubusercontent.com/tbrand/which_is_the_fastest/master/imgs...
New
AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18243 126
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New
arpan
Hello everyone :wave: Today I am very excited to announce a project that I have been working on for almost 3 months now. The project is...
New
shishini
I think this twitter post and youtube video didn’t get as much attention as I hoped I am still new to Elixir, so can’t really judge ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement