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
custom defined method no longer works (method defined { … }) #6029
Comments
From @AlexDanielCode: Result (2015.12,2016.02): Result (2016.03,HEAD): Bisectable points to rakudo/rakudo@24b4b23 The commit message did not indicate that �defined� method should no longer work, so my best guess is that the change is not intentional. However, if this is not supposed to work, then what about throwing an error when the user attempts to create a �defined� method? |
From @smlsA custom `.defined` method actually still works fine: � class C { method defined { True } }; say C.defined But the `?` operator doesn't call `.defined`, it calls `.Bool`: � class C { method Bool { True } }; say ?C Before the cited commit, class `Any` provided a default implementation for `.Bool` that delegated to `.defined`, and your custom class inherited that. Now, the default implementation of `.Bool` checks `.DEFINITE` (via the `:D` / `:U` syntax) instead of `.defined`. I don't know whether that subtle change was intentional, but it seems reasonable. Overriding `.defined` for a custom class is something that should only be necessary in rare situations, so it's not a great burden to ask users to also override method `.Bool` in those situations. |
The RT System itself - Status changed from 'new' to 'open' |
From @zoffixznetOn Mon, 23 Jan 2017 01:37:16 -0800, alex.jakimenko@gmail.com wrote:
+1 to smsl's and lizmat's response (on mailing list). Custom `defined` method still works; the Bool method�which is what your operator calls�simply got decoupled from it. The new behaviour is less surprising: only what the user actually overrides is affected. And I agree with lizmat that is isn't a bug. |
@zoffixznet - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#130629 (status was 'rejected')
Searchable as RT130629$
The text was updated successfully, but these errors were encountered: