From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Proper namespaces in Elisp Date: Sat, 9 May 2020 20:11:05 +0100 Message-ID: References: <87ftcee7td.fsf@tromey.com> <87pnbgzdmx.fsf@tromey.com> <1225997b-648a-068d-7f6b-e1575477a0d0@dancol.org> <875zd62qy7.fsf@t510.orion.oneofus.la> <09ed390e-c735-3a7e-ecfd-504557b192a2@dancol.org> <87368a2d1a.fsf@t510.orion.oneofus.la> <4fa3c120-b7f4-2c75-ae3b-0a95bf7d4823@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="88673"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tom Tromey , emacs-devel , Stefan Monnier , Andrea Corallo To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 09 21:11:52 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 1jXUt5-000Mzm-7e for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 21:11:51 +0200 Original-Received: from localhost ([::1]:50714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXUt3-0005Os-Ls for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 15:11:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXUsa-0004zX-CM for emacs-devel@gnu.org; Sat, 09 May 2020 15:11:20 -0400 Original-Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]:36342) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXUsY-0001GM-Tl for emacs-devel@gnu.org; Sat, 09 May 2020 15:11:20 -0400 Original-Received: by mail-il1-x12b.google.com with SMTP id c16so4617122ilr.3 for ; Sat, 09 May 2020 12:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CxtUboyf6/tLWkHHzDAD1HI01uy+qhvwwf6iiL372dA=; b=VlLBaEOjt3GXlzOJ166Yy3guQ/CxMjUaewZEzu4TFOYruKMc2eLkCXNhp8hfORo5kY U3XbBAoFSLwTSezBIm4EEcxGSdLP2tfL7NGM6HAevcvn57+vp1VyXdt0Ga2c4TFvSwYU vN3VFz2E4JHudmaaFX2+m7vHBG6sghMadK8MCiju6Mw2EWP6kH57iyIhJpUUBIRjP0rz 8M6DYnHRdOAO/Irp4upOYHC7q63W3wPOyliv4t/7GEglMV7NvUKXvIpjV07fPQHDtO5u v5C4DZgF5odtM9MH1pfufal5h8SP5ZpXQxCX2PeqfkKtBJW8smn5+7zwlXewiR8OOVWA 1jbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CxtUboyf6/tLWkHHzDAD1HI01uy+qhvwwf6iiL372dA=; b=Buc54gAMVbcs5K64FSOLwwZZxK3h4QWQjXW20D14hwUsl+Zy88C+UbPzt3oq3ovLoI 9t5PhIZckeNQ3gOgKYUYTJMLDL1Nv5/aDBHMuWEQSjvhr9f4RUDEKFK3uxSSxphqH8C2 3EmBZkkimHRZ5R+gbBfKWP+61DcOtb/wfH3hyxRLNUik4Z04+O+GhMa3/IjMjMOYnt3U 5uOvFoWeI2Du8EIdLTuFG8fU50/haI2kpOX3Ej4bHGwyNG7fuTERhGAEvqmrpxte4gk5 j1268Eb+p8WvxY6bTSoZqgp7RB7hVVHSo9r8OotjKp6POg+18TbVD24MhhA5gAqWPcr+ EBCQ== X-Gm-Message-State: AGi0Puaasp1XK0TNviA/+IzsEy4dBt1/w8EDQFIQ/p8pRbTjhN11vU7E fb7bceyyxhu5Geg/GHLvydqEnSQJ1y6b6eEXEuY= X-Google-Smtp-Source: APiQypKh6pbotIvW3pzC5kwtnsjJibwfj9n8jHMYJgrnNhuyryeuIo+LKrvfYfIlFndNUTEoUTOKc0VqwXZ5o1VCINY= X-Received: by 2002:a05:6e02:13a5:: with SMTP id h5mr3401260ilo.199.1589051477798; Sat, 09 May 2020 12:11:17 -0700 (PDT) In-Reply-To: <4fa3c120-b7f4-2c75-ae3b-0a95bf7d4823@dancol.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::12b; envelope-from=joaotavora@gmail.com; helo=mail-il1-x12b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_FROM=0.001, FROM_EXCESS_BASE64=0.979, RCVD_IN_DNSWL_NONE=-0.0001, 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:249555 Archived-At: On Sat, May 9, 2020 at 7:39 PM Daniel Colascione wrote: > > On 5/9/20 11:35 AM, Jo=C3=A3o T=C3=A1vora wrote: > > On Sat, May 9, 2020 at 7:32 PM Daniel Colascione wr= ote: > >> > >> > >> > >> On 5/9/20 11:23 AM, Jo=C3=A3o T=C3=A1vora wrote: > >>> On Sat, May 9, 2020 at 6:45 PM Daniel Colascione >>> > wrote: > >>> > >>> > >>> Can you give a concrete example of a situation in which it'd be > >>> useful to > >>> do that? I think other people on the thread are right about > >>> discouraging > >>> bulk naked symbol imports. > >>> > >>> > >>> For a submodule that you do control, it's not such a bad idea. > >> > >> Concrete example? If you want inheritance, you can get it with EIEIO. > > > > When writing a namespaced foo-tests.el library for your namespaced > > foo.el library, for example. Or for a big enough foo program, a foo-ut= ils.el > > that exports utils that only foo.el needs and noone else. > > Why not just re-enter the same namespace in your test file then? > What problem are you actually trying to solve here? In my foo-test.el file I have definitions, too. I don't want those definiti= ons to enter my foo namespace. It's very simple to follow. I don't know what you call module inheritance. Look, you know the CL pack= age system right? I'll just speak CL then, if you don't mind: ;; foo-utils .lisp (defpackage :foo-utils (:use :cl) (:export #:add-two)) (in-package :foo-utils) (defun contorted-two-adder (x) (+ 1 1 x)) (defun add-two (x) (contorted-two-adder x)) ;; foo.lisp (defpackage :foo (:use :cl :foo-utils) (:export #:bar)) (in-package :foo) (defun bar () (add-two 40)) ;; foo-tests.lisp (defpackage :foo-tests (:use :cl :foo)) (in-package :foo-tests) (defun check-forty-two-ness () (unless (eq (bar) 42)) (error "oh noes"))) Hope I didn't make many mistakes typing this in Gmail... > package name prefix length, you can fix it with symbol rewriting without > a ton of other complexity. I don't see a *need* for module inheritance Again I don't know what you call "module inheritance". Maybe we're just mis-communicating. I'm just describing bog-standard "hide the implementation" stuff. I was suggesting reasonable uses of :USE, or what I think you called "bulk symbol imports", i.e. merging two namespaces. Jo=C3=A3o