atlas-engineer / nfiles

User configuration and data file management
BSD 3-Clause "New" or "Revised" License
18 stars 5 forks source link

Should `resolve` / `expand` return `#p""`? #23

Closed Ambrevar closed 1 year ago

Ambrevar commented 1 year ago

expand has this signature:

(-> expand (file) (values pathname &optional))

But resolve can return anything. Note that we have this :around method:

(defmethod resolve :around ((profile profile) (file file))
  "Clean up the result before returning it."
  (let ((path (call-next-method)))
    (if (nil-pathname-p path)
        path
        (uiop:ensure-pathname path
                              :truenamize t))))

So either

  1. we tweak resolve :around to return #p"" if it's a nil-pathname;
  2. or we allow NIL in the signature of expand.

Thoughts @aadcg @aartaka ?

aartaka commented 1 year ago

Strict typing shall prevail (always return pathnames fot consistency)!