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: Re: Save `nil' from the mutant void, preserve the truth of falsehood, prevent the falsehood of truth Date: Sun, 12 Sep 2010 20:16:26 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1284337001 23738 80.91.229.12 (13 Sep 2010 00:16:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Sep 2010 00:16:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 13 02:16:39 2010 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 1Ouwis-0005Q4-8x for ged-emacs-devel@m.gmane.org; Mon, 13 Sep 2010 02:16:38 +0200 Original-Received: from localhost ([127.0.0.1]:53762 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ouwiq-0003kY-SU for ged-emacs-devel@m.gmane.org; Sun, 12 Sep 2010 20:16:36 -0400 Original-Received: from [140.186.70.92] (port=46836 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ouwij-0003kS-Uy for emacs-devel@gnu.org; Sun, 12 Sep 2010 20:16:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ouwii-0001UI-7e for emacs-devel@gnu.org; Sun, 12 Sep 2010 20:16:29 -0400 Original-Received: from mail-wy0-f169.google.com ([74.125.82.169]:65085) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ouwii-0001U7-3X for emacs-devel@gnu.org; Sun, 12 Sep 2010 20:16:28 -0400 Original-Received: by wyb36 with SMTP id 36so6465177wyb.0 for ; Sun, 12 Sep 2010 17:16:26 -0700 (PDT) Original-Received: by 10.216.22.131 with SMTP id t3mr2645801wet.39.1284336986392; Sun, 12 Sep 2010 17:16:26 -0700 (PDT) Original-Received: by 10.216.65.140 with HTTP; Sun, 12 Sep 2010 17:16:26 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: -WlLe6z1HbviWUVVuscJsf0xGNY 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:130026 Archived-At: On Sun, Sep 12, 2010 at 10:00 AM, Stefan Monnier wrote: >> Two one-liners not even a Perl devotee could love: >> (prog1 #1=(fboundp ()) (unintern #1#)) > > Let's see how many lines of defenses you broke in the above code: So what? These opening two examples were intentionally pathological (and relatively harmless) There are certainly more prosaic examples. Likewise, there a others that are far more destructive than those provided. Would you prefer I provide those in a public forum as well? > - use of #1= in code: very bad. Which code? `#1=', and related reader syntax constructs aren't bad. Indeed, they are quite prevalent in byte-code files and the language would be hamstrung without them. That there are any number of ways to (ab)use them is a case for restricting the uninternment of two critical Lisp constants `t' and `nil' (and especially nil). > - unintern takes a symbol as argument, not a boolean, so it should > not be called with the return value of (fboundp ...) No, the argument to `unintern' can be a symbol or string. (progn (eval (read (concat '(40 100 101 102 97 108 105 97 115 32 39 98 121 101 32 40 105 110 100 105 114 101 99 116 45 102 117 110 99 116 105 111 110 32 40 98 121 116 101 45 99 111 109 112 105 108 101 32 35 39 40 108 97 109 98 100 97 32 40 120 41 32 40 117 110 105 110 116 101 114 110 32 120 41 41 41 41 41) nil))) (bye (symbol-name 'bye)) (fboundp 'bye)) > - calling unintern without an obarray arg is a bad idea. Yeah, a) Because there is really only one first class obarray. b) because restriction aren't placed on certain constants in obarray. > > Maybe we should make the second argument mandatory. That would be nice. But, it should also require that the NAME arg _must_ be a string. Better yet would be to also return the string on success: This would allow interrogation of the obaray with success on failure: (not (intern-soft (unintern "bubba33" '))) ;=> t > > The real nil is safely stored in a C variable `Qnil' which you should be > able to get via something like (not t). `nil' has to evaluate for both the empty list and a "symbol constant". `(not t)' just makes it a "symbol constant". See illustrations from previous example w/re to push. > But I don't think Elisp lets you re-intern it, I can't find a way. > since `intern' only takes a string rather than a symbol. Yeah, but again there is the weird corner case of interning the 0 length string. Which, as shown in previous mail causes additional headaches when attempting to re-intern a symbol. emacs -Q (prin1 (let ((s1 (intern (symbol-name (make-symbol "")))) (s2 (intern (symbol-name '#:))) cmp) (setq cmp `((,#1=s1 ,#1#) (,#2=s2 ,#2#))) `(:S1-LEN ,(length (car cmp)) :S1-LEN ,(length (cadr cmp)) :S1-IS-S1 ,(eq (caar cmp) (car (cdar cmp))) :S2-IS-S2 ,(eq (car (cadr cmp)) (cadr (cadr cmp))) :CAR-S1-IS-CAR-S2 ,(eq (caar cmp) (car (cadr cmp))) :CADR-S1-IS-CADR-S2 ,(eq (car (cdar cmp)) (cadr (cadr cmp))) :S1-IDENTITY ,(identity s1) :S1-IDENTITY ,(identity s1) :S1-SYM-NAME ,(symbol-name s1) :S2-SYM-NAME ,(symbol-name s2) :S2-UNINTD ,(unintern (car (cadr cmp))) :S1-UNINTD ,(unintern (caar cmp)))) (current-buffer)) (:S1-LEN 2 :S1-LEN 2 :S1-IS-S1 t :S2-IS-S2 t :CAR-S1-IS-CAR-S2 t :CADR-S1-IS-CADR-S2 t :S1-IDENTITY :S1-IDENTITY ;; <- Note, that _is_ an identity :S1-SYM-NAME "" :S2-SYM-NAME "" :S2-UNINTD t :S1-UNINTD nil) > > Stefan > /s_P\