[Seed7-users] Dynamic dispatch strange behaviour
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
From: Leonardo C. <leo...@gm...> - 2008-02-11 08:41:27
|
Hi. I was reading the new manual chapter (it's the chapter I was looking for) I discovered a strange issue. I don't know if it's a bug but I can't explain to myself the behaviour of the following program: $ include "seed7_05.s7i"; const type: strangeInterface is new interface; const func string: getNome(in strangeInterface param) is DYNAMIC; const type: astronave is new struct var string: nome is ""; end struct; type_implements_interface(astronave, strangeInterface); const func astronave: astronave(in string: nome) is func result var astronave: result is astronave.value; begin result.nome := nome; end func; const func string: getNome(in astronave: a1) is func result var string: result is ""; begin result:=a1.nome; end func; const proc: main is func local var strangeInterface: enterprise is astronave("Enterprise galactica"); begin writeln("one"); writeln("the name:" & getNome(enterprise)); writeln("two"); end func; The result is: C:\msys\1.0\home\lcecchi\seed7\src>hi provadue.sd7 HI INTERPRETER Version 4.5.3082 Copyright (c) 1990-2008 Thomas Mertes 259 C:/msys/1.0/home/lcecchi/seed7/lib/syntax.s7i 3395 C:/msys/1.0/home/lcecchi/seed7/lib/seed7_05.s7i 31 provadue.sd7 3685 lines total 118870 lines per second 1628430 bytes one So the execution is blocked at the line with "the name" and the line who writes "two" it's never executed. Where I'm wrong? Thanks, Leonardo |