Skip to content

Commit 9283856

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 49f62a1 commit 9283856

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
@@ -31,7 +31,10 @@ Macros
3131

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

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

0 commit comments

Comments
 (0)