-
Notifications
You must be signed in to change notification settings - Fork 12
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
Multiple Dispatch #258
Multiple Dispatch #258
Conversation
Visitor pattern for Graphics simplified with Multiple Dispatch
More tests for multiple dispatch
This looks great! This would both simplify and improve so many core things! I love the improvement on the List_sort API. And we got the visitor pattern in graphics already working with multiple dispatch. Great step for both users and developers! I have added some comments with small suggested changes / additions. One thing I would recommend is adding something like a Really excited for this! |
Added duplicate_no_arg test
This PR adds initial support for typing and multiple dispatch to Morpho. You can define multiple implementations of the same function:
and morpho will dispatch to the correct implementation based on the type at runtime. Multiple dispatch resolutions are compiled to a special implementation (a directed acyclic graph) for efficient execution, imposing typically only a 20% overhead on a regular function call per argument. Future compiler optimizations will reduce the need for this.
Multiple dispatch can similarly be used for method definitions, and are resolved at runtime. PR includes extensive tests and online help.
Typed variables and support for type tracking in the compiler are implemented, but type checking is not fully implemented yet. (This PR is a necessary step towards full type checking).