While no one likes to admit it, we all write software that has bugs. Recently, I was analyzing some code that seemed to be slower than desired in the Xojo IDE and I literally stumbled on a bug that has very likely been causing issues in VCP projects for a while.
The code seems innocent enough.
While I can’t give you the exact lines without a lot of other supporting code, the basics looked like this:
if left( text, 1 ) = """" then
rval = Mid( text, 2, len( text ) - 2 )
The problem here is that while the code seems innocent enough (it is supposed to pluck out a quoted string from the end of a line), the assumption is bad. Just because LEFT( text, 1) is a quote there’s no assurance that RIGHT(1) is also a quote.
So this very subtle assumption has now been documented, corrected and the issues we’ve been seeing where some values in text project files flip-flop (sometimes written as quoted strings and sometimes not) should also be corrected.
At the same time we did find some noticeable speed ups thanks to Xojo’s improved profiler.
Have you ever been stumped by a bug that was the result of a bad assumption? Make a comment and let us know.