From d56803388a0a0a35e1889596f928b367c650c15b Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Fri, 2 Jan 2009 14:24:03 +0000 Subject: [PATCH] 1.0.24.5: SB-INTROSPECT: rename FUNCTION-ARGLIST to FUNCTION-LAMBDA-LIST * Deprecate FUNCTION-ARGLIST. * Improve the docstring. * Original patch by Tobias Rittweiler. --- NEWS | 2 ++ contrib/sb-introspect/sb-introspect.lisp | 25 +++++++++++++++++-------- contrib/sb-introspect/test-driver.lisp | 16 ++++++++-------- doc/manual/docstrings.lisp | 2 +- version.lisp-expr | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 6e7338b..e1ac562 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes in sbcl-1.0.25 relative to 1.0.24: + * incompatible change: SB-INTROSPECT:FUNCTION-ARGLIST is deprecated, to be + removed later. Please use SB-INTROSPECT:FUNCTION-LAMBDA-LIST instead. * new feature: SB-INTROSPECT:DEFTYPE-LAMBDA-LIST allows retrieval of DEFTYPE lambda lists. (thanks to Tobias Rittweiler) * improvement: reading from a TWO-WAY-STREAM does not touch the output diff --git a/contrib/sb-introspect/sb-introspect.lisp b/contrib/sb-introspect/sb-introspect.lisp index 76b6452..d962f6c 100644 --- a/contrib/sb-introspect/sb-introspect.lisp +++ b/contrib/sb-introspect/sb-introspect.lisp @@ -25,6 +25,7 @@ (defpackage :sb-introspect (:use "CL") (:export "FUNCTION-ARGLIST" + "FUNCTION-LAMBDA-LIST" "DEFTYPE-LAMBDA-LIST" "VALID-FUNCTION-NAME-P" "FIND-DEFINITION-SOURCE" @@ -414,22 +415,30 @@ If an unsupported TYPE is requested, the function will return NIL. ;; FIXME there may be other structure predicate functions (member self (list *struct-predicate*)))) -;;; FIXME: maybe this should be renamed as FUNCTION-LAMBDA-LIST? (defun function-arglist (function) + "Deprecated alias for FUNCTION-LAMBDA-LIST." + (function-lambda-list function)) + +(define-compiler-macro function-arglist (function) + (sb-int:deprecation-warning 'function-arglist 'function-lambda-list) + `(function-lambda-list ,function)) + +(defun function-lambda-list (function) "Describe the lambda list for the extended function designator FUNCTION. -Works for special-operators, macros, simple functions, -interpreted functions, and generic functions. Signals error if -not found" +Works for special-operators, macros, simple functions, interpreted functions, +and generic functions. Signals an error if FUNCTION is not a valid extended +function designator." (cond ((valid-function-name-p function) - (function-arglist (or (and (symbolp function) - (macro-function function)) - (fdefinition function)))) + (function-lambda-list (or (and (symbolp function) + (macro-function function)) + (fdefinition function)))) ((typep function 'generic-function) (sb-pcl::generic-function-pretty-arglist function)) #+sb-eval ((typep function 'sb-eval:interpreted-function) (sb-eval:interpreted-function-lambda-list function)) - (t (sb-kernel:%simple-fun-arglist (sb-kernel:%fun-fun function))))) + (t + (sb-kernel:%simple-fun-arglist (sb-kernel:%fun-fun function))))) (defun deftype-lambda-list (typespec-operator) "Returns the lambda list of TYPESPEC-OPERATOR as first return diff --git a/contrib/sb-introspect/test-driver.lisp b/contrib/sb-introspect/test-driver.lisp index 8762f2b..4c0ac1f 100644 --- a/contrib/sb-introspect/test-driver.lisp +++ b/contrib/sb-introspect/test-driver.lisp @@ -7,12 +7,12 @@ (with-compilation-unit (:source-plist (list :test-outer "OUT")) (load (compile-file (merge-pathnames "test.lisp" *load-pathname*)))) -(assert (equal (function-arglist 'cl-user::one) +(assert (equal (function-lambda-list 'cl-user::one) '(cl-user::a cl-user::b cl-user::c))) -(assert (equal (function-arglist 'the) +(assert (equal (function-lambda-list 'the) '(sb-c::value-type sb-c::form))) -(assert (equal (function-arglist #'(sb-pcl::slow-method cl-user::j (t))) +(assert (equal (function-lambda-list #'(sb-pcl::slow-method cl-user::j (t))) '(sb-pcl::method-args sb-pcl::next-methods))) (let ((source (find-definition-source #'cl-user::one))) @@ -76,11 +76,11 @@ (sb-profile:unprofile cl-user::one) -;;;; Check correctness of FUNCTION-ARGLIST. +;;;; Check correctness of FUNCTION-LAMBDA-LIST. -(assert (equal (function-arglist 'cl-user::one) +(assert (equal (function-lambda-list 'cl-user::one) '(cl-user::a cl-user::b cl-user::c))) -(assert (equal (function-arglist 'the) +(assert (equal (function-lambda-list 'the) '(sb-c::value-type sb-c::form))) ;;; Check wrt. interplay of generic functions and their methods. @@ -99,7 +99,7 @@ ;; (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux morep more-context more-count) - (sb-int:parse-lambda-list (function-arglist #'xuuq)) + (sb-int:parse-lambda-list (function-lambda-list #'xuuq)) (assert (equal required '(gf.a gf.b))) (assert (null optional)) (assert (and restp (eql rest 'gf.rest))) @@ -117,7 +117,7 @@ (defmethod kroolz (r1 r2 &optional opt &aux aux) (declare (ignore r1 r2 opt aux)) 'kroolz) -(assert (equal (function-arglist #'kroolz) '(r1 r2 &optional opt))) +(assert (equal (function-lambda-list #'kroolz) '(r1 r2 &optional opt))) ;;;; Test finding a type that isn't one (assert (not (find-definition-sources-by-name 'fboundp :type))) diff --git a/doc/manual/docstrings.lisp b/doc/manual/docstrings.lisp index 1177d3d..86b1212 100644 --- a/doc/manual/docstrings.lisp +++ b/doc/manual/docstrings.lisp @@ -388,7 +388,7 @@ there is no corresponding docstring." (cond ((or key optional) (car x)) (t (clean (car x)))) (clean (cdr x) :key key :optional optional)))))) - (clean (sb-introspect:function-arglist (get-name doc)))))))) + (clean (sb-introspect:function-lambda-list (get-name doc)))))))) (defun documentation< (x y) (let ((p1 (position (get-kind x) *ordered-documentation-kinds*)) diff --git a/version.lisp-expr b/version.lisp-expr index 907579b..d53532f 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.24.4" +"1.0.24.5" -- 1.7.10.4