Warnings in Euphoria 2.5
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jan 30, 2005
- 448 views
Hi all, Euphoria 2.5 has the new feature, that the interpreter parses the whole program before it starts executing it. This brings the big advantage, that syntax errors will be found more reliably than in Eu 2.4 and earlier. What about the warnings? The following program indicates, that they are still issued at run-time and not at parse-time:
------------------------[ show.exw ]------------------------ -- run with Eu 2.5 beta include misc.e procedure help() puts(1, "Usage: exw show.exw <command-line arguments>" & "\n\nPress Enter ...\n") if getc(0) then end if abort(2) end procedure constant CMD = command_line() integer x if length(CMD) < 3 then help() end if puts(1, "Command-line arguments are:\n") pretty_print(1, CMD[3..$], {3}) puts(1, "\n\nPress Enter ...\n") if getc(0) then end if ------------------------------------------------------------
When I call 'exw show.exw foo bar', then the command-line arguments are displayed, and after pressing [Enter], the program says Warning: local variable x in show.exw is not used as expected. But when I just call 'exw show.exw', then the message in procedure help() is displayed, and the program does not show any warning. So it can depend on the program flow and the input data, whether or not a warning is shown. Is it possible/desirable to change the behaviour of the interpreter, so that causes of warnings are detected at parse-time? Regards, Juergen -- Have you read a good program lately?