un-declared symbol name would set to nil

For the Compleat Fan
Locked
ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

un-declared symbol name would set to nil

Post 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?

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: un-declared symbol name would set to nil

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

ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

Re: un-declared symbol name would set to nil

Post 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).

Locked