From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Proper namespaces in Elisp Date: Fri, 8 May 2020 12:34:49 -0700 Message-ID: <09ed390e-c735-3a7e-ecfd-504557b192a2@dancol.org> References: <87ftcee7td.fsf@tromey.com> <87pnbgzdmx.fsf@tromey.com> <1225997b-648a-068d-7f6b-e1575477a0d0@dancol.org> <875zd62qy7.fsf@t510.orion.oneofus.la> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="73596"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , Tom Tromey , Stefan Monnier , emacs-devel@gnu.org To: Vladimir Sedach Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 08 21:36:58 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 1jX8np-000J0J-Fs for ged-emacs-devel@m.gmane-mx.org; Fri, 08 May 2020 21:36:57 +0200 Original-Received: from localhost ([::1]:43824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX8no-0000Jq-ES for ged-emacs-devel@m.gmane-mx.org; Fri, 08 May 2020 15:36:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX8ls-00087a-0V for emacs-devel@gnu.org; Fri, 08 May 2020 15:34:56 -0400 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:37994) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX8lq-0001Ls-Oy for emacs-devel@gnu.org; Fri, 08 May 2020 15:34:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iTYASXnAkUbQ7aNBNtbSqk+u8OnjqSYFRAKjbU5LzyU=; b=rRwAICumiSgBwUM6/x+dMw8gpl QiZWhyVIp0AZrRx1d0ZpVIKslSSnX1iRPbZLb09z6DFU5USwRIh6pFKsTqyz2zc2pDkv077dfpefg G6YxHmzuoYB051un9SfxpCLlioTpTEKeqQMm08arm5PHYPSPMiAfqK3cA4s2P+O3mb1sMrKTGDE5A PVbsJy587+wZN/yz+7CP3uEOG5PlgqcfiZYDTk2jyz+z//c8uk5cY70t1bwlDCrzYM6t6YQsNaf2i A5tCFQNEa7gimPO/u3ErGdWIlc2W58WsrqNKV0jJC/vpWmL7ZHx9QGV75tf5y8yE8KID0fcjWTfxj hbhZNSpg==; Original-Received: from [2604:4080:1321:9a00:3d60:5fe6:8cb4:e9e6] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jX8lm-0003h4-Sd; Fri, 08 May 2020 12:34:50 -0700 In-Reply-To: <875zd62qy7.fsf@t510.orion.oneofus.la> Content-Language: en-US Received-SPF: pass client-ip=2600:3c01::f03c:91ff:fedf:adf3; envelope-from=dancol@dancol.org; helo=dancol.org X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_SBL_CSS=3.335, SPF_HELO_PASS=-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:249320 Archived-At: On 5/8/20 11:59 AM, Vladimir Sedach wrote: > > 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 I wouldn't call package-local nicknames "throw[ing] away" the namespace system. The post describes a logical extension. Is your argument that the CL namespace system (suitably extended) *allows* people to do silly things (like :use) even though it doesn't require that they do? > 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ão'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-)) Fair enough. What about requiring that a colon separate the module prefix from the remainder of the symbol? Using a dash seems ripe for misinterpretation, but someone reading a symbol containing colon (in a way that looks vaguely reminiscent of CL) would know to look for a namespace alias instead of searching in vain for some global definition of st-foo or sy-foo.