unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48219: 27.1.90; CL-LOOP facility fails with hash tables
@ 2021-05-04  8:46 Juan José García Ripoll
  0 siblings, 0 replies; only message in thread
From: Juan José García Ripoll @ 2021-05-04  8:46 UTC (permalink / raw)
  To: 48219


(cl-loop
 for database in nil
 for aux = (message "databse: %S" database)
 for entry being the hash-values of database
 do (message "FOO %S" database))

This code should do nothing, because variable DATABASE runs over an empty list. Yet the macroexpansion of the loop produces code that tries to run over the entries of DATABASE, which is NIL.

(cl--block-wrapper
 (catch '--cl-block-nil--
   (let* ((--cl-var-- nil)
	  (database nil)
	  (aux nil))
     (cl-block --cl-finish--
       (maphash (lambda (--cl-var-- entry)
		  (or (consp --cl-var--) (cl-return-from --cl-finish-- nil))
		  (setq database (car --cl-var--))
		  (setq aux (message "databse: %S" database))
		  (message "FOO %S" database)
		  (setq --cl-var-- (cdr --cl-var--)))
		database))
     nil)))

Compare this with

(cl-prettyprint
 (macroexpand '(cl-loop
 for database in nil
 for aux = (message "databse: %S" database)
 do (message "FOO %S" database))))

(cl--block-wrapper
 (catch '--cl-block-nil--
   (let* ((--cl-var-- nil)
	  (database nil)
	  (aux nil))
     (while (consp --cl-var--)
       (setq database (car --cl-var--))
       (setq aux (message "databse: %S" database))
       (message "FOO %S" database)
       (setq --cl-var-- (cdr --cl-var--)))
     nil)))

Here the resulting code properly checks for the --cl-var-- variabel that runs the loop


In GNU Emacs 27.1.90 (build 1, x86_64-w64-mingw32)
Repository revision: 37eba74d609c74bcf9ac3c481a29377913783ac4
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.928)

Recent messages:
nnimap read 0k from correo.csic.es [2 times]
No more unseen articles
No more unread articles
nnimap read 0k from correo.csic.es
No more unseen articles
No more unread articles
Auto-saving...done
Mark set
Replaced 122 occurrences
Calendar ~/Nextcloud/Documents/Notes/calendar.ics unchanged
Quit
Configured using:
 'configure
 --prefix=/c/Users/juanj/src/emacs-build/pkg/emacs-27_1_90-x86_64
 --with-zlib --with-gnutls --with-xml2 --with-lcms2 --with-json
 --with-harfbuzz --with-cairo --with-rsvg --with-png --with-gif
 --with-tiff --with-jpeg --with-xpm --disable-build-details
 --disable-silent-rules --without-dbus'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: cp1252

Major mode: Summary

Minor modes in effect:
  shell-dirtrack-mode: t
  display-time-mode: t
  which-key-mode: t
  icomplete-mode: t
  save-place-mode: t
  savehist-mode: t
  gcmh-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/modus-vivendi-theme-0.13.2/modus-vivendi-theme hides c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/modus-themes-1.2.4/modus-vivendi-theme
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/modus-operandi-theme-0.13.2/modus-operandi-theme hides c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/modus-themes-1.2.4/modus-operandi-theme
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-virtual hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-virtual
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-view hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-view
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-util hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-util
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-tools hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-tools
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-sync hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-sync
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-outline hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-outline
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-occur hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-occur
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-misc hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-misc
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-loader hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-loader
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-links hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-links
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-isearch hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-isearch
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-info hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-info
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-history hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-history
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-dev hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-dev
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-cache hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-cache
c:/Users/juanj/OneDrive/Library/Emacs/elpa-27/pdf-tools-0.90/pdf-annot hides c:/Users/juanj/scoop/apps/emacs/current/share/emacs/site-lisp/pdf-tools/pdf-annot

Features:
(shadow warnings emacsbug rng-xsd xsd-regexp rng-cmpct rng-nxml
rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util
rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode nxml-util
nxml-enc xmltok arc-mode archive-mode doc-view image-mode exif nnfolder
jka-compr misearch multi-isearch gnus-icalendar org-capture org-refile
org-tempo tempo org org-macro org-footnote org-pcomplete org-list
org-faces org-entities noutline outline org-version ob-python python
tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete ob ob-tangle org-src ob-ref ob-lob ob-table
ob-exp ob-comint comint ring ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat org-macs org-loaddefs icalendar flow-fill smtpmail
flyspell ispell vc-git diff-mode mailalias sendmail bbdb-mua bbdb-com
crm bbdb bbdb-site timezone face-remap nnir mule-util sort smiley
ansi-color gnus-cite mm-archive mail-extr gnus-bcklg gnus-async qp
gnus-ml gnus-topic gnus-demon utf-7 nndraft nnmh nnmaild epa-file gnutls
network-stream nsm nnml nnnil gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig
nntp gnus-cache gnus-sum url url-proxy url-privacy url-expand
url-methods url-history shr url-cookie url-domsuf url-util svg xml dom
gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo parse-time iso8601 gnus-spec gnus-int gnus-range message
rmc puny dired dired-loaddefs format-spec rfc822 mml mml-sec epa derived
epg mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail-utils mm-util mail-prsvr wid-edit time-date time cal-china lunar
solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs appt
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
benchmark-init-modes debug backtrace find-func mailcap which-key
icomplete epg-config modus-operandi-theme modus-themes saveplace
savehist edmacro kmacro benchmark-init advice gcmh diminish cl-extra
help-mode use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core finder-inf tex-site info package easymenu browse-url
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads w32notify w32
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 1068058 390211)
 (symbols 48 37670 37)
 (strings 32 286486 56033)
 (string-bytes 1 8189807)
 (vectors 16 85853)
 (vector-slots 8 2485239 445144)
 (floats 8 1011 1568)
 (intervals 56 14806 18837)
 (buffers 1000 184))

-- 
Juan José García Ripoll

Quantum Information and Foundations Group
Institute of Fundamental Physics IFF-CSIC
Calle Serrano 113b, Madrid 28006 Spain
http://quinfog.hbar.es - http://juanjose.garciaripoll.com





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-04  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04  8:46 bug#48219: 27.1.90; CL-LOOP facility fails with hash tables Juan José García Ripoll

unofficial mirror of bug-gnu-emacs@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/emacs-bugs/0 emacs-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 emacs-bugs emacs-bugs/ https://yhetil.org/emacs-bugs \
		bug-gnu-emacs@gnu.org
	public-inbox-index emacs-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.bugs
	nntp://news.gmane.io/gmane.emacs.bugs


code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs.git

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git