GNU bug report logs -
#8711
24.0.50; binding _ to unused values with lexical-binding
Previous Next
Reported by: Helmut Eller <eller.helmut <at> gmail.com>
Date: Sat, 21 May 2011 18:45:02 UTC
Severity: minor
Found in versions 24.0.50, 26.0.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):
* Stefan Monnier [2011-05-23 19:29] writes:
> I think the same problem happens with dotimes/dolist using the old
> definition: the loop vars `key' and `value' are let-bound outside the
> loop and then setq'd at each loop iteration (it's this setq that causes
> them to be "not left unused"). This was OK for the dynamic scoping case
> because let-binding is significantly more costly than setq, but it is
> not right for the lexical scoping case where the cost of let is not
> higher than `setq' and where the semantic is actually then wrong:
> e.g. if you "collect (lambda () value)" the current code ends up
> returning a list of functions that all return the last `value', rather
> than a list of functions that each return one of the `values' in
> the alist.
BTW, is there a good reason why we can't disallow setq on closed over
variables in Elisp? That kind of mutability seems like a bad idea in a
concurrent world. Closures are a new feature so we could make a
conscious decision not to introduce the problematic mutable variables.
Helmut
This bug report was last modified 3 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.