[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#72279: [PATCH] Non-local exits from outside the lexical scope are ca
From: |
Andrea Corallo |
Subject: |
bug#72279: [PATCH] Non-local exits from outside the lexical scope are caught by cl-block |
Date: |
Fri, 26 Jul 2024 03:39:46 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Thuna <thuna.cing@gmail.com> writes:
>> BTW, for the second patch a simpler solution is to expand
>>
>> (cl-block A FOO)
>> to
>> (let ((cl--block--A ',(make-symbol "A")))
>> (catch cl--block--A FOO))
>>
>> and
>>
>> (cl-return B FOO)
>> to
>> (throw cl--block--B FOO)
>>
>> which will signal an "unknown variable cl--block--B" if a `cl-return` is
>> used outside of its block.
>
> Aha, yes, that would indeed be simpler.
>
>> But the optimization of `cl-block` when the tag is not used is
>> important, so I don't think it's a good approach.
>
> I don't have any particular complaints against keeping this
> optimization, but for the record would you be able to expand on what
> exactly the problem is? It doesn't seem obvious to me that unused
> `catch'es would make such a meaningful difference.
Unused catches are a problem because they bloat bytecode unnecessary,
also they prevent a number of optimizations in the native compiler as
well. Essentially every time you have a landing pad like a catch you
cannot make assumptions on where you are landing from and what's the
state of your machine.
It's very important we keep on removing unnecessary catches, that's why
I was asking in my previous mail.
Andrea