SourceForge logo
SourceForge logo
Menu

wxlua-users

From: <hel...@gm...> - 2006年08月28日 14:05:34
Hello,
is it by design, that during pre-compilation the existence of funtions (or the correctness of function names) is not checked?
Any mistyped function name is just discovered at runtime and leads to a "error running chunk" message.
I would rather expect that the function names are checked sooner, so that any mistyped function (not declared or defined with RegisterFunction) is reported during pre-compilation.
Yours,
Helmut
From: John L. <jla...@gm...> - 2006年08月28日 15:29:25
On 8/28/06, hel...@gm... <hel...@gm...> wrote:
> is it by design, that during pre-compilation the existence of funtions (or the correctness of function names) is not checked?
>
> Any mistyped function name is just discovered at runtime and leads to a "error running chunk" message.
>
> I would rather expect that the function names are checked sooner, so that any mistyped function (not declared or defined with RegisterFunction) is reported during pre-compilation.
I do not think that this is possible or would be overly complicated.
In fact lua itself doesn't do this itself. However if you know how
please suggest a way to do this. There was a lua lint program
somewhere that may be useful.
Try this simple program:
a = math.sin(1)
b = math.si(2)
$ ./lua5.1.exe precomp_test.lua
d:\wxCVS\wxLua\wxLua\bin\lua5.1.exe: precomp_test.lua:2: attempt to
call field 'si' (a nil value)
stack traceback:
 precomp_test.lua:2: in main chunk
 [C]: ?
It doesn't check that I've mistyped "math.sin" for line 2 until it's run.
However try this:
a = math.sin(1)
b = 1math.si(2)
$ ./lua5.1.exe precomp_test.lua
d:\wxCVS\wxLua\wxLua\bin\lua5.1.exe: precomp_test.lua:2: malformed
number near '1math'
It does check for gross syntax errors.
Regards,
 John Labenski
From: Richard S. <ric...@gm...> - 2006年09月03日 07:25:54
The lua compiler has no way of knowing if math.si is a function at
pre-compilation stage, as you could define a variable:
math.si = math.sin
that would make the call valid...
because variables have no type, only values, this type of check can
not be done un til runtime.
On 8/29/06, John Labenski <jla...@gm...> wrote:
> On 8/28/06, hel...@gm... <hel...@gm...> wrote:
> > is it by design, that during pre-compilation the existence of funtions (or the correctness of function names) is not checked?
> >
> > Any mistyped function name is just discovered at runtime and leads to a "error running chunk" message.
> >
> > I would rather expect that the function names are checked sooner, so that any mistyped function (not declared or defined with RegisterFunction) is reported during pre-compilation.
>
> I do not think that this is possible or would be overly complicated.
> In fact lua itself doesn't do this itself. However if you know how
> please suggest a way to do this. There was a lua lint program
> somewhere that may be useful.
>
> Try this simple program:
>
> a = math.sin(1)
> b = math.si(2)
>
> $ ./lua5.1.exe precomp_test.lua
> d:\wxCVS\wxLua\wxLua\bin\lua5.1.exe: precomp_test.lua:2: attempt to
> call field 'si' (a nil value)
> stack traceback:
> precomp_test.lua:2: in main chunk
> [C]: ?
>
> It doesn't check that I've mistyped "math.sin" for line 2 until it's run.
> However try this:
>
> a = math.sin(1)
> b = 1math.si(2)
>
> $ ./lua5.1.exe precomp_test.lua
> d:\wxCVS\wxLua\wxLua\bin\lua5.1.exe: precomp_test.lua:2: malformed
> number near '1math'
>
> It does check for gross syntax errors.
>
> Regards,
> John Labenski
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wxlua-users mailing list
> Wxl...@li...
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /