I know the community is not big a sharing, but I posted something to github in
case anyone would be interested.
Hash is a library I wrote (beta) to speed up serializing and unserializing
nested Active4D collections. I had used ObjectTools, but though I'd try another
approach using a YAML like format. I got almost a four fold speed improvement.
(probably the ObjectTools parser used - but used almost identical drivers?)
Why I needed this capability is not important - lets just say I am no longer in
control of fixing past mistakes.
Anyhow while I made something bad - better, I found a few other uses:
A neat way of formatting configuration files
A different way to build collections
For example, using herdoc strings, you can define a new nested collection with
this call:
$collection := hash.toCollection("""
foo
-:when := date("11/11/11")
-:active := true
-why
--:because := t[I want to; I can; I am bored]
--:note := "can also use word version of text array t[one two three], i.e.
no semicolon delimiters"
bar
-:when := !12/12/12!
- :active := false
-:cost := 3745.23
-:records := i[787 5556 6657 1 33]
""")
The t[...] and i[...] syntax create arrays in case you have not guessed. The
rest is pretty much 4D code, is just uses an assignment operator and avoids
quotes and delimiter where not needed. The dashes define the nesting level.
If anyone is interested, there is a little more details and the library at:
https://github.com/salex/Active4D-Libraries/tree/master/hash
Steve Alex
P.S. Improvements or suggestions welcome.
_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/