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 syntactic sugar #4
Comments
|
Somehow I'm not convinced that this is the right sugar to add. Much of that is only a feeling, but one thing I really don't like is using named arguments, which are inherently unordered, for calling code, which usually cares a great deal about ordering. I wouldn't reject this entirely, just propose to think of other ways to add syntactic sugar. This isn't really thought out yet, but maybe one could do This would have the advantage of actually mapping a method call to a method call. I can't think of a good way to map subroutine calls; maybe I'll think of something better in time. |
|
@moritz, what are your thoughts on or rather This would require a more heavy-weight implementation - instead of just using multiple-dispatch, we'd need some objects that act as proxies... |
|
I know ~zero perl6, and even less about Inline-Perl5, but I'd like to make the observation that it would be helpful to separate compile-time and run-time actions, and try to achieve as much as possible at compile-time. Apart from anything else this is likely to significantly improve performance. |
|
@timbunce, one should of course always be aware of performance implications. However, I don't think there's really all that much you can do at compile time when the perl5 interpreter isn't around. Also keep in mind that arguments are converted between P5 and P6 land on each call, so dispatch will probably be 'heavy' anyway. |
|
@cygx, I think you've already expressed the kind of thing I was thinking of with your example above, where: is purely runtime, whereas the separation of work expressed here: means that the Essentially I'm just saying that the design of Inline-Perl5 and any sugar layered on top, should enable and emphasise pre-caching as much work as possible. The saving might seem relatively small at the moment but 'every little helps'. Data conversions between P5 and P6 are bond to get faster over time in which case the relative cost of the overheads goes up. |
|
We nowadays have: I think it doesn't get any sweeter than that :) Though if there are suggestions, I'd certainly be interested. |
|
As a uni professor of mine used to say: silence is acceptance. With use :from and EVAL :lang I think we have all the sugar we can get. |
Making
Inline::Perl5into aCallablebacked by a multi-method yields some nice sugar:The code implementing this:
Note that instead of
invoke,sendneeds to be used for method calls as the former is used by Rakudo internally.There are a few things you'd have to keep in mind:
The text was updated successfully, but these errors were encountered: