XojoScript warning messages

I wrote a little app to play with XojoScript. If I run this script:

foo() sub foo() dim n as integer print "hi" end sub
I get a CompilerWarning message #9 (“IncompatibleParameterList”) at line 3 (the dim statement).

If I add an assignment line after that dim statement like this:

n = 42
Then the CompilerWarning goes away.

My question is this: how can an unused variable generate a “IncompatibleParameterList” warning? I’m ok with it generating something like an “Unused variable” message, but the way it works now seems wrong. Am I missing something?

When I run your little sample using the XojoScript example project (Examples/Advanced/XojoScript/XojoScript) I get this warning:

“n is an unused local variable.”

@Paul Lefebvre : so it does. Thank you, I totally forgot about that sample project. Apparently it’s time for me to retire.

@Paul Lefebvre : as long as we’re on the subject, could you tell me why, when I use a try/catch like this in XojoScript:

try ... catch e as RunTimeException print e.Message end try
I get this:

[5:20-5:27] Type “RuntimeException” has no member named “Message”.

Is there a way within a script to capture the message associated with an Exception?

RuntimeException (like all framework classes) is not available in XojoScript.

To handle exceptions, use the XojoScript.RuntimeError event handler.

OK, thanks.

This seems to work in a script:

try ... catch print "foo" end try
but if I use that in a script then RunTimeError event never fires.

Is there any way within a try/catch in XojoScript to determine anything about the error?

I’m afraid not.

Bummer. Guess I’ll go back to FORTRAN.