@lanodan OOP programmers generally don't have to deal with integers for errors.

@xianc78 It has nothing to do with the paradigm.

Go is mostly imperative, functions returns a nullable string for errors, like in some C APIs.
Elixir is mostly functional, often APIs follow {:ok, data} on success, {:error, message} with message being a string on error.

I guess the OOP-style is raising exceptions, which is a model I hate even more than returning integers because then it's impossible to know that errors are handled when they should.
Follow

@lanodan Yeah that what I was talking about. I find returning negative integers to be weird, but most of my experience is OOP, but I understand why people hate it.

· · Web · 1 · 0 · 0
@xianc78 Well, returning non-zero integers or returning a NULL pointer and checking errno (which isn't thread-safe btw) is quite C-specific in my experience.

Only other one I know with (unsigned) integers for errors is shell and that's a whole other kind of mess.
Sign in to participate in the conversation
Game Liberty Mastodon

Mainly gaming/nerd instance for people who value free speech. Everyone is welcome.