Opened 10 years ago
Last modified 10 years ago
#3419 new defect
Function signatures for type safe function partial application — at Initial Version
| Reported by: | Rüdiger Franke | Owned by: | Lennart Ochel |
|---|---|---|---|
| Priority: | high | Milestone: | Future |
| Component: | Code Generation | Version: | trunk |
| Keywords: | Cc: |
Description
OpenModelica boxes arguments of functions that are passed as input to other functions. The actual types of the arguments appear to be only known during the boxing/unboxing operations. This hinders the generation of type safe code. The actual function signatures should be accessible from PARTEVALFUNCTION and FUNCTION_PTR (see SimCodeTV.mo).
See the following example:
partial function part input Real u; output Real y; end part; function func extends part; input Real v; algorithm y := u + v; end func; function feval input part f; output Real y; algorithm y := f(1); end feval; model m Real y = feval(function func(v = 2)); end m;
When generating code for function feval, the signature of the input part should be accessible from the FUNCTION_PTR argument.
When generating code for model m, the signatures of the used function func and of the expected part should be accessible from PARTEVALFUNC.
So far only the types of the additional arguments of func (v in the example) can be derived from the expList contained in PARTEVALFUNC.
