You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit of an oddity that I believe i have seen before. The issue seems to be with how clara resolves the fact type of the rule. Looking at the compiler code when generating the alpha nodes, if the fact-type is a symbol then it will be converted to a class otherwise it will remain as what ever was provided. This is to facilitate the default usage, ie. type as the default fact-type-fn.
In the example you provided, this would mean that the fact type of rule1 would match on [`IdHolder "A"] and not [IdHolder "A"], the former being a vector composed of a symbol/string combo and the latter being a class/string combo.
Im a bit torn here on what should be expected of clara in this situation, I feel its not very transparent that in one case the symbol would be replaced by a class but on the other hand it might be dangerous for clara to try and traverse the fact-type and replace symbols.
All of that being said, to answer the question, to get the example to function as expected:
From the google group (https://groups.google.com/g/clara-rules/c/F5ZC-uiIfa0/m/KPPUWbrwBAAJ):
This is a bit of an oddity that I believe i have seen before. The issue seems to be with how clara resolves the fact type of the rule. Looking at the compiler code when generating the alpha nodes, if the fact-type is a symbol then it will be converted to a class otherwise it will remain as what ever was provided. This is to facilitate the default usage, ie. type as the default fact-type-fn.
In the example you provided, this would mean that the fact type of rule1 would match on [`IdHolder "A"] and not [IdHolder "A"], the former being a vector composed of a symbol/string combo and the latter being a class/string combo.
Im a bit torn here on what should be expected of clara in this situation, I feel its not very transparent that in one case the symbol would be replaced by a class but on the other hand it might be dangerous for clara to try and traverse the fact-type and replace symbols.
All of that being said, to answer the question, to get the example to function as expected:
would simply need updated to:
Hope this helps,
Ethan
The text was updated successfully, but these errors were encountered: