Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

serializing?

 [1/6] from: rishi::picostar::com at: 13-Sep-2000 23:19


I've created an object in my source file. I would like to save this object to a text file, and later, retrieve this object and use it. This is called serialization of an object. Is there an easy way to do this in rebol? Rishi O.

 [2/6] from: al:bri:xtra at: 14-Sep-2000 19:36


Rishi wrote:
> I've created an object in my source file. I would like to save this object
to a text file, and later, retrieve this object and use it.
> This is called serialization of an object. Is there an easy way to do this
in rebol? REBOL/View 0.10.33.3.1 10-Sep-2000 Copyright 2000 REBOL Technologies. All rights reserved.
>> o: make object! [
[ f: func [x][print x] [ m: 1234 [ ]
>> help save
USAGE: SAVE where value /header header-data /bmp /png DESCRIPTION: Saves a value or a block to a file or url. SAVE is a native value. ARGUMENTS: where -- Where to save it. (Type: file url) value -- Value to save. (Type: any) REFINEMENTS: /header -- Save it with a header header-data -- Header block or object (Type: block object) /bmp -- Save in .BMP format /png -- Save in .PNG format
>> save %test.dat o >> print read %test.dat
make object! [ f: func [x][print x] m: 1234 ]
>> z: do load %test.dat >> z/m
== 1234
>> z/f 456
456
>> z/f 456 + 3
459
>>
Andrew Martin ICQ: 26227169 http://members.ncbi.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/

 [3/6] from: fsievert:uos at: 14-Sep-2000 10:38


Hi! I wrote a script for serializing any rebol code. It also serializies values and bindings of words and can serialize recursions. It also serializes something like "^"{" correctly. If someone wants to try it out, send an email to [frank--sievertsen--de] Greetings, Frank On Wed, 13 Sep 2000 [rishi--picostar--com] wrote:

 [4/6] from: g:santilli:tiscalinet:it at: 14-Sep-2000 17:33


[rishi--picostar--com] wrote:
> This is called serialization of an object. Is there an easy way to do this in rebol?
Have a look at the function SAVE. The counterpart is LOAD. HTH, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [5/6] from: rishi:picostar at: 14-Sep-2000 11:42


that's just too simple. Rishi

 [6/6] from: larry:ecotope at: 14-Sep-2000 14:41


Hi Gabriele Just a small cautionary note. I have recently noticed that SAVE and LOAD do not always work. For instance, in REBOL/VIEW 0.10.33.3.1
>> layo: layout [box 200x200 red]
layo is a face object.
>> view layo ;works fine >> save %layo.sav layo ;writes a large file (about half a megabyte)
The file contains indicators of recursive blocks/objects i.e. [...]. So it will not load back in a valid form.
>> layo2: load %layo.sav >> view layo2 ;no red box
I have reported this to feedback, but had no response so far. -Larry