-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix RuleOrderedActivation Fressian Handler #395
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -492,11 +492,13 @@ | |
(.writeObject w (.-node-id ^RuleOrderedActivation c) true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we recap the discussion about the non-usage of this handler in a sentence or two of comments inline here? |
||
(.writeObject w (.-token ^RuleOrderedActivation c)) | ||
(.writeObject w (.-activation ^RuleOrderedActivation c)) | ||
(.writeInt w (.-rule-load-order ^RuleOrderedActivation c)))) | ||
(.writeInt w (.-rule-load-order ^RuleOrderedActivation c)) | ||
(.writeBoolean w (mem/use-token-identity? ^RuleOrderedActivation c)))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you have the type hint on c here? Type hints are normally used so that Clojure can resolve a Java interop call to a particular function at compile time. With protocol functions the workflow in the end is something like:
This will actually be a bit more performant if you invoke the JVM method directly; it will be mangled a bit for the ? I think but it will exist. The reason to use the protocol function instead is if you extend the protocol outside the definition of the type, for example with extend-protocol, but that isn't the case here. If you do this you'll want the type hint. Might be good to do for the sake of the pattern although it doesn't really matter here unless a user reuses the handler in a hotspot. That sort of thing could matter a bit if you were doing it on a type here that is actually used though and it is an easy optimization to make. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The hint isn't useful. I think it is just left over from when the field was being directly accessed here in the first revision of this PR (that wouldn't work though since it is a private field and that's why this change was made). I don't think that direct interop with a protocol is going to be important here. The inline caching would likely be just about the same and this isn't a particularly "hot spot" (not even used by durability at this point and not used elsewhere since it was broken before this). Best to stay basic when it can be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a big deal either way as you say. I'm OK with using the protocol here if we make this change, I mainly just wanted to raise awareness for cases where it might matter. |
||
:readers {"clara/ruleorderactivation" | ||
(reify ReadHandler | ||
(read [_ rdr tag component-count] | ||
(mem/->RuleOrderedActivation (.readObject rdr) | ||
(.readObject rdr) | ||
(.readObject rdr) | ||
(.readObject rdr) | ||
(.readObject rdr))))}} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we indicate directly in the changelog that the functional impact here is very limited as discussed at #394 (comment) and #395 (review) ? I'd like to avoid unnecessary user concern. Something like "The bug is only exposed if reusing the Clara Fressian handlers outside of Clara's direct APIs"