[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp bytecode disassembler
From: |
Štěpán Němec |
Subject: |
Re: Regexp bytecode disassembler |
Date: |
Sat, 21 Mar 2020 21:44:49 +0100 |
User-agent: |
Notmuch/0.29.3 (https://notmuchmail.org) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
On Sat, 21 Mar 2020 22:30:49 +0200
Eli Zaretskii wrote:
>> Do you mean you would prefer to use `cond' and rewrite all those clauses
>> to something like the following?
>>
>> (cond
>> ((eql opcode 0) (cons 'no-op 1))
>> ((eql opcode 1) (cons 'succeed 1))
>
> Yes.
>
>> Maybe readability is much more subjective than I thought, but I find the
>> latter very suboptimal, to say the least.
>
> Why "suboptimal"?
It's unnecessarily verbose and most of that is just repetition, i.e.
noise, which makes it harder to read. It _begs_ to be rewritten with
(p)case. :-)
>> Also, isn't "just selecting from a list of fixed values" precisely the
>> reason to use some sort of case/switch instead of the general `cond'?
>
> 'cond' _is_ a case/switch construct.
I have to disagree. `cond' is a general conditional construct: all the
clauses are completely independent, testing for anything, whereas in a
`case' you have one object that is tested against each clause. Which is
precisely the case here.
>> Certainly `pcase' can also be useful in more complicated use cases, but
>> it will expand to the cond form anyway, so I also don't see any
>> performance concerns.
>
> I said nothing about the performance.
OK. I was just trying to come up with some other possible factors, as I
found the readability argument so surprising.
--
Štěpán
- Regexp bytecode disassembler, Mattias Engdegård, 2020/03/20
- Re: Regexp bytecode disassembler, Andreas Schwab, 2020/03/20
- Re: Regexp bytecode disassembler, Eli Zaretskii, 2020/03/20
- Re: Regexp bytecode disassembler, Mattias Engdegård, 2020/03/21
- Re: Regexp bytecode disassembler, Eli Zaretskii, 2020/03/21
- Re: Regexp bytecode disassembler, Štěpán Němec, 2020/03/21
- Re: Regexp bytecode disassembler, Eli Zaretskii, 2020/03/21
- Re: Regexp bytecode disassembler,
Štěpán Němec <=
- Re: Regexp bytecode disassembler, Eli Zaretskii, 2020/03/22
- Re: Regexp bytecode disassembler, Štěpán Němec, 2020/03/22
- Re: Regexp bytecode disassembler, Eli Zaretskii, 2020/03/22
- Re: Regexp bytecode disassembler, Štěpán Němec, 2020/03/22
- Re: Regexp bytecode disassembler, Eli Zaretskii, 2020/03/22
- Re: Regexp bytecode disassembler, Paul Eggert, 2020/03/22
- Re: Regexp bytecode disassembler, Dmitry Gutov, 2020/03/22
- Re: Regexp bytecode disassembler, Dmitry Gutov, 2020/03/21
- Re: Regexp bytecode disassembler, Mattias Engdegård, 2020/03/21
- RE: Regexp bytecode disassembler, Drew Adams, 2020/03/21