Created
August 7, 2011 04:29
-
-
Save llibra/1130049 to your computer and use it in GitHub Desktop.
define package alias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 元のパッケージに新しいニックネームを付ける | |
(defmacro define-package-alias (name package-designator) | |
(let ((designator (gensym))) | |
`(let ((,designator ,package-designator)) | |
(rename-package ,designator | |
,designator | |
(union (list (string ,name)) | |
(package-nicknames ,designator) | |
:test #'equal))))) | |
(define-package-alias :r :cl-ppcre) | |
;; 元のパッケージを継承して必要なシンボルだけエクスポートする | |
(defmacro define-synonym-package (name package-designator) | |
(let ((desinator (gensym)) | |
(new-package (gensym)) | |
(symbol (gensym))) | |
`(let* ((,desinator ,package-designator) | |
(,new-package (make-package ,name :use ,desinator))) | |
(let ((*package* ,new-package)) | |
(do-external-symbols (,symbol (find-package ,desinator)) | |
(export ,symbol))) | |
,new-package))) | |
(define-synonym-package :r :cl-ppcre) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment