-
Notifications
You must be signed in to change notification settings - Fork 46
Things like java-time[.api]/truncate-to
do not work correctly when underlying protocol is extended
#95
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
Comments
Thanks for the detailed report. I'll think it over. Notes:
|
@camsaul tangentially related, do you compile your app with direct linking? |
frenchy64
added a commit
that referenced
this issue
Jan 5, 2023
frenchy64
added a commit
that referenced
this issue
Jan 5, 2023
Fixed in 1.2.0. |
@frenchy64, no we don't use direct linking |
@camsaul thanks. I since learnt that protocols methods are never directly linked. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Metabase we extended the
Truncatable
protocol with some tweaks that we needed to handle certain situations:https://github.com/metabase/metabase/blob/d0be9fc4c291438204e792f3981bf7fe5a42878a/src/metabase/util/date_2.clj#L289-L298
Previously, we were using a fork of 0.3.3, where the
java-time
namespace used Potemkinimport-vars
, which meant thatjava-time/truncate-to
would be updated when the underlyingjava-time.core/truncate-to
var changed (when usingextend
/extend-protocol
/etc.The newer version of this namespace just uses
def
to capture the value ofjava-time.core/truncate-to
when the namespace is loaded; any subsequent changes to the underlying var no longer causejava-time/truncate-to
orjava-time.api/truncate-to
to be updated.I spent a little while trying to debug
errors in Metabase after upgrading to the latest version of this library until I figured out what was going on.
Switching back to Potemkin would prevent others from running in to issues like these. Alternatively, instead of something like
maybe you could do
or even
so the var gets resolved each time you use it.
The text was updated successfully, but these errors were encountered: