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 <[EMAIL PROTECTED]> wrote:
> On 8/28/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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
> Wxlua-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>

-------------------------------------------------------------------------
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
Wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to