unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings
       [not found] ` <20170216014308.12DC326007@vcs0.savannah.gnu.org>
@ 2017-02-16 13:32   ` Stefan Monnier
  2017-02-17  4:44     ` Mark Oteiza
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2017-02-16 13:32 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mark Oteiza

> +  (if vars
> +      `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
> +         ,@code)
> +    `(progn ,@code)))

Just curious here:

I resisted the temptation to do that when working on that code because
I thought that it should (both in the sense that I expect the current
code to behave that way, and in the sense that if it doesn't behave that
way, we should fix it) make no difference to the byte-code we generate.

So, I'm wondering if you've found a concrete case where it makes
a difference, or it's just that you wanted the output to look
more pretty.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings
  2017-02-16 13:32   ` [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings Stefan Monnier
@ 2017-02-17  4:44     ` Mark Oteiza
  2017-02-18  0:05       ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Oteiza @ 2017-02-17  4:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +  (if vars
>> +      `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
>> +         ,@code)
>> +    `(progn ,@code)))
>
> Just curious here:
>
> I resisted the temptation to do that when working on that code because
> I thought that it should (both in the sense that I expect the current
> code to behave that way, and in the sense that if it doesn't behave that
> way, we should fix it) make no difference to the byte-code we generate.
>
> So, I'm wondering if you've found a concrete case where it makes
> a difference, or it's just that you wanted the output to look
> more pretty.

Nope, AFAICT the bytecode remains the same.

In the past I noticed that pcase expanded things to (let nil ...), which
I think is a bit annoying wrt readability, yes; however just recently I
was poking at elint.el, which complains about such forms with

  Empty varlist in let: (let nil <snip>)

so I was more inclined to change it.

Between vars possibly being expensive, and--one step beyond that--using an
uninterned symbol to ameliorate evalling vars twice incurring a cost
with dynamic binding, I suppose this change was short sighted.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings
  2017-02-17  4:44     ` Mark Oteiza
@ 2017-02-18  0:05       ` Stefan Monnier
  2017-02-18  0:10         ` Mark Oteiza
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2017-02-18  0:05 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: emacs-devel

> In the past I noticed that pcase expanded things to (let nil ...), which
> I think is a bit annoying wrt readability, yes; however just recently I
> was poking at elint.el, which complains about such forms with
>
>   Empty varlist in let: (let nil <snip>)
>
> so I was more inclined to change it.

OK, thanks.

> Between vars possibly being expensive, and--one step beyond that--using an
> uninterned symbol to ameliorate evalling vars twice incurring a cost
> with dynamic binding, I suppose this change was short sighted.

Sorry, I didn't understand this part of your message.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings
  2017-02-18  0:05       ` Stefan Monnier
@ 2017-02-18  0:10         ` Mark Oteiza
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Oteiza @ 2017-02-18  0:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 17/02/17 at 07:05pm, Stefan Monnier wrote:
> > In the past I noticed that pcase expanded things to (let nil ...), which
> > I think is a bit annoying wrt readability, yes; however just recently I
> > was poking at elint.el, which complains about such forms with
> >
> >   Empty varlist in let: (let nil <snip>)
> >
> > so I was more inclined to change it.
> 
> OK, thanks.
> 
> > Between vars possibly being expensive, and--one step beyond that--using an
> > uninterned symbol to ameliorate evalling vars twice incurring a cost
> > with dynamic binding, I suppose this change was short sighted.
> 
> Sorry, I didn't understand this part of your message.

I was pondering not sending the last part because I was suddenly getting
really tired.  As long as the change is okay I guess it doesn't matter.
Woops.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-18  0:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170216014306.20854.5128@vcs0.savannah.gnu.org>
     [not found] ` <20170216014308.12DC326007@vcs0.savannah.gnu.org>
2017-02-16 13:32   ` [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings Stefan Monnier
2017-02-17  4:44     ` Mark Oteiza
2017-02-18  0:05       ` Stefan Monnier
2017-02-18  0:10         ` Mark Oteiza

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).