From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Enhancement suggestion: prin1 extension mechanism Date: Sat, 13 Sep 2008 23:13:03 +0200 Message-ID: References: <200809110325.m8B3PYFE031034@projectile.siege-engine.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1221340289 15496 80.91.229.12 (13 Sep 2008 21:11:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Sep 2008 21:11:29 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 13 23:12:25 2008 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.50) id 1KecPl-0007XE-NL for ged-emacs-devel@m.gmane.org; Sat, 13 Sep 2008 23:12:22 +0200 Original-Received: from localhost ([127.0.0.1]:34860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KecOk-0001Bl-V0 for ged-emacs-devel@m.gmane.org; Sat, 13 Sep 2008 17:11:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KecOf-00018Z-14 for emacs-devel@gnu.org; Sat, 13 Sep 2008 17:11:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KecOd-00015g-Il for emacs-devel@gnu.org; Sat, 13 Sep 2008 17:11:12 -0400 Original-Received: from [199.232.76.173] (port=58336 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KecOd-00015N-BM for emacs-devel@gnu.org; Sat, 13 Sep 2008 17:11:11 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:37944 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KecOd-0006S1-Ho for emacs-devel@gnu.org; Sat, 13 Sep 2008 17:11:11 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KecOZ-00016M-Ss for emacs-devel@gnu.org; Sat, 13 Sep 2008 21:11:07 +0000 Original-Received: from dialin-226052.rol.raiffeisen.net ([195.254.226.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 13 Sep 2008 21:11:07 +0000 Original-Received: from eller.helmut by dialin-226052.rol.raiffeisen.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 13 Sep 2008 21:11:07 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 25 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dialin-226052.rol.raiffeisen.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:14iH2W8YusCs5Uz0u0TFM40//I4= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:103874 Archived-At: * Stefan Monnier [2008-09-13 21:22+0200] writes: >> Instead of changing the internal representation, you could allow entries >> for vector and cons etc. in the printer table. That's how Common Lisp >> allows you to customize the printer for built-in types. > > I fear it'd be difficult to make it work without incurring a significant > performance overhead. If the table is nil you could use the default hardcoded printer without lookups. If the entries in the table can be accessed from Lisp code, we could remember the default print function for a type before installing a custom printer. E.g. if a vector doesn't have the special symbol in the first entry, we could call the previously remembered default printer instead of iterating manually over the vector. Recursive calls to print would again use the custom print function. It seems to me that, compared to testing for circularity, those table lookups would only introduce a minor slowdown. And if someone produces so much output the that it takes to long to print, he probably doesn't want to read it anyway :-) Helmut.