From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.devel Subject: lexbind, global namespace prefixes, `byte-compile-defvar', and `custom-guess-name-alist' Date: Wed, 12 Jan 2011 16:00:40 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1294867466 22645 80.91.229.12 (12 Jan 2011 21:24:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 12 Jan 2011 21:24:26 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 12 22:24:21 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pd8Ay-0000Mm-EC for ged-emacs-devel@m.gmane.org; Wed, 12 Jan 2011 22:24:16 +0100 Original-Received: from localhost ([127.0.0.1]:60485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pd83P-000634-TA for ged-emacs-devel@m.gmane.org; Wed, 12 Jan 2011 16:16:27 -0500 Original-Received: from [140.186.70.92] (port=34245 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pd83K-00061s-Qo for emacs-devel@gnu.org; Wed, 12 Jan 2011 16:16:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pd83J-0007w4-Ij for emacs-devel@gnu.org; Wed, 12 Jan 2011 16:16:22 -0500 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:45468) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pd83J-0007vl-9C for emacs-devel@gnu.org; Wed, 12 Jan 2011 16:16:21 -0500 Original-Received: by wwb17 with SMTP id 17so1018571wwb.30 for ; Wed, 12 Jan 2011 13:16:19 -0800 (PST) Original-Received: by 10.216.163.69 with SMTP id z47mr1288657wek.43.1294866040147; Wed, 12 Jan 2011 13:00:40 -0800 (PST) Original-Received: by 10.216.70.212 with HTTP; Wed, 12 Jan 2011 13:00:40 -0800 (PST) X-Google-Sender-Auth: 7POgX2IEDd891OebUdN-nfcI4_U X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134477 Archived-At: It would be nice if `custom-guess-name-alist' recognized the convention of naming global variables `*with-earmuffs*'. I propose adding the following element: ("\\`\\*.*\\*\\'" variable) In its current configuration the lexbind branch introduces new treatmeant around declared special variables. Specifically, there are these new symbols and primitives: `special-variable-p', `declared_special', `Vinternal_interpreter_environment', `Qinternal_interpreter_environment', which affect (at least) the following symbols and primitives: `defvar_per_buffer', `defvar', `defvaralias', `setq', `defconstant', `let*', `let', `make-symbol', `funcall_lambda', etc. Likewise, bzr revno: 101441 of 2010-09-15 in trunk says: ,---- | | (byte-compile-file-form-defvar, byte-compile-defvar): Warn about | global vars which don't have a prefix and could hence affect lexical | scoping in unrelated files. | `---- The above change means that `byte-compile-defvar' now warns when (byte-compile-warning-enabled-p 'lexical) returns non-nil and the symbol-name of a putatively special variable does not match the regexp "[-*/:$]". Currently this regexp is "optimized" under the assumption that if any of the tokens "-" "*" "/" ":" "$" are present in a symbol-name then that symbol is a potential global/dynamic var which does not lack a prefix. Given the warning issued and the regexp which triggers it, there seems to be an implication that global "special variables" may be named without a "namespace" so long as one or more magic tokens are present. Indeed the warning even acknowledges certain lexical lisp conventions of naming global/special variable symbols `*with-earmuffs*'. Disregarding the (future) mechanisms by which one may declare a variable special, there are perhaps unintended consesequence with the current regexp in that where a symbol is named as `*earmuff', `/slashy', `-dashy', `:colonic', `%fractured', it will regarded by the byte-compiler as properly prefixed even though these aren't file/library contexting namespaces... As such, it might be be nice to see these pairs included of `custom-guess-name-alist' as well: ("\\`[%$]" function) ;; `%private-fun', `$internal-fun' ("!\\'" function) ;; `set-foo!', `mutate-bar!' ("\\`\\+.*\\+\\'" variable) ;; `+superior-lisp+', `+constant-name+' ("\\`-" variable) ;; `--some-var--', `-her-buddy-', `--his-pal' The general thrust of these suggestions is that users should be presented with a consistent interface to help with disambiguating global variables in the lexbind esp. where there is potential for introduction of confusion around local-variables, permanent-locals, etc. which might otherwise go unnoticed, become difficult to gain access to and/or become informed of. -- /s_P\