Skip to content

Commit 879d93d

Browse files
committed
Add further rationale behind why no specialization in multiple macro match rules for issues that could come up during refactors.
1 parent 5cd15f4 commit 879d93d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/coding-guidelines/macros.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,10 @@ Macros
326326

327327
In a declarative macro the ordering of the patterns will be the order that
328328
they are matched against which can lead to unexpected behavior in the case
329-
where we have unique behavior intended for a particular expression.
329+
where we have unique behavior intended for a particular expression. The concern
330+
in particular is that while the ordering may be done correctly when the
331+
macro match rules are written, it's possible in a refactor for them to
332+
unintentionally be moved around in order.
330333

331334
If needing to specialize logic within the macro based on a particular
332335
expression's value, it is better to not use a declarative macro with multiple rules.

0 commit comments

Comments
 (0)