un-declared symbol name would set to nil

Started by ssqq, January 04, 2015, 11:52:39 PM

Previous topic - Next topic

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?

rickyboy

#1
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.
(λx. x x) (λx. x x)

ssqq

#2
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).