[inconsistency in object?]
[1/5] from: rebol665:ifrance at: 8-Mar-2002 20:12
Hi rebollers
It seems that 'self exists in any object.
o: make object! [
a: 1
b: 2
c: 3
d: does [print [a b c]]
]
>> first o
== [self a b c d]
How come that rebol/words have no 'self ?
>> type? rebol/words
== object!
>> first rebol/words
== [end! unset! error! datatype! context! native! action! routine! op!
function! object! struct! library! port! any-type! any-word!...
Patrick
[2/5] from: holger:rebol at: 8-Mar-2002 12:02
On Fri, Mar 08, 2002 at 08:12:39PM +0100, pat665 wrote:
> Hi rebollers
> It seems that 'self exists in any object.
<<quoted lines omitted: 7>>
> == [self a b c d]
> How come that rebol/words have no 'self ?
Implementation detail :).
--
Holger Kruse
[kruse--nordicglobal--com]
[3/5] from: hallvard:ystad:helpinhand at: 8-Mar-2002 21:50
Dixit pat665 (20.12 08.03.2002):
>How come that rebol/words have no 'self ?
There actually _is_ a 'self in system/words (or rebol/words, if you fancy), but it seems
to be undefined (at least with my prob: http://folk.uio.no/hallvary/rebol/prob.r, but
that may be my mistake, of course)... That's strange, indeed.
'Self may be set to any value. Did you know? Let's probe your example:
o: make object! [
a: 1
b: 2
c: 3
d: does [print [a b c]]
]
>> probe o
make object! [
a: 1
b: 2
c: 3
d: func [][print [a b c]]
]
Now let's make a new one:
>> p: make o [
self: "007 Object. Secret Object."
]
>> probe p
== "007 Object. Secret Object."
~H
[4/5] from: rotenca:telvia:it at: 8-Mar-2002 23:15
Hi, Holger
> > How come that rebol/words have no 'self ?
>
> Implementation detail :).
But when system/words is cloned with make system/words, make changes the first
value of the first word (end!) to make it point to the object itself, also if
it is not called 'self. Make likes orthogonality? ;-)
>> x: make system/words [] 1
== 1
>> first first x
== end!
>> type? first second system/words
== unset!
>> type? first second x
== object!
---
Ciao
Romano
[5/5] from: petr::krenzelok::trz::cz at: 9-Mar-2002 0:23
Holger Kruse wrote:
>On Fri, Mar 08, 2002 at 08:12:39PM +0100, pat665 wrote:
>>Hi rebollers
<<quoted lines omitted: 14>>
>>
>Implementation detail :).
heh, but placing self as first member of object word structure makes
code uglier. We could use "third o" (third is e.g. used for structure
datatype, or even functions) to get self, instead of current situation,
where you have to use "foreach next first o ...", if you want to iterate
thru obj. words ... another implementation detail? :-)
-pekr-
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted