GNU bug report logs - #27177
26.0.50: Macroexpanding cl-loop and friends (make-symbol usage)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Alex <agrambot@HIDDEN>; dated Wed, 31 May 2017 23:25:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 6 Jun 2017 20:31:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 06 16:31:49 2017
Received: from localhost ([127.0.0.1]:59931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dIL8n-0003uP-0j
	for submit <at> debbugs.gnu.org; Tue, 06 Jun 2017 16:31:49 -0400
Received: from mail-it0-f68.google.com ([209.85.214.68]:33476)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dIL8j-0003u9-Az
 for 27177 <at> debbugs.gnu.org; Tue, 06 Jun 2017 16:31:46 -0400
Received: by mail-it0-f68.google.com with SMTP id l6so7338213iti.0
 for <27177 <at> debbugs.gnu.org>; Tue, 06 Jun 2017 13:31:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:message-id:user-agent
 :mime-version; bh=3Au/gjZj2OiRpkych+m9BY5lwyNTyACMpWAghFuTwzs=;
 b=JsCNeg+qQZ3f7FhwNWDoIEZfDnb8AWHznRo006Q2fp34mjFHEkAk80cAwTZyfOuiZN
 ldTEYouxMuV3oieR4oSGJOG4JUwBXsM9rH3n1SotV1HItzTqLi4BjPgvnOWnhY60JtvD
 p3WgO2oq8spUoyrG2MACxCDYS/J4lZ9/EX01eRZSuttIEfg8WnH169VnwKkCe0KR+/lE
 o9eioiWsr/NmNnDRG86jbZCy/ocE8f2J+aFcSTbZC40ZzCZZfjvQEw6r/Vs7BBko25xq
 GU7O6TdUykjbJyxaLjugKeJztP//1zQQwiZaqk+WWhc+YhisPWt5Mj4+Ylsf13kLQJ/j
 seQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:message-id
 :user-agent:mime-version;
 bh=3Au/gjZj2OiRpkych+m9BY5lwyNTyACMpWAghFuTwzs=;
 b=rcm2V8QtjYzUOh6b+lVx3VEK7CQWokGypYVcYs4N2tMqtohcCNIOdenRrHUUwkWd9/
 Jha9A+HaJ2qriVS9HEf1swpumKI3HEuxHuGBsGNBN9BmMDhLPYBrXgPdVk0h+JBlDLtJ
 63i0d1kBAWiD//9/Rt3yFcxhUaMZPY+k0gKf4u/qph5lbBCWoYqux+kA0bHZazT3Tpyd
 GtdNrM3jn7ew2B4JRGJi81dPmWrkZETaipLAqzD25EYQZ14TVT7tN8mEbmIVnKiuLpd9
 tnwF8iqvR7vH9DqOnAOc3jPO/HK6JAKSutPT2Q+NlleXloutLuOvPkpkK7AVAX69ir0I
 VN5g==
X-Gm-Message-State: AODbwcAALG1Rc2KbV+LCX/BxxxqzH1iR27V+LSbRe89XCEo5yIux2eMC
 1lBpYd500Kfa+A==
X-Received: by 10.36.25.193 with SMTP id b184mr1259099itb.75.1496781099477;
 Tue, 06 Jun 2017 13:31:39 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id h189sm6828779ith.6.2017.06.06.13.31.37
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 06 Jun 2017 13:31:38 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN> <jwvo9u5dcpm.fsf-monnier+emacsbugs@HIDDEN>
 <87poekvbuj.fsf@HIDDEN> <jwva85lah01.fsf-monnier+emacsbugs@HIDDEN>
Date: Tue, 06 Jun 2017 14:31:32 -0600
Message-ID: <87vao83ljv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org,
 npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-=-=
Content-Type: text/plain

Stefan Monnier <monnier@HIDDEN> writes:

>> I've browsed around for a few common loop implementations and they all
>> use gensym (CCL uses gentemp) and descriptive naming:
>
> gensym is the indeed what is commonly used in Common-Lisp, whereas
> make-symbol is what is commonly used in ELisp.

Right, but it seems natural that the CL compatibility macros would use
gensym since CL does it that way.

>> I also found a CHICKEN Scheme egg for CL's loop, and it uses gensym (but
>> generic names, unfortunately).
>
> Does Scheme have make-symbol or something equivalent?

The RnRS standards don't specify uninterned symbols, but they mention
that some implementations have them. A quick check shows that Guile has
make-symbol, and CHICKEN and Racket have equivalents to make-symbol
(string->uninterned-symbol). All 3 have gensym.

>> If there's a good reason to not use gensym, then that's fine, but if the
>> problem is easy enough to work around (perhaps per-expansion counter so
>> that it will never realistically hit most-positive-fixnum), then I think
>> cl-loop should use it.
>
> I'd prefer to solve it in the printer, but that's just my opinion.
> FWIW, I've found print-gensym to be sufficient.

How do you want to solve it in the printer? One way I thought of was to
keep a counter similar to cl--gensym-counter, and make a hash table of
uninterned symbols with values being the prefix to concat to the end of
the print name of the symbol. At this point, though, why not port gensym
to ELisp proper and encourage use of gensym? I don't see the use for
extra complexity if it's not needed.

A seemingly simple option, as mentioned before, is to bind
cl--gensym-counter to 0 at the start of cl-loop. That means cl-loop
won't increase the global counter, and it fixes the readability of the
macro. I attached a sample diff below, which seems to work fine.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=gensym.diff
Content-Description: gensym.diff

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index db1518ce61..5b711a2a79 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -544,7 +544,7 @@ cl--do-arglist
 	  (laterarg nil) (exactarg nil) minarg)
       (or num (setq num 0))
       (setq restarg (if (listp (cadr restarg))
-                        (make-symbol "--cl-rest--")
+                        (cl-gensym "--cl-rest--")
                       (cadr restarg)))
       (push (list restarg expr) cl--bind-lets)
       (if (eq (car args) '&whole)
@@ -617,7 +617,7 @@ cl--do-arglist
                    (look `(plist-member ,restarg ',karg)))
 	      (and def cl--bind-enquote (setq def `',def))
 	      (if (cddr arg)
-		  (let* ((temp (or (nth 2 arg) (make-symbol "--cl-var--")))
+		  (let* ((temp (or (nth 2 arg) (cl-gensym "--cl-var--")))
 			 (val `(car (cdr ,temp))))
 		    (cl--do-arglist temp look)
 		    (cl--do-arglist varg
@@ -636,7 +636,7 @@ cl--do-arglist
       (setq keys (nreverse keys))
       (or (and (eq (car args) '&allow-other-keys) (pop args))
 	  (null keys) (= safety 0)
-	  (let* ((var (make-symbol "--cl-keys--"))
+	  (let* ((var (cl-gensym "--cl-keys--"))
 		 (allow '(:allow-other-keys))
 		 (check `(while ,var
                            (cond
@@ -936,7 +936,8 @@ cl-loop
 	  (cl--loop-accum-var nil)	(cl--loop-accum-vars nil)
 	  (cl--loop-initially nil)	(cl--loop-finally nil)
 	  (cl--loop-iterator-function nil) (cl--loop-first-flag nil)
-          (cl--loop-symbol-macs nil))
+          (cl--loop-symbol-macs nil)
+          (cl--gensym-counter 0))
       ;; Here is more or less how those dynbind vars are used after looping
       ;; over cl--parse-loop-clause:
       ;;
@@ -1225,9 +1226,9 @@ cl--parse-loop-clause
 		       (step (and (eq (car cl--loop-args) 'by)
                                   (cl--pop2 cl--loop-args)))
 		       (end-var (and (not (macroexp-const-p end))
-				     (make-symbol "--cl-var--")))
+				     (cl-gensym "--cl-var--")))
 		       (step-var (and (not (macroexp-const-p step))
-				      (make-symbol "--cl-var--"))))
+				      (cl-gensym "--cl-var--"))))
 		  (and step (numberp step) (<= step 0)
 		       (error "Loop `by' value is not positive: %s" step))
 		  (push (list var (or start 0)) loop-for-bindings)
@@ -1246,7 +1247,7 @@ cl--parse-loop-clause
 	       ((memq word '(in in-ref on))
 		(let* ((on (eq word 'on))
 		       (temp (if (and on (symbolp var))
-				 var (make-symbol "--cl-var--"))))
+				 var (cl-gensym "--cl-var--"))))
 		  (push (list temp (pop cl--loop-args)) loop-for-bindings)
 		  (push `(consp ,temp) cl--loop-body)
 		  (if (eq word 'in-ref)
@@ -1278,7 +1279,7 @@ cl--parse-loop-clause
 			(push `(,var
 				(if ,(or cl--loop-first-flag
 					 (setq cl--loop-first-flag
-					       (make-symbol "--cl-var--")))
+					       (cl-gensym "--cl-var--")))
 				    ,start ,var))
 			      loop-for-sets)
 			(push (list var then) loop-for-steps))
@@ -1286,13 +1287,13 @@ cl--parse-loop-clause
 				(if (eq start then) start
 				  `(if ,(or cl--loop-first-flag
 					    (setq cl--loop-first-flag
-						  (make-symbol "--cl-var--")))
+						  (cl-gensym "--cl-var--")))
 				       ,start ,then)))
 			  loop-for-sets))))
 
 	       ((memq word '(across across-ref))
-		(let ((temp-vec (make-symbol "--cl-vec--"))
-		      (temp-idx (make-symbol "--cl-idx--")))
+		(let ((temp-vec (cl-gensym "--cl-vec--"))
+		      (temp-idx (cl-gensym "--cl-idx--")))
 		  (push (list temp-vec (pop cl--loop-args)) loop-for-bindings)
 		  (push (list temp-idx -1) loop-for-bindings)
 		  (push `(< (setq ,temp-idx (1+ ,temp-idx))
@@ -1310,18 +1311,18 @@ cl--parse-loop-clause
 			       (and (not (memq (car cl--loop-args) '(in of)))
 				    (error "Expected `of'"))))
 		      (seq (cl--pop2 cl--loop-args))
-		      (temp-seq (make-symbol "--cl-seq--"))
+		      (temp-seq (cl-gensym "--cl-seq--"))
 		      (temp-idx
                        (if (eq (car cl--loop-args) 'using)
                            (if (and (= (length (cadr cl--loop-args)) 2)
                                     (eq (cl-caadr cl--loop-args) 'index))
                                (cadr (cl--pop2 cl--loop-args))
                              (error "Bad `using' clause"))
-                         (make-symbol "--cl-idx--"))))
+                         (cl-gensym "--cl-idx--"))))
 		  (push (list temp-seq seq) loop-for-bindings)
 		  (push (list temp-idx 0) loop-for-bindings)
 		  (if ref
-		      (let ((temp-len (make-symbol "--cl-len--")))
+		      (let ((temp-len (cl-gensym "--cl-len--")))
 			(push (list temp-len `(length ,temp-seq))
 			      loop-for-bindings)
 			(push (list var `(elt ,temp-seq ,temp-idx))
@@ -1350,7 +1351,7 @@ cl--parse-loop-clause
                                      (not (eq (cl-caadr cl--loop-args) word)))
                                 (cadr (cl--pop2 cl--loop-args))
                               (error "Bad `using' clause"))
-                          (make-symbol "--cl-var--"))))
+                          (cl-gensym "--cl-var--"))))
 		  (if (memq word '(hash-value hash-values))
 		      (setq var (prog1 other (setq other var))))
 		  (cl--loop-set-iterator-function
@@ -1377,14 +1378,14 @@ cl--parse-loop-clause
 		  (cl--loop-set-iterator-function
                    'overlays (lambda (body)
                                `(cl--map-overlays
-                                 (lambda (,var ,(make-symbol "--cl-var--"))
+                                 (lambda (,var ,(cl-gensym "--cl-var--"))
                                    (progn . ,body) nil)
                                  ,buf ,from ,to)))))
 
 	       ((memq word '(interval intervals))
 		(let ((buf nil) (prop nil) (from nil) (to nil)
-		      (var1 (make-symbol "--cl-var1--"))
-		      (var2 (make-symbol "--cl-var2--")))
+		      (var1 (cl-gensym "--cl-var1--"))
+		      (var2 (cl-gensym "--cl-var2--")))
 		  (while (memq (car cl--loop-args) '(in of property from to))
 		    (cond ((eq (car cl--loop-args) 'from)
                            (setq from (cl--pop2 cl--loop-args)))
@@ -1413,7 +1414,7 @@ cl--parse-loop-clause
                                     (not (eq (cl-caadr cl--loop-args) word)))
                                (cadr (cl--pop2 cl--loop-args))
                              (error "Bad `using' clause"))
-                         (make-symbol "--cl-var--"))))
+                         (cl-gensym "--cl-var--"))))
 		  (if (memq word '(key-binding key-bindings))
 		      (setq var (prog1 other (setq other var))))
 		  (cl--loop-set-iterator-function
@@ -1423,7 +1424,7 @@ cl--parse-loop-clause
                              (lambda (,var ,other) . ,body) ,cl-map)))))
 
 	       ((memq word '(frame frames screen screens))
-		(let ((temp (make-symbol "--cl-var--")))
+		(let ((temp (cl-gensym "--cl-var--")))
 		  (push (list var  '(selected-frame))
 			loop-for-bindings)
 		  (push (list temp nil) loop-for-bindings)
@@ -1436,8 +1437,8 @@ cl--parse-loop-clause
 	       ((memq word '(window windows))
 		(let ((scr (and (memq (car cl--loop-args) '(in of))
                                 (cl--pop2 cl--loop-args)))
-		      (temp (make-symbol "--cl-var--"))
-		      (minip (make-symbol "--cl-minip--")))
+		      (temp (cl-gensym "--cl-var--"))
+		      (minip (cl-gensym "--cl-minip--")))
 		  (push (list var (if scr
 				      `(frame-selected-window ,scr)
 				    '(selected-window)))
@@ -1481,7 +1482,7 @@ cl--parse-loop-clause
 		  cl--loop-steps))))
 
      ((eq word 'repeat)
-      (let ((temp (make-symbol "--cl-var--")))
+      (let ((temp (cl-gensym "--cl-var--")))
 	(push (list (list temp (pop cl--loop-args))) cl--loop-bindings)
 	(push `(>= (setq ,temp (1- ,temp)) 0) cl--loop-body)))
 
@@ -1560,22 +1561,22 @@ cl--parse-loop-clause
 
      ((eq word 'always)
       (or cl--loop-finish-flag
-          (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+          (setq cl--loop-finish-flag (cl-gensym "--cl-flag--")))
       (push `(setq ,cl--loop-finish-flag ,(pop cl--loop-args)) cl--loop-body)
       (setq cl--loop-result t))
 
      ((eq word 'never)
       (or cl--loop-finish-flag
-          (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+          (setq cl--loop-finish-flag (cl-gensym "--cl-flag--")))
       (push `(setq ,cl--loop-finish-flag (not ,(pop cl--loop-args)))
 	    cl--loop-body)
       (setq cl--loop-result t))
 
      ((eq word 'thereis)
       (or cl--loop-finish-flag
-          (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+          (setq cl--loop-finish-flag (cl-gensym "--cl-flag--")))
       (or cl--loop-result-var
-          (setq cl--loop-result-var (make-symbol "--cl-var--")))
+          (setq cl--loop-result-var (cl-gensym "--cl-var--")))
       (push `(setq ,cl--loop-finish-flag
                    (not (setq ,cl--loop-result-var ,(pop cl--loop-args))))
 	    cl--loop-body))
@@ -1607,9 +1608,9 @@ cl--parse-loop-clause
 
      ((eq word 'return)
       (or cl--loop-finish-flag
-          (setq cl--loop-finish-flag (make-symbol "--cl-var--")))
+          (setq cl--loop-finish-flag (cl-gensym "--cl-var--")))
       (or cl--loop-result-var
-          (setq cl--loop-result-var (make-symbol "--cl-var--")))
+          (setq cl--loop-result-var (cl-gensym "--cl-var--")))
       (push `(setq ,cl--loop-result-var ,(pop cl--loop-args)
                    ,cl--loop-finish-flag nil)
             cl--loop-body))
@@ -1640,7 +1641,7 @@ cl--loop-let
           (setq par nil)
           (dolist (spec specs)
             (or (macroexp-const-p (cadr spec))
-                (let ((temp (make-symbol "--cl-var--")))
+                (let ((temp (cl-gensym "--cl-var--")))
                   (push (list temp (cadr spec)) temps)
                   (setcar (cdr spec) temp)))))))
     (while specs
@@ -1657,7 +1658,7 @@ cl--loop-let
                           (and (eq body 'setq) (cl--unused-var-p temp)))
                   ;; Prefer a fresh uninterned symbol over "_to", to avoid
                   ;; warnings that we set an unused variable.
-                  (setq temp (make-symbol "--cl-var--"))
+                  (setq temp (cl-gensym "--cl-var--"))
                   ;; Make sure this temp variable is locally declared.
                   (when (eq body 'setq)
                     (push (list (list temp)) cl--loop-bindings)))
@@ -1685,7 +1686,7 @@ cl--loop-handle-accum
     (or cl--loop-accum-var
 	(progn
 	  (push (list (list
-                       (setq cl--loop-accum-var (make-symbol "--cl-var--"))
+                       (setq cl--loop-accum-var (cl-gensym "--cl-var--"))
                        def))
                 cl--loop-bindings)
 	  (setq cl--loop-result (if func (list func cl--loop-accum-var)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 87531110b8..3eee3f3878 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1326,7 +1326,8 @@ ffap-file-at-point
 	 ;; If it contains a colon, get rid of it (and return if exists)
 	 ((and (string-match path-separator name)
 	       (setq name (ffap-string-at-point 'nocolon))
-	       (ffap-file-exists-string name)))
+               (not (string-empty-p name))
+               (ffap-file-exists-string name)))
 	 ;; File does not exist, try the alist:
 	 ((let ((alist ffap-alist) tem try case-fold-search)
 	    (while (and alist (not try))

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 6 Jun 2017 04:21:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 06 00:21:02 2017
Received: from localhost ([127.0.0.1]:58397 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dI5zK-00041p-7J
	for submit <at> debbugs.gnu.org; Tue, 06 Jun 2017 00:21:02 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:12039)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1dI5zH-000414-57
 for 27177 <at> debbugs.gnu.org; Tue, 06 Jun 2017 00:21:00 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0DKAgAFLTZZ/3qLCkxdGgEBAQECAQEBAQgBAQEBg1hChFKLWpEPKwFGlx2GHgQCAoMHRBQBAgEBAQEBAQFrKIUZAQQBViMFCws0EhQYDSSKNQivUIwDAQEBAQYCJohBgmw0il0BBJ40njCGfpMdgUQ2IYEKMCEIMIdoJIlgAQEB
X-IPAS-Result: A0DKAgAFLTZZ/3qLCkxdGgEBAQECAQEBAQgBAQEBg1hChFKLWpEPKwFGlx2GHgQCAoMHRBQBAgEBAQEBAQFrKIUZAQQBViMFCws0EhQYDSSKNQivUIwDAQEBAQYCJohBgmw0il0BBJ40njCGfpMdgUQ2IYEKMCEIMIdoJIlgAQEB
X-IronPort-AV: E=Sophos;i="5.39,304,1493697600"; d="scan'208";a="314543750"
Received: from 76-10-139-122.dsl.teksavvy.com (HELO ceviche.home)
 ([76.10.139.122])
 by smtp.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA;
 06 Jun 2017 00:20:52 -0400
Received: by ceviche.home (Postfix, from userid 20848)
 id C38106661B; Tue,  6 Jun 2017 00:20:51 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
Message-ID: <jwva85lah01.fsf-monnier+emacsbugs@HIDDEN>
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN> <jwvo9u5dcpm.fsf-monnier+emacsbugs@HIDDEN>
 <87poekvbuj.fsf@HIDDEN>
Date: Tue, 06 Jun 2017 00:20:51 -0400
In-Reply-To: <87poekvbuj.fsf@HIDDEN> (Alex's message of "Sat, 03 Jun 2017
 18:24:36 -0600")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org,
 npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> I've browsed around for a few common loop implementations and they all
> use gensym (CCL uses gentemp) and descriptive naming:

gensym is the indeed what is commonly used in Common-Lisp, whereas
make-symbol is what is commonly used in ELisp.

> I also found a CHICKEN Scheme egg for CL's loop, and it uses gensym (but
> generic names, unfortunately).

Does Scheme have make-symbol or something equivalent?

> If there's a good reason to not use gensym, then that's fine, but if the
> problem is easy enough to work around (perhaps per-expansion counter so
> that it will never realistically hit most-positive-fixnum), then I think
> cl-loop should use it.

I'd prefer to solve it in the printer, but that's just my opinion.
FWIW, I've found print-gensym to be sufficient.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 4 Jun 2017 00:24:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 03 20:24:58 2017
Received: from localhost ([127.0.0.1]:54395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dHJLm-0006nG-0N
	for submit <at> debbugs.gnu.org; Sat, 03 Jun 2017 20:24:58 -0400
Received: from mail-it0-f66.google.com ([209.85.214.66]:36765)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dHJLk-0006n2-3J
 for 27177 <at> debbugs.gnu.org; Sat, 03 Jun 2017 20:24:56 -0400
Received: by mail-it0-f66.google.com with SMTP id i206so17015540ita.3
 for <27177 <at> debbugs.gnu.org>; Sat, 03 Jun 2017 17:24:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:in-reply-to:references:user-agent:date
 :message-id:mime-version;
 bh=RIBg1S1X3LbA0BhguMoxeNbnQZQOAfATHxEzOWBa6oo=;
 b=csVIUdBR/ylPLqH+DTEHTsVo3rZoROz2EH19pHQ4qNicr6AndSQJ8KPUDrDepFp2bX
 2U2fVSozkDpJ8s0kc9QY1+BzdG1PUa1RBnsLnB2Dd+T6nIn0YywyYPt1OYBvjqbsr0M1
 OebcuoZFbMB6t0ETczJpHVJY3G1tRrbgtx6+xKt8CaQ02ke5pP811yK88FWom0XhURsQ
 PFUAaDc8KM/AyFgek72SjGB2t0CcArkDcsvOtlIdM2sXhBIHjjf0E23fwOCWEn7psWxo
 03QGVrhxJ2Ms0KOgAakVpeNi21xpz64G9wTVcaSxu7JK0PQ3E/eCyZunIGMQ3gEVAUPn
 69rA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references
 :user-agent:date:message-id:mime-version;
 bh=RIBg1S1X3LbA0BhguMoxeNbnQZQOAfATHxEzOWBa6oo=;
 b=bFCmN+Gn4q5u4LijElr0b6sVhrDFIW0In747Ghb+5wWzoHwUU84dutM1IYo9ncen6/
 p7Udmpd/Wv9LJlajjARo4zj3M9ptoChZfOzO8FiSAagffDT748OC+HkELLhcIFfDwblG
 MggAsEf581q4kCH33HeOKfbrmJq7cFzOIxoapwKQNGH+lf9NRjfCtT1aMbfCMFU7ZMYW
 rC/vqflaXpKijSGGyXb1EumMrRM6kABEsNKQq+O6ysV27VJ8J6lt7SiXfuO48OdMxGxp
 F8wT4Y2vwefl/AiRJfw3jmcEkRABHadbQfYresHTRe1EdLaRHY0rR0+yCn5q0TSfncZF
 kexg==
X-Gm-Message-State: AODbwcDyfmd/DzzLQLeqjnJ1hxAT3Dv3GY7zzRhf0MNdodqcfYCrDUr8
 0OvOi80SDAMJwA==
X-Received: by 10.107.15.19 with SMTP id x19mr14581963ioi.214.1496535890417;
 Sat, 03 Jun 2017 17:24:50 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id t184sm11577189iod.29.2017.06.03.17.24.48
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 03 Jun 2017 17:24:49 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
In-Reply-To: <jwvo9u5dcpm.fsf-monnier+emacsbugs@HIDDEN> (Stefan Monnier's
 message of "Fri, 02 Jun 2017 22:33:30 -0400")
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN> <jwvo9u5dcpm.fsf-monnier+emacsbugs@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
Date: Sat, 03 Jun 2017 18:24:36 -0600
Message-ID: <87poekvbuj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org,
 npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Stefan Monnier <monnier@HIDDEN> writes:

>> Stefan, why did you make the switch? Using cl-gensym would help a ton
>> with readability of cl-loop's macroexpansion.
>
> I don't consider human-readability of the result to be something that
> a macro should have to pay attention to.

I can understand that when talking about smaller macros, but loop is a
fairly complex macro, so I believe human-readability is a desirable
trait to have if feasible. It would help with debugging and overall
understanding of cl-loop.

I've browsed around for a few common loop implementations and they all
use gensym (CCL uses gentemp) and descriptive naming:

SBCL: https://github.com/sbcl/sbcl/blob/master/src/code/loop.lisp

CLISP: https://sourceforge.net/p/clisp/clisp/ci/default/tree/src/loop.lisp

CCL: https://github.com/Clozure/ccl/blob/master/library/loop.lisp

ABCL (admittedly they adapted it from SBCL):
http://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/loop.lisp

I also found a CHICKEN Scheme egg for CL's loop, and it uses gensym (but
generic names, unfortunately).

If there's a good reason to not use gensym, then that's fine, but if the
problem is easy enough to work around (perhaps per-expansion counter so
that it will never realistically hit most-positive-fixnum), then I think
cl-loop should use it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 3 Jun 2017 02:33:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 22:33:35 2017
Received: from localhost ([127.0.0.1]:52236 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGysh-00037U-7Q
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2017 22:33:35 -0400
Received: from pruche.dit.umontreal.ca ([132.204.246.22]:33937)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1dGysf-00037M-EG
 for 27177 <at> debbugs.gnu.org; Fri, 02 Jun 2017 22:33:34 -0400
Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242])
 by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v532XU2Y012693;
 Fri, 2 Jun 2017 22:33:31 -0400
Received: by ceviche.home (Postfix, from userid 20848)
 id C0F006661B; Fri,  2 Jun 2017 22:33:30 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
Message-ID: <jwvo9u5dcpm.fsf-monnier+emacsbugs@HIDDEN>
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN>
Date: Fri, 02 Jun 2017 22:33:30 -0400
In-Reply-To: <877f0v80fu.fsf@HIDDEN> (Alex's message of "Thu, 01 Jun 2017
 22:42:45 -0600")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Level: 
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0.1
X-NAI-Spam-Rules: 3 Rules triggered
 GEN_SPAM_FEATRE=0.1, EDT_SA_DN_PASS=0, RV6039=0
X-NAI-Spam-Version: 2.3.0.9418 : core <6039> : inlines <5903> : streams
 <1748261> : uri <2437365>
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org,
 npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.3 (-)

> Stefan, why did you make the switch? Using cl-gensym would help a ton
> with readability of cl-loop's macroexpansion.

I don't consider human-readability of the result to be something that
a macro should have to pay attention to.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 2 Jun 2017 23:46:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 19:46:20 2017
Received: from localhost ([127.0.0.1]:52126 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGwGq-0005xa-8p
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2017 19:46:20 -0400
Received: from mail-it0-f65.google.com ([209.85.214.65]:35314)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dGwGn-0005xO-Sd
 for 27177 <at> debbugs.gnu.org; Fri, 02 Jun 2017 19:46:18 -0400
Received: by mail-it0-f65.google.com with SMTP id 67so13608986itx.2
 for <27177 <at> debbugs.gnu.org>; Fri, 02 Jun 2017 16:46:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=G9OfbOOEjEi2BrvO8zEiyp5i6OQ3RjJgQ6SqO8IoX9g=;
 b=SxdzwmMRg9xlKZVELJjeQFS7U5to8SCCUBpVX6C5cltmZkdkQKgChVsJRuIakMgBKq
 soqT5D93JZRG8X3WBO7iYrCyb7fAJyMaBxOr7FgDGbjdNa2YqlTfir/fjhHCDK5gJDMW
 vqdTrcDDvF1I7GmZPHG2a5yLRuEv8n6RtyL/rIUv/Fk32B3xPDfGPTuzjHh3dvCeoG6k
 C+bPafIGgD0/jqEnLDVUVQR6uPudzdqxT3/BK3NYE28dUy10VpqY0mLsKKOMNFyUjci1
 Dn8WJrT2G2wnNlyG4ZH2UDamNJK5vT/OU4mDETf24RBPZYpA/VKFWo6qffSAdTtAV9e6
 QreA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=G9OfbOOEjEi2BrvO8zEiyp5i6OQ3RjJgQ6SqO8IoX9g=;
 b=rQQc1uVe81uA5IlSbc1FULgcutT3eu76CnMHFPMwjxytpXE9mxtMA+YEjXUWUTrG/r
 n/umVFV1j37ybsi+tlt3ptA/6zVnrQ1StbJO17nc8pvBoR7Z5WHCvpSfDSRm5OPOwDr+
 RypHP9GcvaE+6V28SUAYzikEJhMcdV3ScMAMIROH2qsJOtV7HES5HfXVJLKzB2jcgSgn
 yZSMRk0Mtnxa02fuwVr2q7AeBRlJxKieiPO7dyfaLnyEKP33u4ymcgvN60X5WBImPkR6
 UScqTkEaWASqOchU/th0B5tCBKB12NZErGVqPhdLxWYNCZ1SNZ7fS3Zqdbqpu667gyGS
 O3hQ==
X-Gm-Message-State: AODbwcDvFZSIWE4i9lEYzPunoFHIsmf7p1J7cnmdVVIUleqid+1v3/kC
 U6RfxDQjmoHywg==
X-Received: by 10.107.19.11 with SMTP id b11mr10786346ioj.140.1496447172270;
 Fri, 02 Jun 2017 16:46:12 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id 86sm388444ioj.8.2017.06.02.16.46.10
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 02 Jun 2017 16:46:11 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: npostavs@HIDDEN
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN> <87vaoe0ykl.fsf@HIDDEN>
Date: Fri, 02 Jun 2017 17:46:01 -0600
In-Reply-To: <87vaoe0ykl.fsf@HIDDEN>
 (npostavs@HIDDEN's message of "Fri, 02 Jun 2017
 19:17:14 -0400")
Message-ID: <87wp8unebq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

npostavs@HIDDEN writes:

> Alex <agrambot@HIDDEN> writes:
>
>>> AFAICT `print-circle' and `print-gensym' also control how `prin1'
>>> prints.
>>
>> Does print-circle? Consider:
>>
>> (prin1 `(cons ,(make-symbol "hello")
>> 	      ,(make-symbol "hello")))
>>
>> print-gensym certainly makes a difference in the output, but
>> print-circle doesn't seem to.
>
> You're producing 2 different symbols, try
>
>     (let ((sym (make-symbol "hello")))
>       (prin1 `(cons ,sym ,sym)))

Right, sorry for the bad example. I don't know what I was thinking.

>> However, I don't know how prin1 would keep track of the uninterned
>> symbols across many different procedure calls, which it would need to do
>> for it to know what is being shared.
>
> It looks like `print-continuous-numbering' and `print-number-table'
> might be relevant.

That does look like an option, thanks. I'd still like for cl-macs.el to
produce readable output without all of these extra print-* variables
set, but if it's infeasible to do that, then I'll look into using those.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 2 Jun 2017 23:15:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 19:15:44 2017
Received: from localhost ([127.0.0.1]:52103 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGvnD-0005Fv-VB
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2017 19:15:44 -0400
Received: from mail-it0-f66.google.com ([209.85.214.66]:34588)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1dGvnC-0005Fi-9F
 for 27177 <at> debbugs.gnu.org; Fri, 02 Jun 2017 19:15:42 -0400
Received: by mail-it0-f66.google.com with SMTP id d68so13545511ita.1
 for <27177 <at> debbugs.gnu.org>; Fri, 02 Jun 2017 16:15:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=qgm1L66u+RbCrWDvgTE1RNgcBAAYBmG0qig/Kuk7yKA=;
 b=ucIBpAl1/S9qNxStGpamvKQOwcZsTvOCNWigmAAC9tid7dFWPapoCxgCuEzOewomNf
 ndOW/zr5YS3wEWbAC2BXtf8uR5n/PqcZimTRfk9dM02+BV+YLUXFM4NflxvGrZf8M8QN
 S+/vbIlcoJL8tOXAaha62OyX28fJHT5z6b/I8+rx1n5JCkO5QrLZ20bJnCPLREWQbvnZ
 hgEK9bRLlmg0XYF03D5dtCvuHnGESzdS/6DOx7ReQtnOVU0xMha+vtKcOyz3LJWTwxln
 od96RsoKvH0GcMQfAxxcKZa1COhVVGwT39OYPjy1R6CwgJDGOugie6Jb4WwxYkVbMMIp
 dEEw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=qgm1L66u+RbCrWDvgTE1RNgcBAAYBmG0qig/Kuk7yKA=;
 b=IE1HIz26V4hBUmr23kKellpF8cqOPu22RLplNW7oKXglpFnwkGMkBXPmG8RQ/dyJb8
 KJvV2X3IvOjnuXyUYNyxfQh4lwzOjq+o1M611qOlBvxP9jmhbrzIPlOCof+/UDJ7md/S
 cW4LXT6qtZQ9WCvQOMGPtA4aqzrThRj0FD8l/x0oWs9RpVUm+cb0lox8YJgav5NddqrJ
 MwfBYxPFiBp5t7eJ+I9HZ0xdFjrkOf4cO1XYxJQBiRq88NGiORuG340dS/tplncjYi6H
 Ic01X1fXmFzV8D5azgmV2e8A5acL6SE6wCHTY+fChOzb4mP+p4ECoDTONliSaJ/0TNCK
 TZ+Q==
X-Gm-Message-State: AODbwcACgkowitosBBnUxDm8AhQOTTDv83e0mIVBTcB3cJ8TwuVHImVQ
 +b8jb2AtdmfB5Q==
X-Received: by 10.36.20.202 with SMTP id 193mr1939329itg.79.1496445336868;
 Fri, 02 Jun 2017 16:15:36 -0700 (PDT)
Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id
 h200sm10654606ioe.62.2017.06.02.16.15.35
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 02 Jun 2017 16:15:36 -0700 (PDT)
From: npostavs@HIDDEN
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN>
Date: Fri, 02 Jun 2017 19:17:14 -0400
In-Reply-To: <877f0v80fu.fsf@HIDDEN> (Alex's message of "Thu, 01 Jun 2017
 22:42:45 -0600")
Message-ID: <87vaoe0ykl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org,
 monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Alex <agrambot@HIDDEN> writes:

>> AFAICT `print-circle' and `print-gensym' also control how `prin1'
>> prints.
>
> Does print-circle? Consider:
>
> (prin1 `(cons ,(make-symbol "hello")
> 	      ,(make-symbol "hello")))
>
> print-gensym certainly makes a difference in the output, but
> print-circle doesn't seem to.

You're producing 2 different symbols, try

    (let ((sym (make-symbol "hello")))
      (prin1 `(cons ,sym ,sym)))

> However, I don't know how prin1 would keep track of the uninterned
> symbols across many different procedure calls, which it would need to do
> for it to know what is being shared.

It looks like `print-continuous-numbering' and `print-number-table'
might be relevant.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 2 Jun 2017 23:09:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 19:09:11 2017
Received: from localhost ([127.0.0.1]:52095 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGvgs-00056q-U5
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2017 19:09:11 -0400
Received: from mout.web.de ([212.227.15.4]:65178)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1dGvgr-00056b-R5
 for 27177 <at> debbugs.gnu.org; Fri, 02 Jun 2017 19:09:10 -0400
Received: from drachen.dragon ([94.218.223.218]) by smtp.web.de (mrweb003
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lu4qk-1e0LLU01OI-011Oyb; Sat, 03
 Jun 2017 01:09:02 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
 <877f0v80fu.fsf@HIDDEN>
Date: Sat, 03 Jun 2017 01:09:01 +0200
In-Reply-To: <877f0v80fu.fsf@HIDDEN> (Alex's message of "Thu, 01 Jun 2017
 22:42:45 -0600")
Message-ID: <87fufif0mq.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:dBHJnGKR536Chq5NL7YC10ZJGnfzh7+eImE1yX7mO0ocWbzcef3
 Y7rTHdcGNIdZmp9E1QPvAKmdGITbhcwavR+yWNtDrjkBuwp0eqLIldBTX4nGutbS9ikRUy8
 jl/np53+2sGqpS/oD9Lqu8OfHmXBkrO7zI1WpqJt6qYuC5bk1Tqd2zxOVMzqUBF1YHMbkFY
 K0UrkrBtIu9Tu6aEoP15w==
X-UI-Out-Filterresults: notjunk:1;V01:K0:KcXz0Nxskw4=:TuPejpEFmhUjV30gjtF2cp
 NRRHz4eOtKSzSXSp+pOfLab7nFVsH94v7Bwcsf/LTUYdAdQbesMaHYaI4q/OilkAoL+qXkOUx
 1NW1Bx084XLlowtffuLrFMz3r0RfzsWH30nR+0bKZDFvPXbKKSRElfYqgTlM69JanB7JYNYQD
 QV2QF1s1+FLd3cR6XjnG8JF5Vf5B8vILwwXcPXRpUoL0/J/6OlsM6nDVX24j8gWMcf5fTXNxn
 e/mzdESa+fcl60N9b/WyZNt2ekUugFm8T/zNihPDJ7dXInyifMOePDhxWw9hwLQqCrleQAwWG
 blEWLuTzPAqzcnAOVRTZPRMvElkd9mmNXXPhbZgXLTgSi/bC3MXrFzoWbM16V2Yc6cJOfhcFw
 g7+7FE5YlGz+jh0KSUlE4qrt2MF+Eu1D6/Xh3+8PYier99GXu5ItdkM2lT43iKHztiYaeQnaA
 1Vy2Z0FhAt8gDDUSRR0Hero4AECdy8HIZklIcJvdqzW4uPmrnZh0p4dsk+B0b6FE3GCiTG3Ts
 gFy2SudLPUEe2cy9ZbN2xbdEeOHNx3LT8P20Gcg4y+5Qnx8HdYoRa6grpDkPw0uYNyuSYJGKf
 gHma+JDKjCBXPncbHY+LKlf+Mp9OZVkIxDBxeDvN8UJv63y/o/z6w32LAxmdq1PvwhMDdVF2H
 DCkfQCL5+mEsEv96U/NPWfjYw4qxyjUetHy07/LAao6zEqJxLvQKaFOku34hkWwKLTMWq69yV
 HOtj5yASfjkP6nQQNp/sbvZsTBoBALoNCTl5t6ApHpYh03rD/Zu7yrNnmBRXMF3EsD6uddJbp
 Zis+LuF
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Alex <agrambot@HIDDEN> writes:

> > AFAICT `print-circle' and `print-gensym' also control how `prin1'
> > prints.
>
> Does print-circle? Consider:
>
> (prin1 `(cons ,(make-symbol "hello")
>               ,(make-symbol "hello")))
>
> print-gensym certainly makes a difference in the output, but
> print-circle doesn't seem to.

There are no shared parts in your example expression, so it doesn't make
a difference in this particular case.

> However, I don't know how prin1 would keep track of the uninterned
> symbols across many different procedure calls, which it would need to do
> for it to know what is being shared.

It doesn't AFAICT.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 2 Jun 2017 04:43:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 02 00:43:18 2017
Received: from localhost ([127.0.0.1]:50287 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGeQd-0007F7-Oh
	for submit <at> debbugs.gnu.org; Fri, 02 Jun 2017 00:43:18 -0400
Received: from mail-it0-f68.google.com ([209.85.214.68]:36663)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dGeQb-0007Eu-IE
 for 27177 <at> debbugs.gnu.org; Fri, 02 Jun 2017 00:43:15 -0400
Received: by mail-it0-f68.google.com with SMTP id i206so8349625ita.3
 for <27177 <at> debbugs.gnu.org>; Thu, 01 Jun 2017 21:43:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=7hPorDzhaydxO85dNS20N8HJanlfxHoEMZduN23etrM=;
 b=DbHRi9ZwwnLrjk+HrOER+/78eHJUiNSidKPdltuIKSYgeJ7q7fKxZE54JDTx2L5VUT
 0W4QrUkTPCSBNGOHkeyTv6RhYvNfpmdDiNFeS8QiCuJfD+YOYecRvTubBj9Qkz/KFgj+
 nCgnelY1g+WGBNfBSFTikjA1nePYCLhtIUPhlIlyZ4KiHiEVMIeF1ANnmyuoiU6K3YyU
 r4PC9q+ixjPLPsgFDjq2KLpqDg4REavr3Hzi+N95TTFItMOGGeb9jJlKCR6RaTRK/Uwv
 l0VUZz5+PB3CIYX9qKsDdnT1mwXSMVv61G6SqM1O+zkscf4O6lth888jxNyIa0G4HyFw
 jzqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=7hPorDzhaydxO85dNS20N8HJanlfxHoEMZduN23etrM=;
 b=NZl88blVGbushC8/eQkQwQjjnw8Jra/YmOh6Et+ShSrL/AEQHEpcP0ZK73o6imN+Ro
 u81GfeKkAW/Aj10kkHZMX7qBVDOvHw9cP040vrj+/BowptSzOW/YL2ZNmDQ+ZQ07pvVA
 52V7LyzuB7ssVA6itJ2AXmXRiV+mVH1fWkQ7mM8Vb/5HS/V/N2KucZ/1nNGEpZvdixOn
 mALonlZ5tKB1h+QlIctrmPHZRTJw3Omqg+SEZ7DnLEiXXHiZ/R33MRw7/KTMAxmXnWRB
 gOsmeCR5SphdtP9bGKKMjqkSBUTmg/QHytmujJALIR7Y9WDC+zWQDd7jjgpmHeYYkbf5
 cMHg==
X-Gm-Message-State: AODbwcAuOxoKlVbG2pSUDXmXmWVvoG6vX0AmtDEaAvMbA1pN9+MicymA
 IkJG9xCiMvZ8NQ==
X-Received: by 10.36.124.140 with SMTP id a134mr380200itd.31.1496378587651;
 Thu, 01 Jun 2017 21:43:07 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id y98sm614048ita.17.2017.06.01.21.43.05
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 01 Jun 2017 21:43:06 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN> <87inkfrrvv.fsf@drachen>
Date: Thu, 01 Jun 2017 22:42:45 -0600
In-Reply-To: <87inkfrrvv.fsf@drachen> (Michael Heerdegen's message of "Fri, 02
 Jun 2017 05:27:16 +0200")
Message-ID: <877f0v80fu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org, monnier@HIDDEN,
 npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

>> It would also be nice if instead of many --cl-var-- variables,
>> particular clauses would result in different symbol-names. For instance,
>> if the `repeat' clause made a symbol called --cl-repeat--. This would
>> further help readability.
>
> I'm not sure if that is doable without rewriting the implementation,
> since the macro expansion is automatically written code.

I'm not sure what you mean. Since they're uninterned symbols their
symbol-names shouldn't matter unless a procedure calls #'symbol-name on
them. In cl-macs.el I don't see any examples of that.

It appears that the code sometimes does use different names already in a
couple places. For example, see --cl-vec-- and --cl-idx-- at about line
1294 in cl-macs.el.

Actually, looking at the git-blame for those lines, it looks like Stefan
switched from gensym to make-symbol all the way back in e542ea4bed!

Stefan, why did you make the switch? Using cl-gensym would help a ton
with readability of cl-loop's macroexpansion.

>> Also, using gensym could help 3rd-party packages. I usually use
>> macrostep to expand macros and the value of print-circle has no effect
>> on its expansions. macrostep individually prints out each uninterned
>> symbol using prin1; can this approach be easily modified to get the same
>> result as macroexpand?
>
> AFAICT `print-circle' and `print-gensym' also control how `prin1'
> prints.

Does print-circle? Consider:

(prin1 `(cons ,(make-symbol "hello")
	      ,(make-symbol "hello")))

print-gensym certainly makes a difference in the output, but
print-circle doesn't seem to.

However, I don't know how prin1 would keep track of the uninterned
symbols across many different procedure calls, which it would need to do
for it to know what is being shared.

> Note that when we changed the code to use `cl-gensym', we would not have
> a really clean solution for the readability problem: if you print with
> p-gensym and p-circle on, it would not look much different than now.  If
> you print with those flags off, you (still) print to different (not
> equivalent) code: when you read (evaluate) it, all uninterned symbols
> would be replaced with interned symbols.  Though, with numbered symbol
> names, you will be probably be lucky in most cases that the difference
> doesn't matter.

In the case with both flags off and with make-symbol calls changed to
cl-gensym, I got:

(cl-block nil
  (let*
      ((--cl-var--248
        '(1 2 3))
       (x nil)
       (--cl-var--249
        '(a b c))
       (y nil)
       (--cl-var--250 nil))
    (while
        (and
         (consp --cl-var--248)
         (progn
           (setq x
                 (car --cl-var--248))
           (consp --cl-var--249)))
      (setq y
            (car --cl-var--249))
      (push
       (list x y)
       --cl-var--250)
      (setq --cl-var--248
            (cdr --cl-var--248))
      (setq --cl-var--249
            (cdr --cl-var--249)))
    (nreverse --cl-var--250)))

Which is equivalent code to the original cl-loop. I also believe it's
much more readable than the current macroexpansion as you can actually
differentiate between the different --cl-var-- variables. Using
different symbol names as discussed above would help a lot as well, but
I still think this part is important as well.

> But I see your point: the readability is a real problem.  Maybe we could
> instead improve how things are printed?  Unfortunately that lies beyond
> my knowledge.

I'm not sure what you mean, but improvement is certainly welcome.

>> PS: The first line of the documentation of print-circle only mentions
>> that it affects recursive structures. Perhaps it should mention the
>> "shared substructures" part in the first line for emphasis?
>
> I agree but somewhat hesitate because of the variable's name, which is
> even more a source of confusion.

Right, I was a bit confused as well, but according to the Hyperspec
*print-circle* also detects sharing in objects in Common Lisp as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 2 Jun 2017 03:27:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 01 23:27:43 2017
Received: from localhost ([127.0.0.1]:50257 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGdFV-0003iA-CG
	for submit <at> debbugs.gnu.org; Thu, 01 Jun 2017 23:27:43 -0400
Received: from mout.web.de ([212.227.15.14]:63230)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1dGdFS-0003hu-0h
 for 27177 <at> debbugs.gnu.org; Thu, 01 Jun 2017 23:27:38 -0400
Received: from drachen.dragon ([94.218.223.218]) by smtp.web.de (mrweb004
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M69CU-1e5Xrz2nfu-00y93Q; Fri, 02
 Jun 2017 05:27:17 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
 <87lgpc79e1.fsf@HIDDEN>
Date: Fri, 02 Jun 2017 05:27:16 +0200
In-Reply-To: <87lgpc79e1.fsf@HIDDEN> (Alex's message of "Wed, 31 May 2017
 20:02:30 -0600")
Message-ID: <87inkfrrvv.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:ghrrUF5/y0GwqonmxQQxYhLgDH0ddqfJftxLl8/z9X0mdWUPV74
 JhzEqOEXhoACu/zuyqnH3pGJQwuSwx8Hcw+lIIDZO9wDCEzAUFcyhhz8SJq2WkoouEyWnH4
 JyaWuOKmkmDplSMioMwZaOQSsyCwx1Q2pmj/wVULn6NGrylIWxpGWIePyRf4c+0zvaZ33QV
 yLRzzu4k2EGckXmcotQhw==
X-UI-Out-Filterresults: notjunk:1;V01:K0:Pj6UNRxTwVM=:4/EH6ECiFs/zUyQW4ghrKL
 V9QRh3TZDsyB4t12sQ6cKvXeVIj6Kc9NmF8S35DcTqrnVi4DdRCCRpSpAJqoFoblhQPic4ZSa
 QdJW5Jx0QunVFanmcs9UB+hRkW2tzsaGllu55gKGUylPZGiQBLn4iDGHDzredGwiuVX3oNAQv
 NpZKWNW4jOMsecJMT8dkGp6n5WNB4QegYIMEF4b6Dla0TtEzeE5551p0noxURK3OtE4JWLxfP
 E6QQxsdV5MN3ldcx/BZuWVN+4b2iVZ6q2C9al515eQgbS/Q9bMcNJWvslcBI7AccWCAsdpqJE
 uL7XipSVAa8OPlbuMLdbHDkTSsoqoEfwm4suAHW8hmnLLN3ybNVSlccODl44eO+swbEQ1hjTq
 TdE37jsSjSbZrj9wP36xld1+HETgeMfprub2i9eAYuxZmCGUB4qwSQGkzPE6glJOd0JZvnzZE
 636dc3n7zIIcHUbrS18Be1zCuM4bDCzfEDLpi55ko4MnKe8f+ZNjGV92Zx4evC+Gks1+nFBW1
 TZE2DGcwKYW32a1NxHc8IfkumQHD67fO3HZv5csYEQTERZ9TaIllyxMU9emtAfUTHNIMiMOPY
 T5q620FiRozR4BM6TitD0tqENGh4HxWkwy6jMGJrjoiEI0GUfTnWtURX77pLvy/L4YV8rlcME
 OnbyK2lCzwI3wJB0xs6N4Z8601U7fd+7a/9tsnRryEt+ISiEF0jK7yVw0BJA8pf7YeL1Mwid5
 vKLK3PFkHTeNcK9WYruVb82eoeGzNW+a76CNj9vV5q4Hl96q/a1fhHRIedl1tDO0qO2uHjkqn
 nSq86mE
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org, npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)

Alex <agrambot@HIDDEN> writes:

> That's much better, though I still think it could/should be better. For
> example, if you have multiple uninterned symbols with different
> symbol-names, they're all referenced by #number, and use the same
> counter.
>
> It also seems to make the output uglier as well. Consider:
>
> (macroexpand '(cl-loop for x in '(1 2 3)
>                        for y in '(a b c)
>                        repeat 10
>                        repeat 20
>                        collect (list x y)))
>
> Note the expressions using #5#. I suppose the 0 is being shared.

Yes, or at least, a cons containing the 0.  That's how things look like
with print-circle enabled.

> It would also be nice if instead of many --cl-var-- variables,
> particular clauses would result in different symbol-names. For instance,
> if the `repeat' clause made a symbol called --cl-repeat--. This would
> further help readability.

I'm not sure if that is doable without rewriting the implementation,
since the macro expansion is automatically written code.

> Also, using gensym could help 3rd-party packages. I usually use
> macrostep to expand macros and the value of print-circle has no effect
> on its expansions. macrostep individually prints out each uninterned
> symbol using prin1; can this approach be easily modified to get the same
> result as macroexpand?

AFAICT `print-circle' and `print-gensym' also control how `prin1'
prints.


Note that when we changed the code to use `cl-gensym', we would not have
a really clean solution for the readability problem: if you print with
p-gensym and p-circle on, it would not look much different than now.  If
you print with those flags off, you (still) print to different (not
equivalent) code: when you read (evaluate) it, all uninterned symbols
would be replaced with interned symbols.  Though, with numbered symbol
names, you will be probably be lucky in most cases that the difference
doesn't matter.

But I see your point: the readability is a real problem.  Maybe we could
instead improve how things are printed?  Unfortunately that lies beyond
my knowledge.


> PS: The first line of the documentation of print-circle only mentions
> that it affects recursive structures. Perhaps it should mention the
> "shared substructures" part in the first line for emphasis?

I agree but somewhat hesitate because of the variable's name, which is
even more a source of confusion.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 1 Jun 2017 02:02:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 22:02:47 2017
Received: from localhost ([127.0.0.1]:48212 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGFRn-0006AB-1i
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 22:02:47 -0400
Received: from mail-io0-f195.google.com ([209.85.223.195]:36550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dGFRl-00069y-B6
 for 27177 <at> debbugs.gnu.org; Wed, 31 May 2017 22:02:45 -0400
Received: by mail-io0-f195.google.com with SMTP id f102so3500334ioi.3
 for <27177 <at> debbugs.gnu.org>; Wed, 31 May 2017 19:02:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=LFuyiZ9uigJv6q7NuopphPiTlG1CkwgLGHJe4K8MMuQ=;
 b=ZHVKzg5pWB5M01tmHZ+kz14v+AnWDYHi7GrU4uSjmLseQthqeQv9j/rz+Ue4HPNvn+
 vzwc8oCWvshCgTFw4HNR82HG8O2dhLDUIR7TLY2MEmJHEOB10KpFIQoYMP1DJRs2lvFA
 mo0odDwWTExn3X5rUMPlALnnuU69GiH2jhScUooKdrRjJeAnl9NvUt+5uZO/HnCiu2tK
 h8yXap98wwK/bQp0+cYX6+QZ4lwXcGINjbzGi8spxFXq+mZErv2oK+z3sa+SeKCtBKaM
 Lo19zUkPmoAwoAGSSFrgCsWphqfNplPwK/OPz+TXjB95D/AG9UqdBYVy45axlHA6Lqq+
 FDgw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=LFuyiZ9uigJv6q7NuopphPiTlG1CkwgLGHJe4K8MMuQ=;
 b=XQfyxQhKin5Mkw8gEvBgS5ZtQtXNd3IudHHdqASN1K5BFdeKQdJ0y6lnIUcDsa/iBb
 JFGCgZbHGxyMKuwBvaMyRtcP5mdSL3B304fbQq04IzDjrBBI3jmEpihbM3/YkSnilbhf
 WAKnnxVBkPKEqrXLDcS7LQRUHkx3dF3YysaehSktGY5goO4/kHsAYyeyMIgPvLzTv4k2
 9XQUXRSInWQcoE2neDrtmnJc7/WZF+/lZwg/SMTDEw8vBX+f+cv2b9prNsBll387lD+w
 SY6x8eQSyDvsyW32pHA+D5FHESOrbR47RKKfzpLzdTGvicggfpEoGuA88sKyfuD/19Ss
 XUtA==
X-Gm-Message-State: AODbwcBgaU/6GZ5SG8kioUrhjLWDxbwwuaMVet/XnqvXSmmbWB09seQm
 mtCJbuEmsHMp1w==
X-Received: by 10.107.35.75 with SMTP id j72mr24344386ioj.180.1496282559411;
 Wed, 31 May 2017 19:02:39 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id 67sm7639398ioc.27.2017.05.31.19.02.37
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 31 May 2017 19:02:38 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN> <87poeoy0zk.fsf@drachen>
Date: Wed, 31 May 2017 20:02:30 -0600
In-Reply-To: <87poeoy0zk.fsf@drachen> (Michael Heerdegen's message of "Thu, 01
 Jun 2017 03:01:51 +0200")
Message-ID: <87lgpc79e1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org, npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> With print-circle and print-gensym bound, I think the result does not
> really read worse than how it would look like with with `cl-gensym'
> generated code.

That's much better, though I still think it could/should be better. For
example, if you have multiple uninterned symbols with different
symbol-names, they're all referenced by #number, and use the same
counter.

It also seems to make the output uglier as well. Consider:

(macroexpand '(cl-loop for x in '(1 2 3)
                       for y in '(a b c)
                       repeat 10
                       repeat 20
                       collect (list x y)))

Note the expressions using #5#. I suppose the 0 is being shared.

It would also be nice if instead of many --cl-var-- variables,
particular clauses would result in different symbol-names. For instance,
if the `repeat' clause made a symbol called --cl-repeat--. This would
further help readability.

Also, using gensym could help 3rd-party packages. I usually use
macrostep to expand macros and the value of print-circle has no effect
on its expansions. macrostep individually prints out each uninterned
symbol using prin1; can this approach be easily modified to get the same
result as macroexpand?

PS: The first line of the documentation of print-circle only mentions
that it affects recursive structures. Perhaps it should mention the
"shared substructures" part in the first line for emphasis?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 1 Jun 2017 01:02:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 21:02:01 2017
Received: from localhost ([127.0.0.1]:48181 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGEUz-0002yo-9C
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 21:02:01 -0400
Received: from mout.web.de ([212.227.17.12]:54261)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1dGEUx-0002ya-SN
 for 27177 <at> debbugs.gnu.org; Wed, 31 May 2017 21:02:00 -0400
Received: from drachen.dragon ([94.218.223.218]) by smtp.web.de (mrweb102
 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MAdst-1d4Nbf1WJP-00Bps8; Thu, 01
 Jun 2017 03:01:52 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN>
Date: Thu, 01 Jun 2017 03:01:51 +0200
In-Reply-To: <87shjk7doq.fsf@HIDDEN> (Alex's message of "Wed, 31 May 2017
 18:29:41 -0600")
Message-ID: <87poeoy0zk.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:djlqjVd4IPscn97uzVAvOmc3ovr+k0JEy4pJaNLCBQRJ66d847v
 8YyHfDr9Vi4a1TkVlxWmLkbQvE9Yxx/yqKxNPMjtW1362mbsEmPfP2zLC5XAlmW3y0lDM9z
 EKRQtVfz0H2U8cJc8p2RpBmpc+FMQZMqQZC/Uq8iTTPuK/ipF16XEHhHeZKHz/VZauMKkFa
 TUc0UYikRTUtyPo9qyRCg==
X-UI-Out-Filterresults: notjunk:1;V01:K0:P/jS/jVj7tA=:2dJE5qrpQJmWraRLDe9eoQ
 meSDG/B5beMaqpmOv/4ORYvTUkjbvBoa8HP5DLIfJwb67cGgSMXqEiru+Cadghonita9u8ebm
 iPAwOb6sAkRDkVmKoatjB00L1H3iXGRKOVZMpHtn42L6e8ZaB0DaEpSNvtmxqUf9J0sHANRbS
 A9FNE15seBpYH2ul/7Zoy2OrGQ0cRRrhcdqf7JfoiUx4M4hE3UqXxeH0nslrZEHjWSL3/MVGN
 cqpeApdcbMtTbTF40NL5Ul7ps+nrtrUlRoonqG8qfSeRd6NEyImOSeJYW7FEyqmknfIflanJ0
 0+72okhWSgQjzPAHE7CBNUELETWjRtMlTsJxZj0NN/IpT2O7+Z9rVBZP3mmCZI19MMwpWh13D
 6kkLFeeWF5y38IEfv9Z+jzqFgFRWMqY3y/qskLwIgix4lwqfrDuES0/f5DdXdbUB7eHJPUdMo
 S8oyRPU1pfDfBDNmkQcOmo5JiXvpHhje152bDjQPBF4PwavBOUiOmJorZC3TWpsiUsm11FKvj
 MM7P94YmhzMuemH6oyIQ2dj/N6RORnf3ITYAR/FMWBNJaFFNTzCQJX0I2m70oGbMm0wRyeJUS
 X9VeF6S/RV+RvlIlNxdwAb3qBT2Z6NQ568qFDw/m9oKRyCIsllHErnsN2cofJGbwOAitapn4b
 3L9eh/BEKlA7rr0mH6aqWn9KUPSHo9KzVUO++3apSc/XGBUgeA5vJnT2m3kHMJRoSvfG6oJ7s
 ib9mEvs5jxGU9msqwi6p4pWd64a2krEYTUwlemertuGK/YXVAghT79V3NnIs/IxQH90iC4MlF
 2XyOH0x
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Alex <agrambot@HIDDEN> writes:

> > Note that `make-symbol' doesn't return an interned symbol - what is
> > printed as "--cl-var--" above are actually different symbols.  You need
> > to enable `print-gensym' to make that visible when printing the
> > macroexpansion.  If you print with print-gensym bound to nil, you don't
> > get a correct printed representation.
>
> Enabling print-gensym in this case is even worse, since evaluating the
> macroexpanded code yields a (void-variable #:--cl-var--) error.

Oh, you need to bind `print-circle' as well, thanks npostavs.

> > So I think there is not a bug, unless your complaint is about human
> > readability or the default value of `print-gensym'.
>
> Human readability is indeed a large part of my complaint.

> Also, evaluating the macroexpanded code directly would allow for easier
> debugging, since one could make small adjustments to the output to see
> immediate results.

With print-circle and print-gensym bound, I think the result does not
really read worse than how it would look like with with `cl-gensym'
generated code.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 1 Jun 2017 00:51:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 20:51:16 2017
Received: from localhost ([127.0.0.1]:48176 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGEKa-0002jS-7R
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 20:51:16 -0400
Received: from mail-it0-f52.google.com ([209.85.214.52]:35467)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1dGEKW-0002jE-Vp
 for 27177 <at> debbugs.gnu.org; Wed, 31 May 2017 20:51:14 -0400
Received: by mail-it0-f52.google.com with SMTP id f72so23742437ite.0
 for <27177 <at> debbugs.gnu.org>; Wed, 31 May 2017 17:51:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=M8j8jDb6ivsVXgNjB5k+Q3rQheQHqxvI0xmtpJuH0dY=;
 b=d3xjTzJvMNQ2AuVZ1s/7Q/dEckMj3rXo41txm55iYJWr8dMMY9c5c6aexH6KtHwBUw
 93+ExFiG80D7ypFGiMyfxZT+HRlXeRVKrXc8WL/CRP4dxAjT6Epplq4f18L824LjLf+H
 NalGYywBQA/umK7oG4m0vkdHzT3bBgje7KiRqrb/5IsuJitYlQRb+tyttqcppKv1h3vW
 qeoOCgzyiwpCLXJu5ZZbtDIuFhTYolz2cztv+dRyQabZUb/i/8871CuqnFOdCiud/wqZ
 zUIlW79SjnPE3C6aJvKQ9j5jZcXD69GqYFx8cPJSpyHDDys6nnNowXG+cYmlsjIqvV6Q
 XAZg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=M8j8jDb6ivsVXgNjB5k+Q3rQheQHqxvI0xmtpJuH0dY=;
 b=krEMFl3yhbLBSHN2jqxG+DvuY4kP7U+y08iIAB1rqKMYkfH22xP3mLttKd4L8/H2HP
 5HRqXkyMkrrZzb1IxYWtsehQPT59GNntXRW1mxuVFp7PTVMhZFCSb2ZZyZL03I474ZBC
 4/WyfNXIEt98ZNv0DH5BP0FR1djT+d+so8FMHMbIsCuJJnIDHh3uIXoy/NOu68sPgrtI
 jftcgfnwc997o2KCbNi6M5Kzw8uNcZJr5xdW0JbGhqFrpRO86B+FeIpnocmAHFAbV6+4
 cC+SSi6RFslhzTFs6OlAQRnp6AoaYD73xRQVVNy/PqzbDXQdFabUMModiRYF1syAESOM
 RoZA==
X-Gm-Message-State: AODbwcDZQJj+SKUkUpdR3cHblF8nthWZwBf1b7GILEFVo+itG12REIkw
 lrjDLsYPUxgOWIZe
X-Received: by 10.36.31.74 with SMTP id d71mr9626181itd.85.1496278267207;
 Wed, 31 May 2017 17:51:07 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id l19sm7688818ioe.3.2017.05.31.17.51.06
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 31 May 2017 17:51:06 -0700 (PDT)
From: npostavs@HIDDEN
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
 <87shjk7doq.fsf@HIDDEN>
Date: Wed, 31 May 2017 20:52:44 -0400
In-Reply-To: <87shjk7doq.fsf@HIDDEN> (Alex's message of "Wed, 31 May 2017
 18:29:41 -0600")
Message-ID: <87k24w34wz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 27177
Cc: Michael Heerdegen <michael_heerdegen@HIDDEN>, 27177 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Alex <agrambot@HIDDEN> writes:

> Enabling print-gensym in this case is even worse, since evaluating the
> macroexpanded code yields a (void-variable #:--cl-var--) error.

Yeah, that's why you need `print-circle' too.

> Also, evaluating the macroexpanded code directly would allow for easier
> debugging, since one could make small adjustments to the output to see
> immediate results.

With print-circle, the output is debuggable in Emacs 26 (see Bug#23660).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 1 Jun 2017 00:29:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 20:29:51 2017
Received: from localhost ([127.0.0.1]:48160 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGDzr-0002El-4R
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 20:29:51 -0400
Received: from mail-it0-f68.google.com ([209.85.214.68]:34706)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dGDzp-0002EY-Qd
 for 27177 <at> debbugs.gnu.org; Wed, 31 May 2017 20:29:50 -0400
Received: by mail-it0-f68.google.com with SMTP id d68so3391070ita.1
 for <27177 <at> debbugs.gnu.org>; Wed, 31 May 2017 17:29:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=DGUKAtn9L359Ukb9VZYFkD2cs1rDAP934WA/6vn4il4=;
 b=QwH0pXbdUee+raVQzI6c1yuWwKy6qTDnP0zCP5UyzCOMpjykv99LkoHYVj1JdkQZ4t
 3HjsvU2oSdO0kasDlxy18mqZUTGt5I+JH7uOACaT3rm9SOlXzDWDwaZfO0/AMIF2Ze0h
 mx1zRF2CNDMByaWxDVriNft59Sa1BgAnhYhWP29gaAQ6Bw0V27kR5hb9Hbrt4DhVpdv4
 9ghRISr13M3L24lnHQ9kW8T6PHpaVFPFdnLxGASiWiN1NOolmp/gRA9BteTl0Y959hhf
 K6PJTGceXxTjmscYnJOIZ8X5mwb4XDGTGPqUICtJjX/s1lHg+vMS7wGRotLWoh5z2IiU
 Byiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=DGUKAtn9L359Ukb9VZYFkD2cs1rDAP934WA/6vn4il4=;
 b=Namw4IYSFHH0AKV254jsVNTHkcAeOnfjiFZxcFGDwI84piyobJFbICsiPQnFROBiV2
 H3RfGcosg5dXcbmGHt2TYAPeOqDNMUTePx+ujmf7C30BCYeIwpitmvftPNeGi7P8VsMx
 6t10DB5Zq7N12Mx74GC6EcNxiYqHK2jA4yl9+qOjTYR1Kr/1dJrvGnepsmJWMa6E2yqp
 6izbNLCqi9Zc8OWEteQ7VAyDzjcrvfQFzK0d7lmMk056uDOdT3kUKKFfxQFKc/twLmJQ
 ke9TOlGn4706jZabBlRd/bUI5VGlMHyKy74f4pVMEsTPmgkma0jaCFV0AvqIfzpcWnOx
 zp7A==
X-Gm-Message-State: AODbwcABrMHTunUibcH6svbxo83N5DS+vidwbez/jrROq2tARL4JugfN
 8tQuFQrxAO0cYjt+
X-Received: by 10.107.175.155 with SMTP id p27mr24410396ioo.193.1496276983979; 
 Wed, 31 May 2017 17:29:43 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id c125sm5685358itc.11.2017.05.31.17.29.42
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 31 May 2017 17:29:43 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
Date: Wed, 31 May 2017 18:29:41 -0600
In-Reply-To: <87tw40y48h.fsf@drachen> (Michael Heerdegen's message of "Thu, 01
 Jun 2017 01:51:42 +0200")
Message-ID: <87shjk7doq.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.5 (/)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.5 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> Also in Elisp:
>
> (eval (macroexpand '(cl-loop for x in '(1 2 3)
>                         for y in '(a b c)
>                         collect (list x y))))
> ==>
> ((1 a)
>  (2 b)
>  (3 c))

Right, sorry for not being clear. I was referring to printing the output
into a buffer and evaluating that instead of feeding it directly into
eval.

Though I was wrong that SBCL does this correctly by default (you have to
set *print-gensym* to nil).

> Note that `make-symbol' doesn't return an interned symbol - what is
> printed as "--cl-var--" above are actually different symbols.  You need
> to enable `print-gensym' to make that visible when printing the
> macroexpansion.  If you print with print-gensym bound to nil, you don't
> get a correct printed representation.

Enabling print-gensym in this case is even worse, since evaluating the
macroexpanded code yields a (void-variable #:--cl-var--) error.

> So I think there is not a bug, unless your complaint is about human
> readability or the default value of `print-gensym'.

Human readability is indeed a large part of my complaint.

Also, evaluating the macroexpanded code directly would allow for easier
debugging, since one could make small adjustments to the output to see
immediate results.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 1 Jun 2017 00:28:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 20:28:13 2017
Received: from localhost ([127.0.0.1]:48156 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGDyG-0002CY-PX
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 20:28:12 -0400
Received: from mail-it0-f47.google.com ([209.85.214.47]:37394)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1dGDyF-0002CL-G8
 for 27177 <at> debbugs.gnu.org; Wed, 31 May 2017 20:28:11 -0400
Received: by mail-it0-f47.google.com with SMTP id m47so6260536iti.0
 for <27177 <at> debbugs.gnu.org>; Wed, 31 May 2017 17:28:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=aFy830yKGF0qFw/oSuuPXicKnsLUM9KRVA6ndby2lkE=;
 b=NV4D45+RbdMJSihkKTCV+9xajpXk7maG9yjYcjhijw1G5REfNva6N/gkpXalduTxRb
 k9ELevufxxi9pQievPuNDDZaL4z8DsuzIN6aY3ZuxCiQYcVF/fyceu3So4e3fQO9N5AI
 2f4U0tXb+kRnOPApNLX5KfmGxSA3rM+3XQKIEbR2lLRvbKRiwMQ6hRmbtEfYIvrJ6Ulo
 z3vQtXlPO5RngUp1UN4cXMDOEj9pEMaHEY//HQFwgEj3zmqHS/ZoxHWi+wktYHsHDqu6
 bbHkC8sBhEITA57DoF0Qu7IuzMO6JVx5JBhsoJT9Aku8oLptZoFooquHN1dai17bdT5v
 KRzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version;
 bh=aFy830yKGF0qFw/oSuuPXicKnsLUM9KRVA6ndby2lkE=;
 b=FdSJvdAdkskDCUI9WWBGuLF18ooJIoa5L0nvNV3aCt9GSmwI8WoYz0GywRBaKwUNo8
 F2u+Rh6okgQb0+XrzefrKXOczWpTpgbk2xOvkczKKIjR9aPvG2zkoNbW58wwd/8qgDvV
 +HP7l1XmjAXjHpk8AaAw149R/AmwM4yzRgHm/QdkMgoMO0hGlfPLl5/JY56Mpf2ildhl
 JTUytJLeEyUF40VO0D96QGcRTvHjmCIQX04Nsg4UeP1ZRueXgFPZLeRBnNw20ZFRVIvi
 hnLykjFXl7aOB6fgGv9eFSOSzOiEOpD+YL0pG/atbXp7eTcvvSXisVvFPGUumwWolAtl
 XFzA==
X-Gm-Message-State: AODbwcDNWj6Y9h07oZ5Y1CvyDV/sq1fTBw7Khin39l9EpJrIhMna8W93
 9oDW941o5a2Sj450
X-Received: by 10.107.129.232 with SMTP id l101mr24053895ioi.194.1496276885757; 
 Wed, 31 May 2017 17:28:05 -0700 (PDT)
Received: from zony ([45.2.7.65])
 by smtp.googlemail.com with ESMTPSA id u32sm7617894ioi.51.2017.05.31.17.28.04
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 31 May 2017 17:28:05 -0700 (PDT)
From: npostavs@HIDDEN
To: Michael Heerdegen <michael_heerdegen@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN> <87tw40y48h.fsf@drachen>
Date: Wed, 31 May 2017 20:29:42 -0400
In-Reply-To: <87tw40y48h.fsf@drachen> (Michael Heerdegen's message of "Thu, 01
 Jun 2017 01:51:42 +0200")
Message-ID: <87mv9s35zd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org, Alex <agrambot@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.7 (/)

Michael Heerdegen <michael_heerdegen@HIDDEN> writes:

> You need to enable `print-gensym' to make that visible when printing
> the macroexpansion.  If you print with print-gensym bound to nil, you
> don't get a correct printed representation.

You need `print-circle' as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at 27177 <at> debbugs.gnu.org:


Received: (at 27177) by debbugs.gnu.org; 31 May 2017 23:51:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 19:51:54 2017
Received: from localhost ([127.0.0.1]:48137 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGDP7-0001O3-V7
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 19:51:54 -0400
Received: from mout.web.de ([212.227.15.3]:51916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1dGDP5-0001Np-Gd
 for 27177 <at> debbugs.gnu.org; Wed, 31 May 2017 19:51:52 -0400
Received: from drachen.dragon ([94.218.223.218]) by smtp.web.de (mrweb001
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MWRkA-1dQcUO3zdi-00Xb18; Thu, 01
 Jun 2017 01:51:43 +0200
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#27177: 26.0.50: Macroexpanding cl-loop and friends
 (make-symbol usage)
References: <8737bk8vba.fsf@HIDDEN>
Date: Thu, 01 Jun 2017 01:51:42 +0200
In-Reply-To: <8737bk8vba.fsf@HIDDEN> (Alex's message of "Wed, 31 May 2017
 17:23:37 -0600")
Message-ID: <87tw40y48h.fsf@drachen>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K0:gdSVh/9tffOOv88LcShxdEJyWJT+Y5MjrlpgmG8rN6uuQZ91ygW
 9uSEzuRebbL7WYsp+Xy3nH28/N2rRiU939Dq6v8Q1r5mk13Uk766XVtcGIljVa2BqPYG/Q6
 sMmRtVWe9m/rFU+POpOAJPAzEjKkahTqNIZO4vM3DZ7Pt3HP2pT/9WHagFmui5kzdbAT86U
 IIHB7kNSaqgJ9OPLlB49Q==
X-UI-Out-Filterresults: notjunk:1;V01:K0:1jOB15nwrKc=:hM0gxaooO0uB1iT5YS9v21
 3QCAm01FwKSrfE3j0XMvYhXF3vOrpbjELm1uCfE0uag45nPK1vMr8g85tOWxFA2ZTyi/5VH9r
 QZHt/wH7EKxoDunsXdsrW/cLFuVJf4rw2m1SJkqoyuB4d5yZxNg+DH9XvBojuiXMRLNoBaPuZ
 qMJZb15GGS2XaCPVnVXYD+lZ++o2MmtX1uy8rCH0dY86v9aM1rXTBiFMxJD/cbSE88Z3oOCwt
 QDl+4kZ7sg2ZJt2QAP4h8FcoAssxPK3rGORITXEyG3qCVp78fa7AWsjlWwbXahmVxN8LhNULL
 eEiwQmjR7GQuCM10YxI3Udj8ZFVTJyg/+XOuFzwdp6rwmu6HiJOSLaQPFpAg+qAdi/lhmKohj
 vee1I3xZf1JNjCPHOJbH8FSaLwyDy5vs/ajSSBeO0W2Nyek/Zag9prQoQwCZd5eUrbVhb+wqG
 g7G/pcuni5QA70UzKWiDuTTxtksKSIDbLO4zymMiP9aBevYoX2/rELoiTvH6cnKCXvd0/cKLk
 4A9HQJ+Xchx+CFQRSiD3FwBo5oJXt4EOqpv+rEMDx2YaU9CYKg1So1Khhk2jpR4jkP3PZSYHa
 i0PbE4eXr1vbHZbI9hgmy5b58iPzZqFMw+IbqpjslicdjGR1Fylfhnigr4x1bVAQIrayfW2wP
 a/sJQpJn60JZe61SbAgrEtTstnz4wtvN2koZhkuH8vHttnl93BJxMsWfT66BdG2uy1IxlBC7O
 HecdvYiDyZ315QKx9WCVoSvh81ROOZEHZZXv+B35G49ZiHtX9T4RtpfhFUjvi44mfGaCxQN5c
 xJgJpxn
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 27177
Cc: 27177 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Alex <agrambot@HIDDEN> writes:

> Consider the following simple cl-loop form:
>
> (cl-loop for x in '(1 2 3)
>          for y in '(a b c)
>          collect (list x y))
>
>
> The macroexpanded result is:
>
> (cl-block nil
>   (let*
>       ((--cl-var--
>         '(1 2 3))
>        (x nil)
>        (--cl-var--
>         '(a b c))
>        (y nil)
>        (--cl-var-- nil))
>     (while
>         (and
>          (consp --cl-var--)
>          (progn
>            (setq x
>                  (car --cl-var--))
>            (consp --cl-var--)))
>       (setq y
>             (car --cl-var--))
>       (push
>        (list x y)
>        --cl-var--)
>       (setq --cl-var--
>             (cdr --cl-var--))
>       (setq --cl-var--
>             (cdr --cl-var--)))
>     (nreverse --cl-var--)))
>
>
> It's easy to verify that this expansion doesn't do the same job by
> noticing that the macroexpanded form always returns nil.
>
> Note that in Common Lisp (at least in SBCL), macroexpanding and then
> evaluating the result works as expected.

Also in Elisp:

(eval (macroexpand '(cl-loop for x in '(1 2 3)
                        for y in '(a b c)
                        collect (list x y))))
==>
((1 a)
 (2 b)
 (3 c))

> This is because cl-macs.el uses make-symbol instead of gensym, like SBCL
> does.

Note that `make-symbol' doesn't return an interned symbol - what is
printed as "--cl-var--" above are actually different symbols.  You need
to enable `print-gensym' to make that visible when printing the
macroexpansion.  If you print with print-gensym bound to nil, you don't
get a correct printed representation.

So I think there is not a bug, unless your complaint is about human
readability or the default value of `print-gensym'.


Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 31 May 2017 23:24:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 31 19:24:04 2017
Received: from localhost ([127.0.0.1]:48115 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1dGCyC-0000lD-Fl
	for submit <at> debbugs.gnu.org; Wed, 31 May 2017 19:24:04 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40211)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1dGCyA-0000ki-Ii
 for submit <at> debbugs.gnu.org; Wed, 31 May 2017 19:24:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <agrambot@HIDDEN>) id 1dGCy4-0006Sl-HJ
 for submit <at> debbugs.gnu.org; Wed, 31 May 2017 19:23:57 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:54170)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <agrambot@HIDDEN>) id 1dGCy4-0006Se-Db
 for submit <at> debbugs.gnu.org; Wed, 31 May 2017 19:23:56 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:59405)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <agrambot@HIDDEN>) id 1dGCy3-0001xB-82
 for bug-gnu-emacs@HIDDEN; Wed, 31 May 2017 19:23:56 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <agrambot@HIDDEN>) id 1dGCxz-0006RH-6R
 for bug-gnu-emacs@HIDDEN; Wed, 31 May 2017 19:23:55 -0400
Received: from mail-it0-x236.google.com ([2607:f8b0:4001:c0b::236]:34832)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <agrambot@HIDDEN>) id 1dGCxz-0006R8-0i
 for bug-gnu-emacs@HIDDEN; Wed, 31 May 2017 19:23:51 -0400
Received: by mail-it0-x236.google.com with SMTP id f72so22254758ite.0
 for <bug-gnu-emacs@HIDDEN>; Wed, 31 May 2017 16:23:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:mime-version;
 bh=3Jn0kqq1o29dEJ+kq41UcTxb2nJW8i+soYAYgW15YcQ=;
 b=byRsvblJhMQ4jXIuiSQ/KKNJFEvopdWj2Ody4ioVwmfCh6oYr92If5DOm5Uq3Sz2Mg
 iw+QOCCbn32FJfFEZweMeIZc0Ky7YlWTXm2HMZlj9U03EtSXLczbIEfDLyOFK59e/JEc
 FFR27lrnnHCKGnc1UABJZyVVxJqRmrkrmwUD9KAtt1Y1RH2HzoFYnChAdMYTibANAXWf
 QZBVU7IebP1ahW0r0fvXWbYOMx16sY2LlgHNAp3MeL2fK4WsQYeRRD8sm97R/IgIi5Dx
 Yp68en7YySE9IqXxfMM46kLrfinIjYMtbURGpq6Ju2RlUq/ZbjBJwjdbMSquhRkmyq2A
 ifVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent
 :mime-version;
 bh=3Jn0kqq1o29dEJ+kq41UcTxb2nJW8i+soYAYgW15YcQ=;
 b=Jht1gwuRp12kdYdd9d2gjZgSc24vwpSke+cR91foKeCqUxafoVlwdx8e/Han+bkifx
 vz+zVKWL5Zqe7P2teznwY6+ebY8cL903oFEIaV3/VOPJ3e/kH/KSi5JTHxJAX+7OaUpV
 r86m1gVoKqadgBfZtqH8CSjkqKmUk0JXJ/vnMnIumH4GYj5DK5AmxuPewdNDoucVHXHM
 377A9dsaYypGiQE59HTHNtMyOy01cAMhPah80IKQ958B0yOvluPPu7lmsJ8xeC6DcHGG
 wVTkxbCVbLBW9DUTr03zqhuaJv2T2hOOeGZ/OF8ZK6zzKyZjy/c/pBynjMUADiP9CTle
 YB1g==
X-Gm-Message-State: AODbwcDgLvQKjiBM8yp7J2uVpsG82WH0+QbCSkUCzRIapQPpRdQ8DkB1
 uZLu6hrxxGjFNuf3
X-Received: by 10.107.139.4 with SMTP id n4mr24736448iod.178.1496273028257;
 Wed, 31 May 2017 16:23:48 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id u100sm7639891iou.52.2017.05.31.16.23.46
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 31 May 2017 16:23:47 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.0.50: Macroexpanding cl-loop and friends (make-symbol usage)
Date: Wed, 31 May 2017 17:23:37 -0600
Message-ID: <8737bk8vba.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

Consider the following simple cl-loop form:

(cl-loop for x in '(1 2 3)
         for y in '(a b c)
         collect (list x y))


The macroexpanded result is:

(cl-block nil
  (let*
      ((--cl-var--
        '(1 2 3))
       (x nil)
       (--cl-var--
        '(a b c))
       (y nil)
       (--cl-var-- nil))
    (while
        (and
         (consp --cl-var--)
         (progn
           (setq x
                 (car --cl-var--))
           (consp --cl-var--)))
      (setq y
            (car --cl-var--))
      (push
       (list x y)
       --cl-var--)
      (setq --cl-var--
            (cdr --cl-var--))
      (setq --cl-var--
            (cdr --cl-var--)))
    (nreverse --cl-var--)))


It's easy to verify that this expansion doesn't do the same job by
noticing that the macroexpanded form always returns nil.

Note that in Common Lisp (at least in SBCL), macroexpanding and then
evaluating the result works as expected.

This is because cl-macs.el uses make-symbol instead of gensym, like SBCL
does.

Should cl-loop and friends use cl-gensym? One possible disadvantage to
that approach is that since Emacs Lisp lacks CL's bignums, it could lead
to some issues past most-positive-fixnum.

The reason I reported this is actually because I found it difficult to
debug macroexpanded cl-loop forms when all of the uninterned symbols had
the same representation. Using cl-gensym would help with debugging.




Acknowledgement sent to Alex <agrambot@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#27177; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 6 Jun 2017 20:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.