Subject: Re: bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...)

From: Stefan Monnier <[email-masked]>
Date: Wed, 06 Aug 2014 13:26:22 -0400

> 	Given that switch-to-buffer returns its argument, /and/ given
> 	that mapc returns the sequence it’s given, I suggest that the
> 	(mapcar 'switch-to-buffer LIST) forms in lisp/files.el be
> 	replaced with (mapc 'switch-to-buffer LIST), – if only to avoid
> 	the unnecessary consing when the list is effectively copied in
> 	the mapcar case.

Thanks, I think it's indeed a valid/correct optimization, but I really
dislike relying on mapc's return value (it really should not return any
value at all).

In this case, the optimization doesn't seem worth the inconvenient of
having a very unusual code (relying on mapc's return value), since
those few cons cells we save are drowned in the noise of all the
code run by switch-to-buffer.

        Stefan