Page 1 of 1

un-declared symbol name would set to nil

Posted: Mon Jan 05, 2015 7:52 am
by ssqq
As write newLISP code, if write a spell error symbol name, newLISP would make it as nil, and continue run. How to check these error? If have any tools could help me?

Re: un-declared symbol name would set to nil

Posted: Wed Jan 07, 2015 3:58 am
by rickyboy
Yeah, that behavior is baked into newLISP. I have also experienced this problem before also -- where I've misspelled a symbol name and newLISP happily evaluates it to nil. However, I've always been able to detect this error in unit testing; so it hasn't been a problem for me.

How to help check for this case? The only idea I can think of right now is to write a "linter" to statically check the lambdas in your code for free variables. (Free variables would be any "variable" (symbol) that is not a lambda parameter or part of a local binding (in a let, letn, etc.), excluding also the primitive symbols.) Not all the free variables detected by the linter would be misspellings of course -- some of them would simply be references to global "variables."

Perhaps someone else has a better idea.

Re: un-declared symbol name would set to nil

Posted: Wed Jan 07, 2015 2:15 pm
by ssqq
Thanks, most of bug that difficulty to find is these type error. I am writing a strict code tools to check un-declared symbol beside it is a global symbol by explicit defined (like: $symbol-name).