When adding a @spec
to a function, is there any functional difference between doing something like
@spec my_func(input :: binary()) :: any()
vs
@spec my_func(input :: String.t()) :: any()
Does dialyzer treat those differently? A String is a UTF-8 encoded binary, yes? If you were parsing raw binary data (like zeros and ones from an image file), then I would declare the type as binary
, but for regular stuff like email addresses, that would be a String.t()
, yes?
Just a reality check, soliciting wisdom from the community. Thanks!