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

[REBOL] Re: How do I dynamically modify an object?

From: al:bri:xtra at: 15-Jan-2003 10:24

Ed wrote:
> Using the examples from the REBOL On-line dictionary: > >> Example: Make Object! [ Name: "Fred" Age: 5000000 ] > >> Get in Example 'Name > == "Fred" > >> Set in Example 'Name "Fred Flintstone" > == "Fred Flintstone" > > How do I dynamically add to example, after it has been created, Address:
123 Bedrock Path .
> I tried using 'Set, 'Make and a couple other functions, but they didn't
work. I was probably using them wrong. :) Rebol unfortunately doesn't allow objects to be expanded. However you can expand block! values. For example:
>> Example: [ Name "Fred" Age 5000000 ]
== [Name "Fred" Age 5000000]
>> repend Example ['Address "123 Bedrock Path"]
== [Name "Fred" Age 5000000 Address "123 Bedrock Path"]
>> example/name
== "Fred"
>> example/address
== "123 Bedrock Path" Andrew Martin ICQ: 26227169 http://valley.150m.com/