-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Issue
If an expansion of a rule using a mapping produces an object tagged with a tag class that happens to be a parameter of the rule, then this tag class will be expanded too.
Example
This code compiles:
TAGS
Odd = 1 3
Even = 2 4
Numbers = Odd Even
MAPPINGS
horizontal => DirNum
left right -> Odd Even
OBJECTS
Obj:Numbers
blue
Player P
red
Background .
Black
COLLISIONLAYERS
Background
player Obj:Numbers
RULES
horizontal Odd Even [ > Player | ] -> [ > Player | Obj:DirNum ]
LEVELS
.....
.....
..P..
.....
.....
Why it's an issue
My idea with rule parameters was that you could know easily what objects in a rule will be affected by a parameter, by simply looking in the rule for the tags that are either the parameter directly or a mapping defined on this parameter.
But here, what happens is that a first parameter (directions
, in the example above) is used with a mapping (DirNums
) that is replaced during the expansion with tags classes (Odd
and Even
), which happen to also be parameters of the rule, and they get expanded because of that.
So you have an indirect use of the parameters. Since parameters and mappings are already complicated business and mappings already go against the idea of pattern matching (a direct representation of what you want to match), I prefer avoiding even more complex edge cases.
It also produces a lot of doubles of the rules generated.
Issue's status
I'm actually not sure if it's a useful feature that should be preserved, or if it's a source of confusion that should be removed. Anyway, it is not what I intended to do.