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
Add Mu.Callable($method) "coercer" #5513
base: main
Are you sure you want to change the base?
Conversation
The idea being that *Raku* should provide a HLL interface to obtain a Sub object for the given method name on the invocant. $ raku -e 'say Int.Sub("Str")(687, :subscript)' ₆₈₇ In place of the .^find_method logic, which is *not* Raku specific according to the documentation: https://docs.raku.org/type/Metamodel/DefiniteHOW#method_find_method
I'd count |
- use nqp::tryfindmethod instead of nqp::findmethod - use nqp::ifnull instead of // to handle VMnull values
I would call it |
In hindsight, this is probably better, as .Sub may be considered premature huffmanization. And what is being returned, is usually *not* a Sub object anyway.
There are indeed quite of a few occurrences of
|
On quick glancing, these appear the meta-model methods called in roast:
|
It's not that much the method itself is specific but the interface it provides. For example, |
Well, there's that indeed. Also I think we need to get rid of the "Perl6" in the naming of the MOP. |
BTW, did you see my other comments about |
I don't see them here. Where should I have seen them? In any case, the method is now "pure" and the return value is |
I made them under https://github.com/rakudo/rakudo/pull/5513/files/b23f0e5fe68fbdc5fea8823428445152cc00e6ea and can see both up here. Anyway... The method cannot be Returning |
Ah, @vrurg's latest comment only appeared after I posted this comment. (BTW, I'm not seeing any comment by @vrurg on the commit he linked. Maybe GH has caching issues?!? Or my browser (chrome)?) A cache on
|
It looks like links to review comments are different from plain commits. I've updated the link above to the working one: https://github.com/rakudo/rakudo/pull/5513/files/b23f0e5fe68fbdc5fea8823428445152cc00e6ea |
As suggested by vrurg++
The idea being that Raku should provide a HLL interface to obtain a Callable object for the given method name on the invocant.
In place of the .^find_method logic, which is not Raku specific according to the documentation:
https://docs.raku.org/type/Metamodel/DefiniteHOW#method_find_method
EDIT: change
Sub
toCallable