[Seed7-users] interfaces and integers
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Leonardo C. <leo...@gm...> - 2011-12-09 08:03:54
|
Hi. Can an interface be implemented by integers? The following code works great in the intepreter but fails to compile using the translator to C: [code] $ include "seed7_05.s7i" ; const type: printable is new interface; const proc: print_this (in printable param) is DYNAMIC; const proc: print_this (in integer: p) is func begin noop; end func; type_implements_interface (integer, printable); const proc: main is func begin noop; end func; [/code] This is the output: [code] C>hi test_translator.sd7 ..\bin\hi test_translator.sd7 HI INTERPRETER Version 4.5.8882 Copyright (c) 1990-2011 Thomas Mertes C>hi comp.sd7 test_translator.sd7 ..\bin\hi ..\prg\comp.sd7 test_translator.sd7 HI INTERPRETER Version 4.5.8882 Copyright (c) 1990-2011 Thomas Mertes Compiling the compiler ... SEED7 COMPILER Version 2.0 Copyright (c) 1990-2011 Thomas Mertes Source: test_translator.sd7 Compiling the program ... Generating code ... after walk_const_list 622 13484928 94 optimizations done 57 evaluations done Calling the C compiler ... gcc -w -c tmp_test_translator.c 2>tmp_test_translator.cerrs *** Errors in "tmp_test_translator.c" - see "tmp_test_translator.cerrs" C>type tmp_test_translator.cerrs type tmp_test_translator.cerrs test_translator.sd7: In function 'o_1026_print_this': test_translator.sd7:4:1: error: incompatible type for argument 1 of 'o_1028_print_this' test_translator.sd7:6:25: note: expected 'inttype' but argument is of type 'struct rtlStructstruct' [/code] Thanks to keep up this project! |