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

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



I 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()




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

Search: