I’ve been doing a huge amount of work recently porting the C++ OOFILE report writer to REALbasic as a complete transliteration, having given up on the earlier report-writer I was writing from scratch.
I’m using REALbasic 2008r4.1 and finding it extremely flaky when debugging. I finally worked out the cause and it’s an interesting trap.
OOFILE was written about 15 – 10 years ago and makes use of lots of inline and non-virtual functions for high-performance in C++. Methods in REALbasic are, of course, all virtual but it also has Computed Properties which allow you to write code as getter and setter functions. These are non-virtual and therefore (presumably) much faster – an ideal and idiomatic match for the inline getters and setters used heavily in OOFILE.
However, there’s one very big gotcha – if you look at an object in the REALbasic debugger, all its getters on computed properties are executed.
Apart from the performance overhead of this, I had a number of state-dependent checks in my getter code which caused (homegrown) assertions to fire, whilst the poor debugger was trying to display values. In the original context, these were perfectly safe, in fact added safety by ensuring that complex object initialisation was completed before the object query methods were called.
// user enquiry ONLY expected to be called
// after finishConstruction
assert mKeepTogether <> keepTogetherT.eDefaultTogether
return (mKeepTogether = keepTogetherT.eKeepTogether)
Even worse was properties that do lazy initialisation so they only allocated the members they get when they are first called, which means they are trying to change other properties in the object at the time it is being shown in the debugger, eg:
if mPageFooters is nil then mPageFooters = new rbrwBandList
These obviously need rewriting and hopefully Real Software can be convinced to add a Don’t Compute Properties in Debugger option soon!