From: Andras S. <as...@ma...> - 2004-06-18 10:36:14
|
I don't know how hard it would be to record the arglists of (file-)compiled functions and macros, but it'd be very useful. Andras |
From: Peter G. <pe...@ar...> - 2004-06-18 15:27:17
|
On Fri, 18 Jun 2004 at 12:36:07 +0200, Andras Simon wrote: > I don't know how hard it would be to record the arglists of (file-)compiled > functions and macros, but it'd be very useful. Well, it shouldn't be too hard, but I made a quick try at it and failed. (I'm supposed to be on vacation, so I didn't try very hard.) In any event, ABCL's file compilation is not really mature enough yet to start adding this sort of feature; future changes are sure to break it. -Peter |
From: Andras S. <as...@ma...> - 2004-06-18 15:37:44
|
On Fri, 18 Jun 2004, Peter Graves wrote: > On Fri, 18 Jun 2004 at 12:36:07 +0200, Andras Simon wrote: > > I don't know how hard it would be to record the arglists of (file-)compiled > > functions and macros, but it'd be very useful. > > Well, it shouldn't be too hard, but I made a quick try at it and > failed. (I'm supposed to be on vacation, so I didn't try very hard.) Thanks for giving it a try! Have a nice vacation, Andras |
From: Andras S. <as...@ma...> - 2004-09-18 15:36:36
|
On Fri, 18 Jun 2004, Peter Graves wrote: > On Fri, 18 Jun 2004 at 12:36:07 +0200, Andras Simon wrote: >> I don't know how hard it would be to record the arglists of (file-)compiled >> functions and macros, but it'd be very useful. > > Well, it shouldn't be too hard, but I made a quick try at it and > failed. (I'm supposed to be on vacation, so I didn't try very hard.) The following patch seems to do the job, but I'm hesitant to commit it, because it can't be this simple if your quick try didn't work. RCS file: /cvsroot/armedbear-j/j/j/src/org/armedbear/lisp/compile-file.lisp,v retrieving revision 1.42 diff -u -r1.42 compile-file.lisp --- org/armedbear/lisp/compile-file.lisp 15 Sep 2004 18:36:23 -0000 1.42 +++ org/armedbear/lisp/compile-file.lisp 18 Sep 2004 15:07:40 -0000 @@ -103,9 +103,11 @@ (%format t "; ~A => ~A.cls~%" name (pathname-name (pathname classfile-name))) (setf form - `(fset ',name - (load-compiled-function ,(file-namestring classfile)) - ,*source-position*)) + `(progn + (fset ',name + (load-compiled-function ,(file-namestring classfile)) + ,*source-position*) + ,(when (symbolp name) `(%set-arglist ',name ',lambda-list)))) (when compile-time-too (fset name compiled-function))) (progn @@ -136,14 +138,16 @@ (%format t "; Macro ~A => ~A.cls~%" name (pathname-name (pathname classfile-name))) (setf form - (if (special-operator-p name) - `(%put ',name 'macroexpand-macro - (make-macro (load-compiled-function - ,(file-namestring classfile)))) - `(fset ',name - (make-macro (load-compiled-function - ,(file-namestring classfile))) - ,*source-position*)))) + `(progn + ,(if (special-operator-p name) + `(%put ',name 'macroexpand-macro + (make-macro (load-compiled-function + ,(file-namestring classfile)))) + `(fset ',name + (make-macro (load-compiled-function + ,(file-namestring classfile))) + ,*source-position*)) + (%set-arglist ',name ',(third form))))) (%format t "; Unable to compile macro ~A~%" name))))) (DEFTYPE (eval form)) > In any event, ABCL's file compilation is not really mature enough yet > to start adding this sort of feature; future changes are sure to break > it. Perhaps if this, or some similarly simple hack works for just a few weeks, it's already worth the trouble. Andras |
From: Peter G. <pe...@ar...> - 2004-09-18 18:09:12
|
On Sat, 18 Sep 2004 at 17:36:22 +0200, Andras Simon wrote: > The following patch seems to do the job, but I'm hesitant to commit > it, because it can't be this simple if your quick try didn't work. I no longer remember what I ran into when I looked at this in June, but your patch does indeed seem to do the job, and I've committed a slightly revised version of it. (By complete coincidence, I was working on the arglist code in slime-for-j when your mail arrived.) I ended up doing it by changing FSET to take another optional parameter for the arglist, which I think will be more efficient at fasl load time. Doing it this way leaves the special operator case without arglist support, but that's probably not a big deal. The new code is now in CVS. > Perhaps if this, or some similarly simple hack works for just a few > weeks, it's already worth the trouble. I agree. Please let me know if this works for you. Thanks! -Peter |
From: Andras S. <as...@ma...> - 2004-09-18 19:27:01
|
On Sat, 18 Sep 2004, Peter Graves wrote: > I ended up doing it by changing FSET to take another optional parameter > for the arglist, which I think will be more efficient at fasl load time. Yes, I also thought that FSET was the natural place for this, but I didn't dare to mess with it. > Please let me know if this works for you. It does. Thanks! Andras |
From: Andras S. <as...@ma...> - 2004-09-19 14:33:56
|
On Sat, 18 Sep 2004, Peter Graves wrote: > Doing it this way leaves the special operator case without arglist > support, but that's probably not a big deal. How about a new constructor public SpecialOperator(String name, String arglist) { this(name); setArglist(new SimpleString(arglist)); } and then I'd be happy to fill in the missing arglists as I encounter them. The only problem I see is where to get the arglists from. I'm not sure that the HS is as good a source as in the case of functions. I.e. (labels ((function-name lambda-list [[local-declaration* | local-documentation]] local-form*)*) declaration* form*) in the HS vs (labels definitions &body body) in SBCL. Andras |
From: Peter G. <pe...@ar...> - 2004-09-19 15:48:28
|
On Sun, 19 Sep 2004 at 16:33:52 +0200, Andras Simon wrote: > How about a new constructor > > public SpecialOperator(String name, String arglist) > { > this(name); > setArglist(new SimpleString(arglist)); > } > > and then I'd be happy to fill in the missing arglists as I encounter > them. Good suggestion! Make it happen! > The only problem I see is where to get the arglists from. I'm not sure > that the HS is as good a source as in the case of functions. I.e. > > (labels ((function-name lambda-list [[local-declaration* | > local-documentation]] local-form*)*) declaration* form*) > > in the HS vs > > (labels definitions &body body) > > in SBCL. I agree. I've already started to make a few changes to improve on the CLHS arglists. For example, I changed (car x) to (car list) for car, cdr, cadr, etc. We should try to stay with the CLHS arglist unless it's particularly unhelpful or verbose. When in doubt, SBCL is an arbiter of good taste in this area (as in many others). -Peter |