#219 closed defect (fixed)
Creating more than one function with the same Name but with different Type
Reported by: | danirus | Owned by: | danirus |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Kernel | Version: | head |
Severity: | normal | Keywords: | |
Cc: |
Description
Tol lets us create more than one function with the same name but with different
Type.
You can try this bug with this code:
Real func1 (Real p) { p };
Text func1 (Text p) { p };
Matrix func1 (Matrix p) { p };
But you can only use the first defined.
Change History (3)
comment:1 Changed 20 years ago by
Status: | new → assigned |
---|
comment:2 Changed 20 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Finally, this must be a new feature.
After getting a closer look in the code, Tol never let us create more than one
user function with the same name. Symbols Table hasn't that facility. Although
we could have ever thought that, because of the behavior of Tolbase. Then I've
assumed this bug as new feature to implement.
Now Tol give us "User Functions Overloading". What does it mean?
We can do:
Real func (Real param) { param };
Text func (Text param) { param };
Real a = func(12);
Text b = func("It Works!");
Both variables, "Real a" and "Text b", has their own respective values.
Some risky changes have been made in the very Tol core components, so we must
keep an eye on secondary effects. If you are using CVS Tol version, please keep
in contact for that.
Thanks, Daniel Rus
comment:3 Changed 18 years ago by
bug_file_loc: | → http://www.tol-project.org |
---|
More example code.
One way trying to access those funcionts is:
The last sentence doesn't work.
We can consider the bug in two ways: