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 #227

Open
JAremko opened this issue Jan 2, 2019 · 0 comments
Open

Naming conventions #227

JAremko opened this issue Jan 2, 2019 · 0 comments

Comments

@JAremko
Copy link

JAremko commented Jan 2, 2019

How def/defns should be named?

There are two pretty obvious choices: file-path->*config-try-m seems too "wordy".
But file-name->*config Is ambiguous since it doesn't specify the context - just says that there is one.

I ended up using Orchestra for exception monad:

(defmacro exception-of?
  "Construct predicate function for testing exception monad value.
  The predicate returns true if the monad contains `exc/failure`
  or if `exc/success` wraps value satisfying PRED predicate."
  [pred]
  `(fn [*val#]
     (and (exc/exception? *val#)
          (if (exc/success? *val#)
            (m/bind *val# ~pred)
            true))))

(defn-spec file-name->*config (exception-of? valid-config?)
  [f-name file?]
...)

It should be better than adding "type" info into doc-string since the return value is validated by Orchestra's instrument so it won't go stale.
And Emacs doc thingy displays definition un-expanded so it's immediately apparent what kind of context is used.

But mb it's an overkill. 🤔

I haven't found any naming recommendation in the docs.

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

No branches or pull requests

1 participant