Erlang / Erlang Advanced Interview questions
What is Dialyzer and how does success typing differ from static typing?
Dialyzer is Erlang's static analysis tool for finding type discrepancies — but it works differently from a conventional static type checker like those in typed languages. Instead of requiring every value to be annotated and rejecting code that can't be proven correct up front, Dialyzer uses success typing: it infers the types a function could actually succeed with by analyzing the code as written, and only flags something when it can prove a call would definitely fail.
-spec add(integer(), integer()) -> integer(). add(A, B) -> A + B. bad() -> add(1, "two"). %% Dialyzer flags this: "two" can never succeed here
Because success typing is optimistic by design — it only reports what's provably wrong, never
what merely isn't proven right — it produces very few false positives, unlike stricter type systems that
might reject valid-but-hard-to-prove code. -spec annotations are optional hints that sharpen
Dialyzer's analysis, not required declarations the way type annotations are in a conventional statically typed
language.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
