New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reloading namespace with defrule results in IllegalArgumentException #44
Comments
Seems to have something to do with the redefintion of |
Unfortunately I'm traveling for the next couple days, but plan on taking a In any case, thanks for reporting this! |
Just a few thoughts (my 2 cents). I think it debatable if someone should expect that a re-def'ed This sounds potentially to just be a REPL issue to me. I suppose it does sound interesting to think about if matching on something that doesn't change, like the qualified name, would cause much disruption though. Maybe it is more Clojure-like to just think of the type generated via I think the approach of keeping the |
Generally, I think I agree with Mike on this. I actually haven't used defrecord much in my own code and where I have, I haven't created a situation that would highlight similar behavior. Putting defrecords in a separate namespace seems to be a clean enough solution. I do also like the idea where a re-def doesn't mean a different type altogether but will think about it a little more. Thanks for a cool project and an interesting discussion. |
I tend to agree with Mike on this as well. Interestingly, Clojure protocols have similar problems: if a record is re-def'd, any protocol extensions of that record need to be reloaded as well to work with the new version. So I think it's fair for Clara to have similar constraints as Clojure's protocol constructs do. I'd actually like to see this handled better with protocols -- if some facility came along to deal with that, we should follow suit here. But that's an entirely different discussion. :) |
I'm going to close this due to the above discussion, but feel free to re-open or create another issue if you disagree. Re-loading records isn't a great experience in Clojure in general so the issues described here seem like something that could be considered Clojure-wide rather than in this project. |
Just starting to play around with clara-rules and tried the simple example contained in the readme and a bit of an expanded one (instead of printing as a consequence of a rule, I inject a response record.
Seems that if I reload just the namespace that contains a bunch of defrule's, I get an exception "The given query is invalid or not included in the rule base." If I do a reload-all, then it works as I would expect.
If I use the example as is, it runs the first time and if I reload just the namespace, the println's don't seem to be executed.
The text was updated successfully, but these errors were encountered: