Home

Advertisement

Customize

Liam Healy - January 23rd, 2007

Jan. 23rd, 2007

10:48 am - Conditionalizing minor system dependencies

If a system could make use of another but the usage is incidental and you don't want to break the loading of the first if the second is unavailable, it would be nicer to skip over it or provide an alternative. I have used an idiom like this:

(remove string *sf-name-mapping*
	  :key #'rest
	  :test-not
	  (if (find-package :ppcre)
	      (symbol-function (intern "ALL-MATCHES" :ppcre))
	      #'string-equal))

in a function, which says to use ppcre:all-matches if cl-ppcre is loaded, otherwise use CL's string-equal. But this is clumsy and limited in applicability. What I would like is something like #+ and #- for packages, like #+(package ppcre) which would only see the form following if that package was loaded. I don't think this is possible in portable CL, but I'm wondering if it's possible some other way. This might be done with asdf-system-connections, but it seems clumsy for the one-form case. The advantage is that the dependent code will be loaded whenever the secondary system is loaded; with a compiler conditionalization it can only happen at compile time.

Tags:
Previous day (Calendar) Next day