all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72754: 31.0.50; Add a pcase-pattern-let?
@ 2024-08-22  2:02 Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-08-22 13:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-22  2:02 UTC (permalink / raw)
  To: 72754; +Cc: Stefan Monnier


Hello,

wouldn't it be a significant improvement and maybe a low hanging fruit
to add a macro allowing to add local pattern definitions?  I.e., like
`macrolet' by for pcase patterns?

It could help to make larger patterns better readable, by factoring out
long or repeatedly appearing patterns and giving them meaningful names.
Without cluttering the global namespace.

Maybe an implementation could be similar and as simple as that of
`rx-let'?


TIA,

Michael.







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#72754: 31.0.50; Add a pcase-pattern-let?
  2024-08-22  2:02 bug#72754: 31.0.50; Add a pcase-pattern-let? Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-08-22 13:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-08-24  5:56   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-22 13:38 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 72754

> wouldn't it be a significant improvement and maybe a low hanging fruit
> to add a macro allowing to add local pattern definitions?  I.e., like
> `macrolet' by for pcase patterns?

I don't know how important/useful it would be, but yes it would make
a lot of sense.  As a matter of fact, it's a general pattern which
recurs in all the packages which provide an extensible domain specific
language (peg.el, pcase.el, bindat.el, rx.el, gv.el, ...) and I'd like
to find a general solution.

It can also make sense to allow defining a set of extensions at one
place, and then make them available locally.


        Stefan






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#72754: 31.0.50; Add a pcase-pattern-let?
  2024-08-22 13:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-08-24  5:56   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-24  5:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 72754

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > wouldn't it be a significant improvement and maybe a low hanging fruit
> > to add a macro allowing to add local pattern definitions?  I.e., like
> > `macrolet' by for pcase patterns?
>
> I don't know how important/useful it would be, but yes it would make
> a lot of sense.  As a matter of fact, it's a general pattern which
> recurs in all the packages which provide an extensible domain specific
> language (peg.el, pcase.el, bindat.el, rx.el, gv.el, ...) and I'd like
> to find a general solution.

Makes sense, we could then also implement the dynamical docstring
generation for all of these in a general way.  As whole it's a bigger
project, though.

> It can also make sense to allow defining a set of extensions at one
> place, and then make them available locally.

Absolutely.

If you want to give it a try, I'm here...


Michael.





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-24  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  2:02 bug#72754: 31.0.50; Add a pcase-pattern-let? Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-22 13:38 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-24  5:56   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.