From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Vladimir Sedach Newsgroups: gmane.emacs.devel Subject: Re: Proper namespaces in Elisp Date: Fri, 08 May 2020 11:59:28 -0700 Message-ID: <875zd62qy7.fsf@t510.orion.oneofus.la> References: <87ftcee7td.fsf@tromey.com> <87pnbgzdmx.fsf@tromey.com> <1225997b-648a-068d-7f6b-e1575477a0d0@dancol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="15018"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.3.10; emacs 26.2 Cc: Tom Tromey , emacs-devel@gnu.org, Stefan Monnier , =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 08 21:23:17 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 1jX8aZ-0003lt-LJ for ged-emacs-devel@m.gmane-mx.org; Fri, 08 May 2020 21:23:15 +0200 Original-Received: from localhost ([::1]:34588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX8aY-0001oS-Nr for ged-emacs-devel@m.gmane-mx.org; Fri, 08 May 2020 15:23:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX8Zr-00012d-Gp for emacs-devel@gnu.org; Fri, 08 May 2020 15:22:31 -0400 Original-Received: from forward102p.mail.yandex.net ([77.88.28.102]:59221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX8Zp-0003Gu-8g for emacs-devel@gnu.org; Fri, 08 May 2020 15:22:30 -0400 Original-Received: from mxback28g.mail.yandex.net (mxback28g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:328]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 84CD21D400BA; Fri, 8 May 2020 22:22:23 +0300 (MSK) Original-Received: from iva8-174eb672ffa9.qloud-c.yandex.net (iva8-174eb672ffa9.qloud-c.yandex.net [2a02:6b8:c0c:b995:0:640:174e:b672]) by mxback28g.mail.yandex.net (mxback/Yandex) with ESMTP id cKVkXqLsXc-MNDuEvBq; Fri, 08 May 2020 22:22:23 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oneofus.la; s=mail; t=1588965743; bh=3Btyttg0+vQLGIG9U9/VgRtVKCClKSUGb/qHf3oAnYg=; h=In-reply-to:Subject:Cc:To:From:Date:References:Message-ID; b=LNZQGU/1tnKX1OWMMVUxuuHZJxxK4r+fdwayJNrVIGQqpqap1xWvqjlD9mdwOYV47 N4Tl6D88EFlQge+XfEl8G9/DXxmVKQTmtPuVobUq4rQeQJXH+1Mw1VwMgE7c8+SKk3 ++MkToIzGe94PvlFN4IIqkQElWZvuBNJqJIsI8R4= Authentication-Results: mxback28g.mail.yandex.net; dkim=pass header.i=@oneofus.la Original-Received: by iva8-174eb672ffa9.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id fYALw1NXw8-MK28OcRP; Fri, 08 May 2020 22:22:22 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) In-reply-to: <1225997b-648a-068d-7f6b-e1575477a0d0@dancol.org> Received-SPF: pass client-ip=77.88.28.102; envelope-from=vas@oneofus.la; helo=forward102p.mail.yandex.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/08 15:22:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:249319 Archived-At: Daniel Colascione writes: > Common Lisp does deal with this problem in some cases, e.g., in LOOP. > We should be moving forwards keywords anyway. LOOP would not even have to deal with that if namespaces were over bindings, like Andrea suggested, and what Scheme module systems do. > FWIW, I think elisp should just literally copy Common Lisp's > approach. Please see this other sub-thread where I explain why this is a really bad idea: https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00623.html > It's tried and tested, and the pitfalls are well-understood. Well-understood enough where people want to throw away most of how it does namespace imports, and have a backward-compatible replacement ready this year: https://gist.github.com/phoe/2b63f33a2a4727a437403eceb7a6b4a3 There is no need to repeat the same mistakes. Andrea's proposal for namespacing over bindings/Scheme's approach avoids mangling the reader, does not cause problems for the printer, and does not make code resort to symbol-name hacks like LOOP does. Scheme's approach to namespacing has a lot of advantages over Common Lisp's. We can also avoid the "namespace multiple inheritance" problems of unintended re-definition and import conflicts if we combine Jo=C3=A3o's approach of declaring prefixes with the ideas of package-local nicknames and namespaces over bindings. Here is how that might look: --8<---------------cut here---------------start------------->8--- (declare-namespace jennys-awesome-string-library (use elisp29) (export foo)) (declare-namespace jonnys-amazing-syntax-library (use elisp29) (export foo)) (declare-namespace some-new-library (use elisp30) (import jennys-awesome-string-library st-) (import jonnys-amazing-syntax-library sy-)) --8<---------------cut here---------------end--------------->8--- In some-new-library, st-foo refers unambiguously to the binding of foo in jennys-awesome-string-library, and sy-foo to the binding of foo in jonnys-amazing-syntax-library. If a package wants a literal quoted symbol like 'string as input somewhere, or as a literal in a macro (LOOP), that is no problem (it would be in Common Lisp!). No modifications to the reader or printer needed. You can even specify the prefix to end in a semicolon, and it looks like Common Lisp. I think a visually distinct separator like a semicolon has a lot of legibility advantages, and this scheme lets you choose whatever you prefer. -- Vladimir Sedach Software engineering services in Los Angeles https://oneofus.la