From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: lexicons Date: Tue, 30 Jul 2013 23:47:58 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1375246471 10401 80.91.229.3 (31 Jul 2013 04:54:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Jul 2013 04:54:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 31 06:54:32 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V4OQf-0002Rz-1E for ged-emacs-devel@m.gmane.org; Wed, 31 Jul 2013 06:54:29 +0200 Original-Received: from localhost ([::1]:58456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4OQe-0006ez-M1 for ged-emacs-devel@m.gmane.org; Wed, 31 Jul 2013 00:54:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4OQV-0006ej-OJ for emacs-devel@gnu.org; Wed, 31 Jul 2013 00:54:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4OQO-0003Aw-DQ for emacs-devel@gnu.org; Wed, 31 Jul 2013 00:54:19 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:17164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4NOJ-0002IB-GF; Tue, 30 Jul 2013 23:47:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpZvt/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAaxH5AOkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFFpZvt/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJC6HcAaxH5AOkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="20223188" Original-Received: from 69-165-155-237.dsl.teksavvy.com (HELO pastel.home) ([69.165.155.237]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 30 Jul 2013 23:47:52 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 3215A66E5D; Tue, 30 Jul 2013 23:47:58 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Tue, 30 Jul 2013 17:55:44 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162280 Archived-At: > I read the documentation of lexicons, and they seem to solve the > problems that made me dislike CL packages. I also prefer the semantics of lexicon over that of CL packages. But I don't think this would fly for Elisp, because it completely separates the notion of symbol from the notion of its binding, so things like (symbol-value 'foo) don't behave like `foo' any more, so it's a pretty drastic change. I think what you don't like is this idea of "look around in various obarrays to find the symbol that is meant". I tend to agree here: doing it at compile/run-time (as in the case of lexicons) might be acceptable (because you can then distinguish definitions from uses), but doing it at read-time is more problematic, especially when one of the obarrays is the global one which can hold any kind of random crap thanks to the myriad of poorly written packages, or because of code copy&pasted from the web into the user's ~/.emacs. While some people think that even a 3-letter prefix is completely unacceptable (I'll let you guess which prefix I'm thinking about), I tend to think that using prefixes is not that bad, as long as they're kept short. But I agree that there's a problem here: we want prefixes in the code to be short, but namespace cleanliness wants us to use longish prefixes. So maybe the solution is simply to provide prefix shorthands. Chose a "prefix char" (there's a good time for bikeshedding here), let's say | for now. Then you could define (file-locally): prefixes-alist: '(("" "mypackage-") ("gs" "gnus-summary-")) and then use `|foo' as a shorthand for `mypackage-foo' and `gs|bar' as a shorthand for `gnus-summary-bar'. It's still a read-time operation (which means that it will work just fine with people's bad habits of using ' to quote code and things like that), but it doesn't suffer from the ambiguity of a search through various obarrays. This wouldn't let you "import without a prefix", but it would free people to use longish prefixes, since you can locally shorten the ones you care about (a common practice in the SML module system, where you typically import modules while renaming them to a very short (1 or 2 chars) local name). Stefan