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

[REBOL] Re: I hate computers!

From: rotenca:telvia:it at: 5-Jan-2003 2:41

Hi Andrew,
> determine whether a value of type DATATYPE! is a "physical" type or a > "pseudo" type? > > >> Physical?: func [Datatype [datatype!]] [ > [ attempt [make Datatype 0 true] > [ ] > Basically trying to 'make the real value. Unfortunately, it doesn't work for > 'function!, which requires two block! values and crashes Rebol when using a > 0 value instead.
It does not work also for action!, datatype!, date!, error!, function!, get-word!, library!, lit-word!, native!, object!, op!, port!, refinement!, routine!, set-word!, struct!, symbol!, tuple!, unset!, word! This function t-d?: func [x][if error? set/any 'x try [make x] [x: disarm x return x/id <> 'cannot-use] true] fails on: action! datatype! native! op! unset! This is a very empirical example which happens that fails only on unset! (but is unset! a real datatype?): t-d?: func [x /local y][ if parse/all second system/words [ to x skip to x y: skip to end ][return x = type? first y] true ] I think that we need some natives to works on datatype!, for example: 1) pseudo-datatype? pseudo-datatype? any-string! ;== true 2) in-datatype? in-datatype? any-string! string! ;== true 3) parent-datatype? parent-datatype? string! ;== any-string! parent-datatype? any-string! ;== series! --- Ciao Romano