From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: ELisp function prototypes and local function name Date: Fri, 08 Apr 2011 00:43:44 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87fwpt70xb.fsf@lifelogs.com> References: <87ei5fqz6h.fsf@lifelogs.com> <87k4f7pe2f.fsf@lifelogs.com> <874o6arjpz.fsf@uwakimon.sk.tsukuba.ac.jp> <87mxk27q3d.fsf@lifelogs.com> <871v1erb9j.fsf@uwakimon.sk.tsukuba.ac.jp> <8739ltrdix.fsf@lifelogs.com> <87mxk1crxg.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1302241464 8943 80.91.229.12 (8 Apr 2011 05:44:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Apr 2011 05:44:24 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 08 07:44:20 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q84UW-0006Ew-LN for ged-emacs-devel@m.gmane.org; Fri, 08 Apr 2011 07:44:20 +0200 Original-Received: from localhost ([127.0.0.1]:49572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q84UW-0000Rx-4V for ged-emacs-devel@m.gmane.org; Fri, 08 Apr 2011 01:44:20 -0400 Original-Received: from [140.186.70.92] (port=37119 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q84UC-0000Qi-S9 for emacs-devel@gnu.org; Fri, 08 Apr 2011 01:44:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q84UB-0006wt-V4 for emacs-devel@gnu.org; Fri, 08 Apr 2011 01:44:00 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:59322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q84UB-0006wl-Km for emacs-devel@gnu.org; Fri, 08 Apr 2011 01:43:59 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q84U9-00068s-CX for emacs-devel@gnu.org; Fri, 08 Apr 2011 07:43:57 +0200 Original-Received: from c-67-186-102-106.hsd1.il.comcast.net ([67.186.102.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 08 Apr 2011 07:43:57 +0200 Original-Received: from tzz by c-67-186-102-106.hsd1.il.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 08 Apr 2011 07:43:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: c-67-186-102-106.hsd1.il.comcast.net X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:5w3N1FMGwpe6ZHMJNniem5kNuTA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138303 Archived-At: On Fri, 08 Apr 2011 13:01:31 +0900 "Stephen J. Turnbull" wrote: SJT> Ted Zlatanov writes: >> It looks like the XEmacs `function-arglist' is not useful, in any case. >> It depends too much on the underlying implementation. SJT> Sure, but in XEmacs there's only one such (with three parts: one for SJT> subrs, one for lambda lists, and one for byte-code objects). Random SJT> third-party stuff won't work, but it doesn't have to; random third SJT> parties can and should use the defined API. That's hardly a SJT> controversial concept. SJT> Evidently this won't work in Emacs out of the box, but surely it's SJT> worth moving in that direction, and having third parties with "better SJT> ideas" for basic introspection contribute them to core rather than SJT> implement them in complex and fragile packages like eieio? I'm OK with `function-arglist' in Emacs but I'm not the one to implement it. I don't know enough about the concepts. I looked through the C source to learn more and here's what I found: 1) my examples with `mapc' and `mapcar' were not good, since those are built-in functions. `help-function-arglist' is in fact the best Emacs in-core solution and will provide the arguments when possible. I think the same situation is valid in XEmacs. I simply didn't understand what it does when I tested it on `mapc' and assumed it generally couldn't provide the arguments. 2) Lambdas, closures, macros, and byte-compiled functions have the arguments to build the function arglist with the argument names. You just need to look with `aref' or `nth' in the right place. 3) built-in functions like `mapc' don't provide their argument names, just the number of arguments with `subr-arity'. So their `symbol-function' will return a #subr object and the symbol doesn't have a function definition in its "function" slot (nor can it, since it's C code). So `*function-arglist' in Emacs and XEmacs do the best they can, but it would be nice if DEFUN could do more to provide the names of the arguments. It would involve either changing DEFUN, though, or trusting the docstring as `eldoc-function-argstring' does. I think it would make sense to put at least some of this in the ELisp manual. If it's already in there, I didn't see it. It was really educational to discover it for myself :) Ted