Mold

Started by Totardo on 26-Sep-2013/9:37:57-7:00
What is mold? Can you give me an example?
Mold encloses text in quotes. write %mold.txt mold "some text" print read %mold.txt The write line above is the same as: write %mold.txt {"some text"}
The IMHO more important MOLD/ALL (/ALL being a refinement to MOLD) serializes REBOL code and data, so you can save it to disk and load it again: >> a: make object! [b: make hash! [] c: 67 d: none] >> mold/all a == {#[object! [ b: #[hash![]] c: 67 d: #[none] ]]} >> probe load mold/all a make object! [ b: make hash! [] c: 67 d: none ]
Totardo, To add a little to Henrik's example above, you can save and load to a file, for example, like this: a: make object! [b: make block! [] c: 67 d: none] write %somedata compress mold/all a probe load decompress read %somedata
The example above works in R3. Compressed data is binary, so for R2, you'd need /binary refinements: write/binary %somedata compress mold/all a probe load decompress read/binary %somedata More likely, you'd just do: write %somedata mold/all a probe load %somedata
(That works in both R2 and R3)

Reply