type: word!; probe type? type ; datatype! probe type? word! ; datatype! probe (type = word!); true switch type [ unset! [ print "unset!" ] word! string! file! url! block! [ print "word! string! file! url! block!" ] ]
any-type!has to do with that?
@lepinekong_twitter, at this stage in your Red career, if someone offers a hint, clue, or suggestion in answer to a question or problem you pose, please take some time to understand their response, rather than immediately saying "Why would I need to...?"
Do you understand the behavior now? If not, does this help?
type: word! blk: [ unset! [ print "unset!" ] word! string! file! url! block! [ print "word! string! file! url! block!" ] ] switch type blk find blk type type? type find blk type? type type? first blk find blk 'word! switch type reduce blk
There should be no more explanation needed than this, and is an example of how to go about learning and debugging on your own.
>> type? first [integer!] == word! >> type? integer! == datatype!
In the first case, the word inside the block is not evaluated (because nothing causes it to be evaluated), in the second case, the word is the argument of a function, so it gets evaluated (it evaluates to a
datatype!) . No quirks here, just basic evaluation rules of the language. Once we get syntax coloring in the console, it should be easier to spot the difference between values of different types having same literal form.