Menu

#3 Making ad-hoc variables explicit

open
nobody
None
5
2008-10-17
2008-10-17
Rich K
No

(copied from bug list, original dtd 2007-03-31 22:31)
When new this-scoped variables are assigned-to within Sections using eval'd
expressions (the misc row in Tables, <%...%> blocks within HTML sections,
and anywhere within Scratch sections), there's a problem when saving files
if you later erased the assignment. Currently, Table sections only
serialize for storage only variables that are explicitly set within misc
row or other cells. HTML and Scratch sections iterate through all this.xxx
variables and save them to the file. This behavior needs to be made
consistent.

The problem is that both ways have problems.

1) When saving variables only declared in the source (and not removed), it
is possible to declare a variable, then erase it, but still depend on it
(since erasing it from the source doesn't delete it within the JS engine).
Later, re-loading the source could cause the model to not work.

2) When saving all this.xxx variables, you end up having a situation where
the variable is not visible in the source, which could also be confusing.

Scenario 1) is still possible with globally defined variables, which, if
erased, are never saved.

The proper solution is to reset each Javascript Section object and rebuild
it each time the Objectsheet is calculated. But this would slow down the
application considerably.

Actually, in my own experience, I haven't run into either problem. So
maybe it'd be OK for normal use. In that case, version #1 above should be
the preferred mechanism for all Section types, as #2 is potentially more
confusing.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.