Objects as a base type

Carl Sassenrath, CTO
REBOL Technologies
22-May-2009 16:40 GMT

Article #0205
Main page || Index || Prior Article [0204] || Next Article [0206] || 4 Comments || Send feedback

I wanted to point out that in R3, you can discover the object base type behind a few of the other datatypes:

>> any-object!
== make typeset! [object! module! error! task! port!]

Although those datatypes may impose their own special restrictions on what actions (polymorphic functions) they support, they have the same fundamental implementation.

In fact, if you snoop around, you'll find it in a few places like:

>> source system/intrinsic/make-port
system/intrinsic/make-port: make function! [[
    "Creates a new port from a scheme specification."
    spec [file! url! block! object! word! port!] "port specification"
    /local name scheme port
    case [

    port: to port! port  ;<<-- ah ha! Got to love it.

    if in scheme 'init [scheme/init port]

So, in this case, the conversion is trivial, but as you know, in usage the semantics of a port are completely different. (E.g. read port, write port, etc.).

Now, the same was once true about series! as a method of discovering all series-based datatypes. But, if as a group we feel series! should be redefined, we may still want an any-series! for the base type.


Updated 27-May-2024 - Edit - Copyright REBOL Technologies -