-(export 'call-with-module-environment)
-(defun call-with-module-environment (thunk)
- "Invoke THUNK with a new collection of bindings for the module variables."
- (progv
- (mapcar #'car *module-bindings-alist*)
- (mapcar (compose #'cdr #'funcall) *module-bindings-alist*)
- (funcall thunk)))
+(export 'with-module-environment)
+(defmacro with-module-environment ((&optional (module '*module*)) &body body)
+ "Evaluate the BODY with MODULE's variable bindings in scope."
+ `(call-with-module-environment (lambda () ,@body) ,module))