Hi All,
I need some REBOL insight. :-)
I have used the following method to get a list of name:value
pairs in practice and it is working fine.
>> my-block: [name "Rod" age 37 profession "Developer"]
>> print select my-block 'name
To me the above doesn't feel right. The approach I would
prefer is to have the list in the block to be words themselves
that could be dereferenced to get to the value. For example -
>> name: "Rod"
>> age: 37
>> profession: "Developer"
Then building a list of these words -
my-block: [name age profession]
Where I could then access each element value in a loop or by name.
Example only:
>> print my-block/name
Rod
or
>> foreach entry my-block [print :entry]
I like the way a word combines a name, the value, and datatype info.
The specific place I'm trying to use this - in case I'm just barking up
the wrong tree in general -
I am creating some objects that will be built by parsing a database
schema file. In these objects I don't want to predefine the "properties"
that I know about a "Table" or "Field" but rather manage them as a
list of words - letting the parse create them as it encounters each
property definition.
An example of the schema file -
ADD TABLE "Ability"
AREA "Data Area"
LABEL "Ability"
DESCRIPTION "A list of abilities that persons can attain"
ADD FIELD "AbleId" OF "Ability" AS integer
DESCRIPTION "A unique ID for the ability"
FORMAT ">>>>>>>>>9"
INITIAL "0"
LABEL "Ability ID"
COLUMN-LABEL "Ability ID"
ORDER 10
MANDATORY
I would like to grab the name:value relationship in the file
and turn them into a list of words -
Area: "Data Area"
Label: "Ability"
and so forth.
TIA, Rod.
Rod Gaither
Oak Ridge, NC - USA
[EMAIL PROTECTED]
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.