Question regarding scripting support in OO3
Timothy J. Wood
tjw at omnigroup.com
Tue May 11 07:58:04 PDT 2004
On Thursday, May 6, 2004, at 03:31 PM, Daniel Flatin wrote:
> This identifying property for rows should:
>
> 1) not be editable by the user, even in a script
Correct; this is a read-only property.
> 2) be unique within a document
Correct.
> 3) be assigned whenever a new row is created
Correct.
> 4) not have any ordered relationship to the structure of the
> document
Correct. They are essentially random (and then uniqued if there
happens be a rare collision).
> Additionally, each document should not reuse deleted ids until all
> available representations have been used. If a 32 bit unsigned
> integer is used as the id, there are 4 billion opportunities before an
> id would have to be reused.
We considered using incrementing integers but this has bad side
effects with source control systems (we, at least, store many OO
documents in CVS). If two different users add two different rows to
the document, they'd both end up using id N+1 and would produce an XML
document with duplicate identifiers. We handle reading this just fine,
but one of the rows will then lose its identifier and get reassigned a
new id. We also want to preserve identifiers across loads of the
document so that you could, say, store the id of a row externally
(possibly as a property in a script).
So, we ended up using a string encoded random number approach.
> Transferring outline content between documents should cause the unique
> identifiers to be reassigned in the new location. This way each
> document could be considered a separate database.
What happens now is that the identifier is preserved if possible
(i.e., it isn't used in the destination document already). This makes
it extremely likely that you can move a row from document A to document
B and then back again.
> Given
>
> set MyRow to first child of MyParent
> set MyID to id of first child of MyParent
>
> these two should be equivalent:
>
> MyRow
> row id MyID
What we actually ended up with is that to get an identifier based
reference you end up doing "reference to row id MyID".
Due to the issues noted previously, defaulting to id based references
makes common operations fail. This is really a trade off between
having the ability to do what you need when you need it and making the
common case (simple hierarchy modifications) easy. Certainly not a
perfect solution, but it seems that there isn't a perfect solution.
-tim
More information about the OmniOutliner-Users
mailing list