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: Stephen Gildea
Subject: Re: a property "definition-type" would help find macro-defined tests
Date: Mon, 13 Jan 2025 13:34:01 -0800

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".

The design of 'definition-type' affects the complexity and
readability of both the find-function implementation and all
macros that use the property.
(Admittedly the find-function-search-for-symbol complexity is
a minor point, because the price is paid only once.)

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.

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)

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

 < Stephen



reply via email to

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