Type Specification of net:getnameinfo()
Tue Jan 26 17:35:08 CET 2021
On 2021-01-26 21:46, Nalin Ranjan wrote:
> 2. In this particular case of type specification, the only difference is in
> one of the parameters of the function. I was also wondering if we could
> have used a union instead to write the same type spec, it would have been
> For example,
> Instead of writing a type spec like this
> SomeVar :: xxx_type().
> SomeVar :: yyy_type().
> We could specify the same type spec as:
> SomeVar :: xxx_type() | yyy_type().
> Any reason we preferred the former over the latter?
If Erlang is compiled without socket support, some types will not exist at
all. Using the preprocessor makes it possible to provide specifications
with types which actually exist, with or without socket support.
More information about the erlang-questions