Comments on: Objects as a base type
I wanted to point out that in R3, you can discover the object base type behind a few of the other datatypes:
== 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
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.
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....|
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...
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.|
Help modification added as bug#842. No code yet.|
Post a Comment:
You can post a comment here. Keep it on-topic.