[slime-devel] [RfC] call-with-foo indentation magic

I'd like to have a function (defun call-with-foo (a b function) ...) be indented like (call-with-foo (foo 1 2 3) (bar 9 8 7) #'(lambda (x) ...)) I'm tempted to change SWANK indentation update code to recognize and treat specially functions starting with CALL-WITH, and having a last parameter named FUNCTION or CONTINUATION. I could see people not wanting it, so let me ask what you guys think. Should this be default behaviour, go to a contrib, or should I be damned for raising the question? -T.

* Tobias C Rittweiler [2010-08-20 08:21] writes:
I'd like to have a function
(defun call-with-foo (a b function) ...)
be indented like
(call-with-foo (foo 1 2 3) (bar 9 8 7) #'(lambda (x) ...))
Still very verbose: call-with- + lambda, or in your case call-with- + #' + lambda, is a lot of noise. Seems like a bad idiom to me.
I'm tempted to change SWANK indentation update code to recognize and treat specially functions starting with CALL-WITH, and having a last parameter named FUNCTION or CONTINUATION.
I could see people not wanting it, so let me ask what you guys think. Should this be default behaviour, go to a contrib, or should I be damned for raising the question?
I don't want that as default. IMO a better solution would be a defining macro that defines call-with-X functions and automatically the corresponding with-X macros with appropriate use of &body. The same approach could also deal with do-X style macros. Helmut

our take on the issue is available at: http://dwim.hu/darcsweb/darcsweb.cgi?r=HEAD%20hu.dwim.def;a=headblob;f=/test... it's basically a macro that defines both a call-with-... function and a with-... macro. the body is written as if it was the body of the call-with... function, but there's a lexically visible function similarly to (call-next-method) to invoke the user given forms. -- attila

In article <m239u98tqd.fsf@common-lisp.net>, Helmut Eller <heller@common-lisp.net> wrote:
* Tobias C Rittweiler [2010-08-20 08:21] writes:
I'd like to have a function
(defun call-with-foo (a b function) ...)
be indented like
(call-with-foo (foo 1 2 3) (bar 9 8 7) #'(lambda (x) ...))
Still very verbose: call-with- + lambda, or in your case call-with- + #' + lambda, is a lot of noise. Seems like a bad idiom to me.
It's less noisy than writing the LET+UWP directly that usually is what CALL-WITH boils down to. I usually refactor from LET+UWP into CALL-WITH, not thinking much about the interface, and only when I made up an opinion about the interface I go to a WITH- macro.
I'm tempted to change SWANK indentation update code to recognize and treat specially functions starting with CALL-WITH, and having a last parameter named FUNCTION or CONTINUATION.
I could see people not wanting it, so let me ask what you guys think. Should this be default behaviour, go to a contrib, or should I be damned for raising the question?
I don't want that as default.
Noted. -T.
participants (3)
-
Attila Lendvai
-
Helmut Eller
-
Tobias C Rittweiler