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

[REBOL] Re: REBOL Enhancement Proposals (REPs)

From: deadzaphod:flyingparty at: 26-Sep-2001 1:39

> I would find that REP handy, particularly when dealing with REBOL/Command > and the blocks it returns . ["username" "userpass"] > > e.g > config: context [user: pass: none offset: 0x0 color: grey] > insert db-port [{SELECT User, Pass FROM Clients WHERE ClientID = 3}] > set [config/user config/pass] pick db-port 1
what's wrong with set bind [ user pass ] in config 'self pick db-port 1
> This is more using the "c-struct" fashion as you mention, but when dealing > with a lot of fields, I will make less errors when dealing with named > elements from an object (or block) rather than trying to remember their > index numbers to pick them from a block.
if there were a lot of fields (rather than the two in this example) the existing syntax is shorter. The only time there is a significant advantage to the REP is if you want to set words in several objects at once. For those situations I recommend using something like the function below in place of 'bind... bind-with: func [ words obj-set /copy ] [ if copy [ words: system/words/copy/deep words ] foreach obj obj-set [ bind words in obj 'self ] return words ] I wrote this around a year ago when I needed something like a context hierarchy in one of my scripts. - Cal Dixon