-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
"Simplify" overloading functions #488
Comments
Need to be explored: |
"first we need to have #491" |
a poc was released and working. Need to be industrialized (in progress) |
In progress, on private branch |
A reminder about in progress
|
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
allows to overload all types including basic types (as double :p)
this feature took some time but it's just a first step. |
Currently, overloading is powerfull but not easy to manage.
To overload an operator, we need to manage many combination of types
example:
1 + 'c' requires to create double_plus_char function
A better (?) more compatible way could be to manage ONLY one type.
double_plus_char.m --> @double/plus.m
in plus.m we force types
example: To allow to overload double can be "dangerous". It can break all existing code insidiously.
It can also to be "slow" check each basic type will have a cost.
Currently in Nelson, overload can "very" slow if overload is overloadbasictype(true)
overload with basic types could also have interesting use for code generation.
But we can also create special types to manage it.
example: 'Double'
how to manage overloading with builtin (mex will be as functions)
We can mangling function name for builtin: internal name could be
@double/plus
or@double:plus
function will be never callable directly
default behavior: What do we do if methods are not defined? Do we call default method ?
reworks all existing overloaded functions to manage new overload algo
Test case: myComplex object with overload
@myComplex.zip
Why not directly move to classdef object in nelson ?
with this basic overload we can manage many cases.
classdef have advantage to have all overload method in same file but initial algo are same.
classdef will be considered later (certainly after v1.0)
The text was updated successfully, but these errors were encountered: