[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67523: check-declare doesn't account for shorthands
From: |
João Távora |
Subject: |
bug#67523: check-declare doesn't account for shorthands |
Date: |
Wed, 29 Nov 2023 09:56:32 +0000 |
On Wed, Nov 29, 2023 at 9:12 AM Joseph Turner <joseph@ushin.org> wrote:
> A potential solution could be to convert the longhand symbol into its
> shorthand form and pass that into re-search-forward. This is tricky
> since there may be multiple different shorthands which could yield the
> same longhand form. It might be more feasible to run re-search-forward
> on a known common suffix portion of the symbol name, then with point on
> the suspected definition, run `intern-soft' to get the full symbol name.
No, this is brittle. Check-declare, if it's to be useful (is it?)
is probably meant to be as precise as possible.
> A workaround is to not use shorthands in function definitions.
That's letting the bad guys win :-)
> Thoughts?
As usual, my thoughts are that tools that read Lisp code
should use the Lisp reader, not regular expressions.
Here, check-declare should just walk the whole file.
When it finds a a symbol atom that matches a definition
form, look in the next atom and check if it matches the probe.
If you don't want to intern all the symbols in the you can read
to a separate obarray I think.
João