I can add my support to your report as it is substantially the same
results I discovered when I tested the difference between implicit and
explicit management. But I can't provide too many specifics as it has
been many a moon since I played with it, so I'll likely fail the "just
the facts" requirement by Mr. Vargo. <g>
When I started programming in VB* I ran into the same sort of
scoffing, but in my shop just the opposite. I came from C so I was
down-right anal about 'clean-up'. I was ridiculed for wasting space on
useless Nothings. Their view made sense, but I tested anyway. Actually
was interested in another aspect of VB's internals* at the time.
Object management was sort of secondary, but the results were
identical to GS's and rather surprising. (I'm always surprised when
I'm close to correct on anything. <g>)
Part of Eric's and other's problem when analyzing this subject is they
forget that while the front-end 'script' we call VB* is very much
"ALGOrithmic", a la C, the internal engine (parser, compiler,
interpreter, whatever) is actually stack-based, and not
function-based. So there is a tendency to think of VB* as behaving
exactly like C because of its syntax.
In a C function a locally declared object (or automatic variable) is
placed on 'The' stack and managed at the function level. That stack is
"setup an cleared" as defined by that function. In a sense the
compiler takes care of it whether you wanted it to or not.
In VB* something rather different is going on. VB* is made up of
several 'stacks' (dictionaries, caches, lists, ...) that handle
temporary variables, global names, objects, ..., procedures themselves
are just data chunks in a dictionary. The rest is essentially just a
lot of bookkeeping.
VB* does have one major advantage it is about as linear and
straight-line as you can get. When it gets the 'next' instruction, it
does it. (Well the 'next' might be fetch 'n hold, or ... but let's
keep it simple for now. <g>). That is why I came to the same
conclusion as GS - Explicit instructions (eg, destruction) are simply
did 'n done. Period. Implicit requires extra bookkeeping.
Now the disclaimers... <g>
VB* - by this I meant all the visual basic dialects running as
intermediates for a VM, etc. ie, the pcode (opcode/excode).
Confusion often comes about when working with 'VB internals' because
the big brother VB is often compiled to native code. In this case you
are not looking at translated or transcribed pcode, what you are
seeing is pcode compiled into pre-processed C code. This can be
misleading, eg, Procedure Data Objects get turned into 'Functions'.
And you will find a great deal of information on VB's "internals"
based on what someone found in the native compiled code, but that
isn't quite true of pcode.
VBScript has far less in common with others, but the internal workings
at the intermediate level is the same. (Well, make that very similar.
VBScript takes some short-cuts.)
*The other internals aspect I was researching was the bloating problem
when VB* was made executable or during runtime. These changes in size
occurred even if no obvious changes had been made to the code itself.
Even more baffling was that it would just as often seemingly 'correct'
itself and shrink back to some original size. This is exactly the same
phenomena that GS reported, I too felt it was due to bookkeeping
overhead.
However, I should mention that I'm well aware that all this testing
and playing went on some 10-15 years ago; back when CPU's were far far
slower, and 4 gig of ram and a 250 meg HD was a super computer <g>. I
wonder if one can still measure the differences today? And VB* itself
is far more optimized than the VB/VBA's (3, 4, and 5) I played with.
If anyone wants to argue that typing all those extra "Nothings" isn't
worth the few extra clicks of VB bookkeeping - they'll get no argument
from me.
As for the rest. I too have been burned on occasional with implicitly
declared objects in external libraries and when using Automation. (And
with compiled VB as well.) Not often and I'd be hard pressed to come
up with a specific example. But it happened and I just prefer to not
go there again - whether by superstition or fact.
-ralph