You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Procedure overloading is being able to define multiple procedures with same name but different argument signatures. This feature would make many definitions quite simpler in Corth.
For example:
proc say ptr -> in
putcs
end
proc say int -> in
putu
end
These two procedures have the same name but different signatures. This allows the compiler to distinguish them from each other. If the stack has an integer in the local stack, it will understand that the call should be made to the second function.
This however has some limitations for procedures that have different argument signatures but which procedure is wanted to be called can not be decided. For example:
proc say int int -> in
putu " " putu
end
proc say int -> in
putu
end
If the stack contains two integers, then it is undecidable which one of these procedures should be called. This means that this should not be allowed by the compiler.
The text was updated successfully, but these errors were encountered:
If the stack contains two integers, then it is undecidable which one of these procedures should be called. This means that this should not be allowed by the compiler.
This sounds like a problem to be solved rather than an error state 🤔
Procedure overloading is being able to define multiple procedures with same name but different argument signatures. This feature would make many definitions quite simpler in Corth.
For example:
These two procedures have the same name but different signatures. This allows the compiler to distinguish them from each other. If the stack has an integer in the local stack, it will understand that the call should be made to the second function.
This however has some limitations for procedures that have different argument signatures but which procedure is wanted to be called can not be decided. For example:
If the stack contains two integers, then it is undecidable which one of these procedures should be called. This means that this should not be allowed by the compiler.
The text was updated successfully, but these errors were encountered: