Hello [EMAIL PROTECTED]!
On 18-Gen-00, you wrote:
i> interesting and worthwhile observations, regarding the use of
i> examples in place of datatypes.
[...]
I think REBOL uses something like this to determine the datatypes:
>> type-declaration: func [
[ [catch]
[ types [block!]
[ /local result
[ ] [
[ result: make block! length? types
[ foreach type types [
[ append result either word? :type [
[ type: get type
[ either datatype? :type [
[ type
[ ] [
[ throw make error! "Invalid argument"
[ ]
[ ] [
[ type? :type
[ ]
[ ]
[ ]
>> type-declaration [integer! block!]
== [integer! block!]
>> type-declaration [1 []]
== [integer! block!]
>> type-declaration type-declaration [integer! block!]
== [datatype! datatype!]
I'd prefer something like this:
>> type-declaration: func [
[ types [block!]
[ /local result
[ ] [
[ result: make block! length? types
[ foreach type types [
[ if word? :type [type: get type]
[ if not datatype? :type [type: type? :type]
[ append result type
[ ]
[ ]
>> type-declaration [integer! block!]
== [integer! block!]
>> type-declaration [1 []]
== [integer! block!]
>> type-declaration type-declaration [integer! block!]
== [integer! block!]
Regards,
Gabriele.
--
o--------------------) .-^-. (----------------------------------o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ |
o--------------------) `-v-' (----------------------------------o