Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming conventions for functions that error vs returns an Option #100

Open
br4sco opened this issue Jun 4, 2020 · 3 comments
Open

Naming conventions for functions that error vs returns an Option #100

br4sco opened this issue Jun 4, 2020 · 3 comments
Assignees

Comments

@br4sco
Copy link
Contributor

br4sco commented Jun 4, 2020

As we discussed last time we should decide upon a naming convention for functions doing "the same thing" that either gives an error on undefined input or are made total by using Option.

I believe we have two different suggestions so far.

Suggestion 1:

funNameOpt    -- wrapped in Option
funName       -- gives error

Suggestion 2:

funName        -- wrapped in Option
funNameErr     -- gives error
@dlunde
Copy link
Contributor

dlunde commented Sep 2, 2020

I believe we had this discussion again recently, and decided upon using

funName        -- wrapped in Option
funNameOrElse  -- executes function given as argument on error (which in turn can throw an error)

Please correct me if I remember this wrong.

@david-broman david-broman added the discussion An issue that warrants discussion label Oct 13, 2020
@david-broman
Copy link
Contributor

We will follow what Daniel said above. Tasks: (1) go through all code and make sure that this is true, (2) update the wiki.

@david-broman david-broman added help wanted and removed discussion An issue that warrants discussion labels Oct 13, 2020
@larshum
Copy link
Contributor

larshum commented Feb 8, 2022

Our suggestion is to use the err suffix for partial functions that crash, in addition to what Daniel said before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants