[closer-devel] WITH-ACTIVE-LAYERS does not eval its args. Alternatives?

Kilian Sprotte kilian.sprotte at gmail.com
Sun Dec 1 09:58:45 UTC 2013


Hi,

I have run into a situation, where I would want WITH-ACTIVE-LAYERS to
evaluate its layer arguments or to have an alternative construct which
does so.

My questions are:

1. Is there a reason for WITH-ACTIVE-LAYERS to be designed this way?

2. Is there an alternative that allows me to achieve the desired
effect?

ENSURE-ACTIVE-LAYER and ENSURE-INACTIVE-LAYER being functions of
course evaluate their arguments, but using them together with an
UNWIND-PROTECT does not work, because ENSURE-ACTIVE-LAYER works
globally and also affects other threads.

The background is that I am using layers to represent different
backends in a database API. I would need WITH-ACTIVE-LAYERS to
evaluate its argument in the following example: A user wants to
connect to the database, so he specifies some connection settings,
including the backend to be used:

(defun open-db (spec)
  (destructuring-bind (backend &rest args) spec
    (with-active-layers (backend)
      (apply #'%open-db args))))

Suggestions or Remarks?

Thanks
Kilian





More information about the closer-devel mailing list