Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is a total order on (almost) all data types in the beam. This is useful for arbitrary sorting and comparison of different types.

I say almost because floats and their equivalent integer are different items but they are equal in the total order. In practice this is fine, and I have never heard of this causing a problem.



For me, no data is either NaN or zero, but +infinity is was the astounding part.

Also, for some languages, not failing with an exception when comparing different strong types, could be a source of bugs, generally.


In Elixir, nil is an atom (a global enum namespace), it's not a special data type that has meaning outside of a convention (heavily supported by the stdlib) that "you should use it to mean nothing"[0]. To hammer this home, nil is meaningless and not generally understood by that convention in Erlang (which often returns undefined).

Elixir/BEAM is strongly typed. There is no coercion going on when you are doing comparisons.

[0] note that in elixir, "if" is in the stdlib, it's sugar over case, and the falsiness of nil is software-level (only false and nil are falsy in elixir, which is sane).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: