As an alternative to automatic persistence (since RTTI is not working in the latest hotfix and you have opted not to use RTTI for object mapping), it should be mentioned that Smart Pascal supports JavaScript structures. This will greatly simplify object storage. If you have ever used a Microsoft property-bag (com class) then this is more or less the same thing.
In JavaScript you would write:
var mbag = {};
mbag["test"] = {};
mbag["test"]["somevalue"] = 12;
mBag["text"] = "this is a string value";
Resulting in a memory structure like this:
Type
TMyBagContent = Record
bcTest = Record
bcSomeValue:Integer;
end;
bcText:String;
End;
In Delphi these kind of structures are implemented in SuperObject (I believe). RemObjects also have some support classes that mimic this. But thankfully Smart Pascal achieves this automatically by grace of targeting JavaScript directly.
So in Smart Pascal you would do the following to achieve the same results:
var mBag:Variant;
mBag:=TVariant.CreateObject;
mBag['test'] := TVariant.CreateObject;
mBag['test']['somevalue']:=12;
mBag['text']:='this is a string';
You can also save some time and use an assembly section:
var mBag:variant;
asm
@mbag = {};
@mbag["test"] = {};
@mbag["test"]["somevalue"] = 12;
@mbag["text"] = "this is a string value";
end;
Once you have populated your object's data, you then use JSON to serialize and make it portable:
var mObj: String;
asm
@mObj = JSON.stringify(@mbag);
end;
Creating reader/writer class for storage is very easy. Naturally automatic RTTI property mapping is better (and that should be fixed shortly), but for frameworks that does it manually - which does have some advantages over full automation - there are plenty of options for creative programmers such as yourself.
There is also speed to consider, and using a JavaScript object as a lookup table is very, very fast compared to a for/next recursive algorithm. Especially for large and complex data structures.
Looking forward to testing your creation :)