-
Notifications
You must be signed in to change notification settings - Fork 77
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
Move Definition functions defined in before_compile to using as overridable #47
base: master
Are you sure you want to change the base?
Conversation
The code generated in Definition includes default implementations of functions which are supposed to be overridable. The problem is that if the overridable implementations do pattern matching in the function head and those patterns fail, instead of an error being raised, the default implementation generated by Waffle is used, which hides the error and can result in unexpected behavior (in my case, it was the ACL being incorrectly set). This change makes those functions overridable like the others, which preserves the default behavior, but behaves as expected when a custom implementation is provided.
Thank you for the PR, looks good. I'll merge it within couple of days. |
Hi, Thank you for your effort. I looked into PR. It'll introduce breaking changes for most projects using this library who relies on current behaviour and it fails most of the S3 uploading tests. How to run tests with S3. Acl behaviour is expected because we have With proposed changes if we implement Feedback if welcome. Probably we could change other functions who don't rely on default fall back behaviour. |
Thanks for taking a look! Just to be clear, we're running a fork of this library with this patch in production (though it is not fully caught up with master now, since the fork was spun off at the time I created this PR), and have for some time now, with no issues - other than potential changes in master, perhaps something about how we define our storage modules differs from the tests.
The fallback behavior with
That's not actually the case, and is what this PR is intended to allow you to do. Currently you can't customize the behavior of
Could you clarify why you think this is the case? It wasn't possible previously to define a custom Ultimately though, the problem I'm trying to solve here is that |
The code generated in Definition includes default implementations of
functions which are supposed to be overridable. The problem is that if
the overridable implementations do pattern matching in the function head
and those patterns fail, instead of an error being raised, the default
implementation generated by Waffle is used, which hides the error and
can result in unexpected behavior (in my case, it was the ACL being
incorrectly set).
This change makes those functions overridable like the others, which
preserves the default behavior, but behaves as expected when a custom
implementation is provided.
NOTE: As far as I can tell, this change should preserve the existing behavior, but prevent the bug I described above, but admittedly I may be missing something; let me know if we need to make any adjustments here.