Debugging? Seriously? More like hair-pulling. After that, do u have any left, Doug? Lol! Guess u won't be needing a barber for awhile--o, well--saving money on such things never hurts. & one wonders why some languages require semicolons? It certainly would've prevented that! But then again, it's an extra 23,000 keystrokes. So what do ya do? Thanks for sharing & givin us all somethin to think about--& maybe chuckle a little bit about--if only because it wasn't us, at least not this time. Our day will come, as the song posits. All the very best, as always. On 11/21/13, Doug Lee <doug.lee@xxxxxxxxxxxxxxxx> wrote: > This just seems worth writing down for its oddity... > > I was debugging a 23,000-line script this morning. Recently I started > getting really strange behavior when trying to assign collections to > variables in part of the code: I started getting the integer 1 in > place of a collection, with no obvious reason. I tried myriad > solutions and debugging tricks, sayString/sayInteger lines, etc. > > Then I added a sayInteger at a particular point in the code, and presto, > the thing started working! "How strange," I thought, "that shouldn't > affect anything, it's not making an assignment..." > > So I took the new line out, and the odd wrong behavior resumed. > > On reading more carefully, I found that the next line after the > sayInteger I had put in began with a spurious less-than sign (<). > Apparently I had mistakenly copied that line out of a diff output > file, in which less-than signs indicate removed lines and greater-than > signs indicate added ones. > > I should mention here two things: I read with punctuation off, and in > my actual code files, which are sometimes something like templates, I > use a double less-than to indicate a translatable symbol; so I am > accustomed to ignoreing less-than signs as I read anyway. > > The previous line in the file was an assignment like > > cLocation = locations[index] > > in other words, an assignment from an array to a collection variable. The > line after that was a plain old function call, we'll say MyFunc(). So > the code before my sayInteger was added looked like > > cLocation = locations[index] > < myFunc() > > The JAWS script compiler treats end-of-line no different than a space > most of the time, so it read the above two lines like > > cLocation = locations[index] < myFunc() > > which actually means, assign to cLocations the integer (boolean) value > of the question, is locations[index] less than the return value of > myFunc()? > > It so happens that myFunc() returns True, which as an integer is > 1. I guess the integer value of the collection at locations[index] > was 0, so the above question's result was True, which is also a 1 > when taken as an integer. This is how cLocation was getting set > to 1 instead of a collection. > > Now, when I put the sayInteger call in, why did I get a different > result? The code would then look like > > cLocation = locations[index] > sayInteger(...) > < myFunc() > > Now the spurious less-than sign doesn't affect the assignment. JAWS > will actually make the comparison > > sayInteger(...) < myFunc() > > but then discard it because it's not being assigned to anything. > This had the net effect of making my cLocation assignment work > again. > > And they wonder why it is said we'll spend 90% of our time debugging. :-) > > > > -- > Doug Lee, Senior Accessibility Programmer > SSB BART Group - Accessibility-on-Demand > mailto:doug.lee@xxxxxxxxxxxxxxxx http://www.ssbbartgroup.com > "While they were saying among themselves it cannot be done, > it was done." --Helen Keller > __________� > > View the list's information and change your settings at > http://www.freelists.org/list/jawsscripts > > -- Jackie McBride Author of the Upcoming Book “Beyond Baffled: the Technophobe’s Guide to Creating a Website” Web Hosting & development: www.brighter-vision.com Jaws Scripting training www.screenreaderscripting.com __________� View the list's information and change your settings at http://www.freelists.org/list/jawsscripts