[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How can we make lua better?
- From: crow <crow_64a@...>
- Date: Mon, 28 Feb 2005 21:08:13 -0000
Asko Kauppi <asko.kauppi@sci.fi> wrote:
(28/02/2005 19:57)
>hypothetically, in a language without 'local' declaration, any typo
>would automatically launch a new variable and that would be very hard
>to track. sorry, not for my taste. :)
A compiler might find it hard, but would you?
A typo would only result from a physical attempt to put a value somewhere, assuming that the first appearance must be an assignment. While David said that this wouldn't be caught by a compiler, you'd know where the problem was as soon as a bit of data failed to turn up. I guess a traceback might also help, and I think there'd be one if a tested variable failed to exist due to a typo putting its intended value elsewhere. You'd then know where to look for the error, because in an arrangement like this you'd need to put the first use on the same path the traceback showed.
I guess this might be tedious if a lot of code was involved, but I've found that even as good as it is, I can't always follow a Lua error report unless I test the code frequently as I write it (sometimes the line indicated is NOT where the problem is..). I'm not sure that a local-by-default would make it any more important to do this than it is anyway..
PS. Sorry if this appears twice, my mail client is throwing wobblers..