Stack Size Bloat?
Richard Gaskin
ambassador at fourthworld.com
Mon Jun 23 00:43:00 EDT 2003
Sarah wrote:
>> Survey: How many of you use text styles in your code?
> Not me!
>>
>>> Yesterday my "potential corrupt stack paranoia" got the better of me
>>> and I
>>> spent a while doing a lot of "copy-paste" between the existing stack
>>> and a new
>>> one. I ended up with the same size, of course...the boogey man never
>>> easily
>>> shows his hand. :-)
>>
>> I cannot encourage HC users to take this to heart strongly enough:
>>
>> When you moved to Revolution, you said goodbye to 99.9999999% of stack
>> corruption.
> I am really hoping that this proves to be the case :-)
It requires much less than hope, just a little understanding of what
corruption is and how it occurs:
File corruption means something wasn't written to disk properly. With
HyperCard, SuperCard, FileMaker, and a good many other file types, complex
structures are written into specific locations within a larger file on the
fly, as the program works with only portions of the file at any given time.
In most cases write operations are handled outside of your control, and
often while your scripts are running. It's this constant writing of file
snippets into the file on the fly underunpredictable circumstances that is
at the root of corruption, and all complex file formats written in this
incremental manner are exposed to this risk (FileMaker even has a menu item
to repair corruption, it happens so frequently).
MetaCard and Revolution write the entire file in one clean pass from head to
tail, and only when you explicitely tell it to. Not only does this give you
more control (even allowing you to implement a Revert feature for your data
files), but writing all of the file at once makes the operation radically
simpler than writing snippets into specific slots within the file.
Additionally, Scott Raney wisely implemented an automatic backup: when you
issue a Save command, the engine first makes a copy of the file preceded
with "~" in the file name, then he does the write, and only when
everything's successfully completed it deletes that backup. If it's unable
to complete the write for any reason (system error, earthquake, etc.), the
newly saved file may be only partially written, but even in this worst-case
scenario you have your last successful save waiting for you -- just ditch
the bad copy, remove the preceding "~", and you're back in business.
I know first-hand how mentally scarring it can be to work for years in
systems prone to file corruption, and it took me months to get over the
fears instilled in me from previous experience after I started using
MetaCard. But with nearly daily use (and sometimes all day <g>) for more
than 5 years, my personal experience is on par with what Scott reports:
I've had one graphic object record get corrupt on me many years and several
versions ago, and even then I simply deleted the object and all was well;
I've experienced no corruption of any kind for more than for years since.
--
Richard Gaskin
Fourth World Media Corporation
Developer of WebMerge 2.2: Publish any database on any site
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the use-livecode
mailing list