Re: [Seed7-users] Template issue with integer index arrays
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
|
From: Thomas M. <tho...@gm...> - 2024-08-27 10:33:38
|
Hi Simon,
Thank you for your error report. This helps me to improve Seed7.
The types 'array baseType' (defined in array.s7i) and
'array [indexType] baseType' (defined in idxarray.s7i) are not related to each other.
Some functions are declared for both types. The statements
DECLARE_MY_PRINT_ARRAY(integer, integer);
redeclares functions which 'array integer' already had declared.
This triggers the error messages.
I found a simple solution. At the end of idxarray.s7i I added:
const func type: array [ (attr integer) ] (in type: baseType) is
return array baseType;
This maps 'array [integer] baseType' to 'array baseType'.
I checked this change into GitHub as "Map 'array [integer] baseType' to 'array baseType'".
You can either use the GitHub version or just add
const func type: array [ (attr integer) ] (in type: baseType) is
return array baseType;
to the end of idxarray.s7i.
With this fix my test program writes:
SEED7 INTERPRETER Version 5.2.72 Copyright (c) 1990-2024 Thomas Mertes
-----------------------------------------
the type of the array index is integer
the type of the array elements is integer
size of the array is 5
minimum index is 1
maximum index is 5
1: 10
2: 20
3: 30
4: 40
5: 50
Best regards
Thomas
|