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?VHXhuqVuLUFuaCBOZ3V54buFbg==?= Newsgroups: gmane.emacs.devel Subject: Re: Proper namespaces in Elisp Date: Sat, 9 May 2020 19:06:10 +0700 Message-ID: References: <87ftcee7td.fsf@tromey.com> <87pnbgzdmx.fsf@tromey.com> 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="37115"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Colascione , Tom Tromey , =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 09 14:07:06 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 1jXOG2-0009YV-1h for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 14:07:06 +0200 Original-Received: from localhost ([::1]:36550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jXOG0-0003gj-L4 for ged-emacs-devel@m.gmane-mx.org; Sat, 09 May 2020 08:07:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jXOFS-0002u8-6M for emacs-devel@gnu.org; Sat, 09 May 2020 08:06:30 -0400 Original-Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:32776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jXOFR-0004fT-CZ for emacs-devel@gnu.org; Sat, 09 May 2020 08:06:29 -0400 Original-Received: by mail-pf1-x434.google.com with SMTP id x77so2394984pfc.0 for ; Sat, 09 May 2020 05:06:28 -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=lL0L8GHHETFX35+7w8y2V+7cJncftUvOFYge/Wf//XI=; b=rxbi/XMb7ovofG3ZcE5SgZQXSVQ9o96op0c7TQkfVA0B7eE2ji/5HuzL/7qxUvDSIW Qk+qqdcSRrj+v547H8STAddJVZdfISMxGsH0nrOigNUkjCSOh7Qk3urYP+PGhaVZ3n1x bZE871ioQgIQDj8XVMbpiqwut6QNUTUdACyCEjpj4t0WE9A9owIUvpG1hrHD4uMGkn3W zwk0fMvDZpJVg3reGG6m8vAGpzEeJUOLvlZW/60dD+QEkBm2+jhDGV91ADIUpn4Ti3eE wMkBuJJ+KgZV1/o5O2ZPeu9fWjr48KMKS80toQQrBSuFSRsQlm2z+bC3m/t3zh6L8J1t 9RRQ== 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=lL0L8GHHETFX35+7w8y2V+7cJncftUvOFYge/Wf//XI=; b=jeneVdregnaBuD4QV8T8JZVTyaIAO6vC6ZfxFpfZ910y6UjHh5u8ci90GZYk/V5xep Og2W+re0cqDTEhRO1TYragwXQWrXDAUcvIvTxpVaKLkyPw4IM1zdZs/h/8uYCGvQG18u JEL6WcRSavICYvZl3SiQMY+P8EX/3qVYAnUzJlGt40fvsLfCKawezOBiZXbL58rOeo+7 0JG7IvvojpQIfyNsff8gtsXdGD/Il8fC2qcVMMEXF/qA7DlWv57oCDlhiCMhzet6ZDpa J6gcLNbTqu8UgKQDlPTXDBRqKFGjHvfmCyV5O3HFvQOgrCsY4mHZYZoZvHgRyiWOoD+D 2lbA== X-Gm-Message-State: AGi0PuZF33yU1Gp+1ecwcspyzbtGGLaWbhHc3+R7fjKtiqPxAMR39wS3 MXgmNIavGij6erPilPJjO+kn5hGFcnxSEiRmXVo= X-Google-Smtp-Source: APiQypI+Z8xn4lLalO6Bq80Tm0UmbSZYyvXkOeV6cCUAnm+lHixrl1bUPmKb7XhUP94H3wiZYBM/rEW6hsxuFFTAdb0= X-Received: by 2002:aa7:8ec1:: with SMTP id b1mr7898223pfr.103.1589025987327; Sat, 09 May 2020 05:06:27 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=ubolonton@gmail.com; helo=mail-pf1-x434.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:249409 Archived-At: On Fri, May 8, 2020 at 3:29 AM Stefan Monnier wr= ote: > > > I don't like reader magic. It complicates code logic. I know we talked = about > > symbol-macrolet and macrolet as possible options and know why neither i= s > > quite the right thing, but I still think that a macro of the same gener= al > > kind would work fine. Macros don't need to recognize defining forms if = they > > macroexpand their bodies before walking them. > > You need not only discover the defining forms but also the "using" > forms. So you need to know that the arguments to `make-local-variable`, > `add-hook`, `symbol-value`, `facep`, ... (and all function that pass > their arg to one of those) are not just random symbols (that you should > leave untouched) but symbols that obey the namespace rules. > Alternatively, the design could be: 1. Each symbol=E2=80=99s associated namespace is a first-class concept. So = is the fact whether a symbol is fully qualified. 2. Each namespace is itself a first-class construct, which holds information about symbols imported directly from other namespaces (used), and desired aliases of other namespaces. 3. Resolving an unqualified symbol into a qualified one is done by consulting a =E2=80=9Ccurrent namespace=E2=80=9D context, and is likewis= e a first-class operation available not just to the reader. 4. The reader returns qualified symbols only when explicitly asked (through a "reserved namespace separator"), or configured (i.e. imported symbols). It normalizes locally-defined namespace aliases while doing so. 5. Primitives that deal with symbols directly become namespace-aware. They resolve unqualified symbols when encountering them, using the mechanism in 3. These include `set`, `defalias`, `make-local-variable`, `funcall`, `symbol-value`, ... -- Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n Software Engineer