Re:Gleam 0.14 – Type-safe language for the Erlang VM
by devoutsalsa on Thursday February 18, 2021 @09:26PM
(#26188807)
As dumb as this sounds... you can use typespecs as documentation even if you never run dializer. We do this at work in a legacy code base that would be painful to dialyze without errors, but it makes new code nicer to look at.
[ Parent
| on HN ]
Re:Gleam 0.14 – Type-safe language for the Erlang VM
by warmwaffles on Thursday February 18, 2021 @09:31PM
(#26188845)
I use it exactly for this. Just use typespecs as a hint to the person looking at the code as to what is expected to be passed.
Re:Gleam 0.14 – Type-safe language for the Erlang VM
by bcrosby95 on Thursday February 18, 2021 @11:45PM
(#26189866)
If you never do anything but read them... why not documentation?
Re:Gleam 0.14 – Type-safe language for the Erlang VM
by warmwaffles on Friday February 19, 2021 @09:49AM
(#26193709)
I do both. All to help me in the future as much as possible when I come back scratching my head.
Re:Gleam 0.14 – Type-safe language for the Erlang VM
by slindz on Friday February 19, 2021 @01:01AM
(#26190234)
Terseness.
Re:Gleam 0.14 – Type-safe language for the Erlang VM
by devoutsalsa on Friday February 19, 2021 @07:12AM
(#26192277)
Yup. One could write "It takes a string as an argument & reverses it". Or one could write "String.reverse(()". For any non trivial case, such as weird options, you'll normally write documentation anyway.