[asdf-devel] Guard against (push "/foo/bar" asdf:*central-registry*)
Gary King
gwking at metabang.com
Sat Jul 11 19:09:43 UTC 2009
Hi Daniel,
I like your sketch but wonder about adding a second interface without
removing the first. Since we shouldn't remove the first for both
backwards compat and special variable goodness, I learn towards
keeping things the same and running the checks late.
On Jul 10, 2009, at 11:37 PM, Daniel Herring wrote:
> 2009/7/10 Stelian Ionescu <sionescu at cddr.org>:
>> On Tue, 2009-07-07 at 12:31 +0200, Tobias C. Rittweiler wrote:
>>> I think it's bitten pretty much all of us that we at least once
>>> tried to
>>> push a non-directory-designating filename to *CENTRAL-REGISTRY*.
>>>
>>> It's a common pitfalls for newcomers.
>>>
>>> Couldn't ASDF signal a warning when it encounters such a thing while
>>> grovelling through the registry?
>>
>> Why not simply deprecate(or unexport *CENTRAL-REGISTRY*) and add a
>> function REGISTER-ASDF-DIRECTORY that does all necessary checks ?
>
> I like the idea of adding a helper function.
>
> I don't like the idea of hiding *CENTRAL-REGISTRY*. Given that asdf
> needs
> a well-ordered list of directories to traverse (a la PATH on every
> major
> OS), the current exported list provides a powerful API.
>
>
> Here's an actual case which greatly benefits from the registry being
> an
> exported special variable.
>
> (let ((*central-registry* (list only-search-here)))
> (if (asdf:operate 'asdf:load-op :test-package)
> test-package-found-where-expected
> error))
>
>
> Here's a quick sketch of two helpers that should handle most common
> uses.
>
> (defun register-directory (path &optional (where :last) other)
> (validate-or-die path)
> (when other
> (find-or-die other *central-registry*))
> (when (find path *central-registry :test #'same-path)
> (return))
> (setf *central-registry*
> (ccase where
> (:first
> (cons path *central-registry*))
> (:last
> (append *central-registry* (list path)))
> (:before
> (append paths-before-other
> (list path other)
> paths-after-other))
> (:after
> (append paths-before-other
> (list other path)
> paths-after-other)))))
> (defun deregister-directory (path)
> (setf *central-registry*
> (remove path *central-registry*)))
>
>
> Later,
> Daniel
>
> _______________________________________________
> asdf-devel mailing list
> asdf-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel
--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM * gwking on twitter
More information about the asdf-devel
mailing list