emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a property "definition-type" would help find macro-defined tests


From: Eshel Yaron
Subject: Re: a property "definition-type" would help find macro-defined tests
Date: Tue, 14 Jan 2025 08:21:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi,

Stephen Gildea <stepheng+emacs@gildea.com> writes:

> Eshel Yaron <me@eshelyaron.com> wrote:
>
>>   a symbol in ELisp can name multiple things of different types, the same
>>   symbol can have definitions as a function, variable, face, feature, etc.
>>   It doesn't make sense to talk about "the definition type" of a symbol,
>>   because it can have multiple types.
>
> This is quite true.  Many symbols have multiple objects
> attached to them.  But not these symbols.
>
> The symbols that need help from 'definition-type' generally
> have only one definition.  They tend to be internal symbols
> defined by tests, and they tend to have parameterized names
> like "formatz-%012:::z-hhmm" or "syntax-br-comments-c-f60".

Indeed, for those symbols, this is a minor issue.  But the feature is
introduced and documented as generally applicable, without caveats.
So ideally it should work correctly for any symbol.
Otherwise, it might be a good idea to document this limitation.

> I think it is worth aiming primarily to reduce the burden on
> all the macro-writers.  We want to make it simple to maintain
> the integrity of the property, both in understanding how it
> works and in actually writing correct code.

That's a valid goal, but currently to use this feature correctly,
macro-writers have to make sure they only apply it to distinct symbols
that aren't used anywhere else, which is actually rather burdensome.
Safe interfaces mean less worries for developers, too :)

> This form, for 'definition-type':
>
>   (put 'my-test-name 'definition-type 'my-test-finding-regexp)
>
> is shorter and easier to understand and write than the form
> proposed for 'find-definition-alist':
>
>   (setf (alist-get 'ert-deftest (get 'my-test-name 'find-definition-alist))
>         'my-test-finding-regexp)

Yeah, but the first form is not enough, since in the current
implementation you also need to extend find-function-regexp-alist,
right?

> So, despite its limitations, the simpler design of
> 'definition-type' seems preferable.

I'm not sure it is simpler (see above), but even if it is, I think we
should (and can) find something that is both correct and simple.  ;)

WDYT?


Eshel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]