BASIC routine identity
Steve Drain (222) 1620 posts |
Here’s an interesting bug that I have not seen mentioned in 30 and more years of using BASIC. The rules for routine (PROC/FN) identities differ from variables. Among these is that ‘@’ can be used as well as alphanumeric characters. Using ‘@’ has its own peculiarities, which I had to deal with when writing that BASIC parser a while back. This is different, though, and I came across it when stretching what I might do with BASIC. I had two routine definitons with names that only differ with an ‘@’ at the end of one, like this: DEFPROCtest:PRINT 1:ENDPROC DEFPROCtest@:PRINT 2:ENDPROC All was fine. Then I reversed the position of the definitions in the program: DEFPROCtest@:PRINT 1:ENDPROC DEFPROCtest:PRINT 2:ENDPROC Now, when calling I think I can see what is happening, but I have not checked the source. I think the lesson is to avoid ‘@’ in routine names. ;-) |
Clive Semmens (2335) 3276 posts |
The kind of peculiarity that normal people (if that’s a description that’s even remotely appropriate for any of us here) never discover because they never think of using @ in routine names, never realize it’s allowed… |
David J. Ruck (33) 1635 posts |
I could see that affecting BASIC compressors which reduce PROC/FN names to as few characters as possible, including non-alphanumerics. I suspect it hasn’t been seen as PROCa would be used before PROCa@. |