[Seed7-users] Templates issue
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Simon D. <sim...@ao...> - 2024-08-04 12:52:34
|
In trying to compile the code that is at Manual->2.12 Templateshttps://thomasmertes.github.io/Seed7Home/manual/tutorial.htm#Templates I am encountering a compile error. (It appeared that the functions had to be renamed to not conflict with what is in integer.s7i) :----------------------------------------------------------------------------------------------------const proc: DECLARE_MY_MIN_MAX (in type: aType) is func begin const func aType: my_min (in aType: value1, in aType: value2) is return value1 < value2 ? value1 : value2; const func aType: my_max (in aType: value1, in aType: value2) is return value1 > value2 ? value1 : value2; end func; DECLARE_MY_MIN_MAX(integer);DECLARE_MY_MIN_MAX(bigInteger);DECLARE_MY_MIN_MAX(float);---------------------------------------------------------------------------------------Of the DECLARE_... statements, the only one that the interpreter is accepting is the one for integer. The other two get these errors SEED7 INTERPRETER Version 5.2.60 Copyright (c) 1990-2024 Thomas Mertes*** /c/Users/sdash/OneDrive/code/Seed7/Examples/templates.sd7(19):52: Match for {bigInteger DECLARE_MY_MIN_MAX } failedDECLARE_MY_MIN_MAX(bigInteger); *** /c/Users/sdash/OneDrive/code/Seed7/Examples/templates.sd7(19):33: Exception "ILLEGAL_ACTION" raisedDECLARE_MY_MIN_MAX(bigInteger);-------------------------------^*** /c/Users/sdash/OneDrive/code/Seed7/Examples/templates.sd7(20):52: Match for {float DECLARE_MY_MIN_MAX } failedDECLARE_MY_MIN_MAX(float); *** /c/Users/sdash/OneDrive/code/Seed7/Examples/templates.sd7(20):33: Exception "ILLEGAL_ACTION" raisedDECLARE_MY_MIN_MAX(float); Simon |