You likely know that DATATYPE! in R3-Alpha (Rebol 2, Red...) has a distinct "type byte" in the cell. So the implementation can tell it's a different thing, even if not all representations show that:
r3-alpha>> block: reduce ['integer! integer!]
== [integer! integer!]
r3-alpha>> type? first block
== word!
r3-alpha>> type? second block
== datatype!
One way R3-Alpha has to see the difference is with MOLD/ALL
r3-alpha>> mold/all block
== "[integer! #[datatype! integer!]]"
But What's Actually in a DATATYPE! Cell?
This was the definition struct from R3-Alpha:
typedef struct Reb_Type {
REBINT type; // base type
REBSER *spec;
// REBINT min_type;
// REBINT max_type;
} REBTYP;
So an integer to say what type
it is (e.g. REB_INTEGER = 1, REB_LOGIC = 2, REB_BLOCK = 3 or whatever). Note that this in the payload of the cell, not the header...because the type in the header is REB_DATATYPE to say it carries a "datatype payload".
Who knows what the commented-out min_type
and max_type
were. But a remark says this payload is for a "Datatype or pseudo-datatype". We can guess these were for pseudo-datatypes as a way of specifying a range of REB_XXX numbers to implement categories like ANY-SERIES!, as an alternative to typesets (?)
The spec
is actually an object, that comes back as the answer to SPEC-OF:
r3-alpha>> spec-of integer!
== make object! [
title: "64 bit integer"
type: 'scalar
]
This limited amount of information was built into the executable from the Rebol-format table table in %typespec.r.
You needed to use SPEC-OF to access these properties, but it could have been accessible with paths, e.g. integer!/title. And it might have had more interesting properties:
>> integer!/max-value
== 9223372036854775807
All Redbols Conflated The Looks of DATATYPE! and WORD!
In lockstep, they all did it:
rebol2>> integer!
== integer!
r3-alpha>> integer!
== integer!
red>> integer!
== integer!
Since I have Boron built, I find it renames integer! to int!, but otherwise the same:
)> int!
== int!
)> type? int!
== datatype!
)> type? first [int!]
== word!
It seemed to me that this conflation couldn't possibly be the best answer. So I made Ren-C buck this trend to use the R3-Alpha construction syntax, because it was something that could LOAD back:
>> integer!
== #[datatype! integer!]
>> load "#[datatype! integer!]"
== [#[datatype! integer!]]
Rendering differently was good, but the specific different rendering wasn't all that palatable. And it wasn't showing it as any complex object.
Where To Go From There?
There seemed to be two directions to go with this:
-
Accept DATATYPE! as some kind of alien complex type which has ugly rendering
-
Fit it into the lexical space somewhere.
Ren-C has moved toward the idea of making datatypes a BLOCK! variant, decorated with &:
>> type of integer!
== &[integer]
The details of what structure is used on these type blocks is still under consideration at time of writing. See the threads in the forum's Datatypes Category