Dynamic typing determines a variable’s type from the value it holds at runtime, without explicit variable or type declarations. In Elixir, assignment is binding: names can be rebound, while the immutable data they reference is not modified. section 2.2 section 2.8
Because function inputs and outputs are not obvious from signatures alone, typespecs can document expected types and support Dialyzer-based static analysis. They compensate for, but do not replace, a static type system. section 2.3.6
Runtime values and optional type information
A name can first bind to 10,000 and later to 11,000. Separately, a function can declare @spec area(number) :: number, giving tools and readers an explicit contract while the language remains dynamically typed. section 2.2 section 2.3.6
defmodule Circle do @pi 3.14159 @spec area(number) :: number #1 def area(r), do: r*r*@pi @spec circumference(number) :: number #2 def circumference(r), do: 2*r*@pi end
Shows a typespec attached to functions that accept and return numbers. section 2.3.6





