From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Zhu Zihao Newsgroups: gmane.emacs.devel Subject: Re: Any convenient way for cl-generic to dispatch on a callable Lisp Object? Date: Mon, 20 Apr 2020 23:32:41 +0800 Message-ID: <87pnc29nqe.wl-all_but_last@163.com> References: <87r1wia64r.wl-all_but_last@163.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="43712"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.8 EasyPG/1.0.0 Emacs/27.0 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: Zhu Zihao , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 20 17:36:27 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQYTD-000BG0-CK for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Apr 2020 17:36:27 +0200 Original-Received: from localhost ([::1]:37988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQYTC-0004Bc-E2 for ged-emacs-devel@m.gmane-mx.org; Mon, 20 Apr 2020 11:36:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35232 helo=eggs1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQYPs-0001FT-N4 for emacs-devel@gnu.org; Mon, 20 Apr 2020 11:33:02 -0400 Original-Received: from Debian-exim by eggs1p.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQYPo-00079l-AD for emacs-devel@gnu.org; Mon, 20 Apr 2020 11:32:58 -0400 Original-Received: from m12-13.163.com ([220.181.12.13]:54806) by eggs1p.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jQYPk-000717-VH for emacs-devel@gnu.org; Mon, 20 Apr 2020 11:32:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:Message-ID:From:Subject:MIME-Version; bh=2kviY AjZHO/HyTPiY016ntemcuPL+jiYnBIuUDDQYBU=; b=HO565N13vKIqxk7fh/2Az gLteWB2qS6cFZea47oLei7f2bhw+luOKG6uyzyecJRwKW/xSzWDHC5KljWkMM+hZ t5FHFVJfmAgWIZTSDgWU27AyR1nfakHEQ1cH1OWIVVDcEx9nJnLOeQPc8bG4sunW udBP9EMcJKQfCc13ayalII= Original-Received: from archlinux.163.com (unknown [183.19.168.137]) by smtp9 (Coremail) with SMTP id DcCowACHjSGZwJ1eUqg7Aw--.962S2; Mon, 20 Apr 2020 23:32:44 +0800 (CST) In-Reply-To: X-Face: :]]%@R1{oDt0%iKgI@Kga#OZ; ogt+%OOne&J4#E*O,TIlI)yEFw--I\:3s~EV97GI$1.1!}8inmF9UgtUBB@#8>'8NWNC8qg/v*OLfQB; Z:@G3HeNf3u& ,&HpBGv%?p{bzsl'|5T";1&X X-CM-TRANSID: DcCowACHjSGZwJ1eUqg7Aw--.962S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUUpBTDUUUU X-Originating-IP: [183.19.168.137] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/1tbiKR0Mr1XlvsO3qgAAsH Received-SPF: pass client-ip=220.181.12.13; envelope-from=all_but_last@163.com; helo=m12-13.163.com X-detected-operating-system: by eggs1p.gnu.org: First seen = 2020/04/20 11:32:45 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Received-From: 220.181.12.13 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:247396 Archived-At: Thanks for your reply. I add a custom generalizer for funcall-able Lisp Object now (cl-generic-define-generalizer rstream--callable-generalizer 51 (lambda (name &rest _) `(when (functionp ,name) 'rstream-callable)) (lambda (tag &rest _) (when (eq tag 'rstream-callable) (list tag)))) (cl-defmethod cl-generic-generalizers ((_specializer (eql rstream-callable))) "Support for `stream' specializers." (list rstream--callable-generalizer))