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

[REBOL] Re: Object Sea - Melt and Freeze

From: al:bri:xtra at: 24-Feb-2002 8:49

Mike Myers wrote:
> Can you show me a usage example or correct what I have been trying or
thinking about how to deploy? Here's one Rebol console session:
>> customer: make object! [
[ id: name: address: status: none [ ]
>> sea: make block! 100
== []
>> append Sea make Customer [
[ name: "Donald Trump" [ id: 1 [ address: "Trump HQ, New York." [ status: 'active [ ] == [ make object! [ id: 1 name: "Donald Trump" address: "Trump HQ, New York." status: 'active ...
>> cd %/c/
== %/c/
>> save %/c/MySea.txt freeze sea
And here's another Rebol console session:
>> cd %/c/
== %/c/
>> sea: melt reduce load %/c/MySea.txt
== [ make object! [ id: 1 name: "Donald Trump" address: "Trump HQ, New York." status: 'active ...
>> probe sea/1
make object! [ id: 1 name: "Donald Trump" address: "Trump HQ, New York." status: 'active ]
> I have a customer instance available but don't have the association with
'don-trump
> Can I freeze the name-space too (or whatever you would call it)?
Don't do this:
> append sea don-trump: make customer [name: "Donald Trump" id: 1 address:
Trump HQ, New York status: 'active] in particular, assigning a word "don-trump: " that relates to the object (the "name-space"). That's because Rebol can only have 4096 words in total and a lot of these are used up all ready, and most functions need words to access them. To keep track of the customer objects, it's best to use a block to store customer objects. Like: Customers: make block! 100 until [ ; operator enters customer details. ;eg Customer: make object! [ name: name_details ; from form address: address_details ; from form Id: new_ID_Number ; or similar function. Status: 'action ] append Customers Customer no_more_customers ] append/only Sea Customers ; use /only to append the block! value as a block! I hope that helps! Andrew Martin ICQ: 26227169 http://valley.150m.com/