Email list hosting service & mailing list manager

Proposed terminology, perhaps useful Daphne Preston-Kendal (16 Oct 2021 09:44 UTC)
Re: Proposed terminology, perhaps useful Marc Nieper-Wi├čkirchen (16 Oct 2021 12:56 UTC)
Re: Proposed terminology, perhaps useful Daphne Preston-Kendal (16 Oct 2021 13:17 UTC)
Re: Proposed terminology, perhaps useful Marc Nieper-Wi├čkirchen (16 Oct 2021 14:42 UTC)
Re: Proposed terminology, perhaps useful John Cowan (21 Oct 2021 22:29 UTC)

Proposed terminology, perhaps useful Daphne Preston-Kendal 16 Oct 2021 09:44 UTC

It is generally considered bad Lisp style to use a macro where a procedure would do; however, as demonstrated by <https://gitlab.com/dpk/presrfis/-/tree/master/syntax-keywords>, there are cases where macros can provide features of comparatively marginal benefit amounting to syntactic sugar. (An older example of such a procedure-like macro, providing the same keyword-argument feature, is the make-parser macro in Oleg Kiselyov’s SSAX.)

It’s not easy to come up with a definition which more precisely encapsulates this class of ‘macros which could be procedures, but might nonetheless be worth writing as macros’. I would suggest something along the lines of: a macro which always expands into one call to one procedure, whose source code is not given in the invocation of the macro itself. (Or a macro which may not always expand into a call to a *single* such procedure, but which could be implemented to do so.)

Because it may be useful to provide both the underlying procedure (for use in ‘apply’ etc.) as well as the macro as syntactic sugar, and we may actually want to include such procedure-like macros in a standard, it might be useful to have a name for such things for use in specifications.

By analogy to linguistics, the most natural name for such syntax might be ‘auxiliary syntax’, as ‘do’ is an auxiliary verb in sentences such as ‘I do not like green eggs and ham’. Unfortunately, ‘auxiliary syntax’ already has a different meaning in Scheme (the keywords such as ‘else’ and ‘=>’ used in cond and case.)* While the analogy is less perfect, I would like to suggest the name ‘periphrastic syntax’.

Does anyone have any other seemingly-legitimate examples of using macros for procedure-like behaviour? (Other, that is, than providing optimized keyword arguments.)

Daphne
—
* Note for the (seemingly disproportionately many) German-speaking Scheme users: the same consideration apparently does not apply to „Hilfssyntax“ or „Hilfsmakro“, by analogy to „Hilfsverb“.