3 ms·
I prefer something like specs[1] that define a function’s signature but isn’t enforced by the compiler, instead the linter enforces them. This is what Erlang h
by Towaway69 1y ago
I prefer something like specs[1] that define a function’s signature but isn’t enforced by the compiler, instead the linter enforces them.
This is what Erlang has and it’s very convenient since once a design is fixed, I end up writing a spec to remind me what types the function expects.
[1] = https://www.erlang.org/doc/system/typespec.html https://www.erlang.org/doc/system/typespec.html
- conradfr 1y agoI really don't get how having to write @spec foo(String.t()) :: String.t() def foo(bar) is better than def foo(String.t() bar): String.t()