REBOL 3.0

Comments on: 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]
    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.

4 Comments

Comments:

meijeru
22-May-2009 13:45:44
operationally this is only interesting if one can find the typeset(s) that a type belongs to; of course, if one is systematic and has the base type names all begin with any-, then it becomes easier....
Carl Sassenrath
22-May-2009 14:50:11
Also, this is a handy method:

>> help typeset!
...
Found these words:
   any-block!      typeset!  make typeset! [block! paren! path! set-path! ...
   any-function!   typeset!  make typeset! [native! action! routine! rebco...
   any-object!     typeset!  make typeset! [object! module! error! task! p...
   any-path!       typeset!  make typeset! [path! set-path! get-path! lit-...
   any-string!     typeset!  make typeset! [string! binary! file! email! u...
   any-type!       typeset!  make typeset! [end! unset! none! logic! integ...
   any-word!       typeset!  make typeset! [word! set-word! get-word! lit-...
   number!         typeset!  make typeset! [integer! decimal! percent!]
   scalar!         typeset!  make typeset! [integer! decimal! percent! mon...
   series!         typeset!  make typeset! [string! binary! file! email! u...
Carl Sassenrath
22-May-2009 14:51:46
BTW, it would be nice if someone modified HELP to remove the "make typeset!" part of that output like we do for several of the other types.
Henrik
23-May-2009 7:52:06
Help modification added as bug#842. No code yet.

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0205


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 22-Jul-2017 - Edit - Copyright REBOL Technologies - REBOL.net