[REBOL] Re: On mutability and sameness
From: robbo1mark:aol at: 20-Jun-2001 5:20
REBOL AS IT'S OWN META-LANGUAGE
I've read recently from Jeff & Joel, and other's
in the previously, that REBOL is it's own meta-language.
This is bunk! or at least only partially true.
Yes for any particular instance or behaviour you can
generally write a rebol function or object to model
it's behaviour but you cannot do this for the "entirety"
REBOL, sooner or later you run into irreducibility.
Consider this model of REBOL addition...
>> add: func [ x y ] [ + x y ]
>> add 1 2
== 3
Fine so far, however how do you define the '+ in
the function body?
If you say
>> set 'x func [ x y ] [ add x y ]
On the surface it looks okay, but try....
>> add 4 5
** Internal Error: Stack overflow
** Near: add x y
>> + 4 5
** Internal Error: Stack overflow
** Near: add x y
>>
Your into infinite recursion here, so REBOL as a complete
meta-language is "insufficient".
However this is NOT a slight on REBOL just a fact about
the notion of meta-languages, you CAN'T have a complete
& self contained descriptive system.
Here's a quote from Chuck Moore about Forth which equally
applies to REBOL
I like to quote Goedel on this, it goes back to 1930.
he proved that a self contained formal system cannot be
contained. horribly non- sequator but, all right within
a system you can't describe itself. Within forth you can't
describe Forth. Well, our systems are not so esoteric
as Goedel's but I think you can say that within a system
you cannot describe it simply.
Now yes it is "preferable" to use REBOL to describe REBOL
whenever possible as this should lead to "less" confusion
however you simply "cannot" completely model REBOL in REBOL
as a whole entity.
If this was the case there would be no need for RT Inc.
to write any more interpreters, we could simply write and
extend REBOL in and from REBOL and we'd all live happily
ever after.
Unfortunitely there are these "irreducibles" or "primitives"
that you simply MUST have to get the system up and running.
It is for this reason that you sometimes have to use C or
Java or something else to "explain" or implement REBOL.
You can however devise a way to construct these "primitives"
from within REBOL / your "meta-language" then you get into
the realms and possibilities of META-COMPILATION which is
a system written in itself, however you still have to
bootstrap the whole process from something else first whether
this be Assembler or C or Java or whatever.
Forth proves this is possible and has had this capability for
nearly thirty years now, maybe someday REBOL will catch up &
we'll be dispensed with the need for RT to write our REBOL
interpreters for us, if we so choose of course. 8-)
Oh Dear, why am I always so contrary? I don't know about painting
that fence Jeff, maybe I should come round from the wrong side
of it and you can break the fence apart & hit me over the head
with it!
; see I can be "light hearted" sometimes!
Cheers my REBOL friends.
Mark Dickson
In a message dated Tue, 19 Jun 2001 2:16:27 PM Eastern Daylight Time, Jeff Kreis <[jeff--rebol--net]>
writes:
<<
Hello, Robbo:
> JEFF,
>
> I essence you are correct, but how easier can you more
> properly explain these examples.....
>
> >> a: "123"
> == "123"
> >> b: a
> == "123"
> >> c: "123"
> == "123"
>
> 'a & 'b are the "SAME" string! and refer to the same memory
> location. 'c has the same value on the surface but is a
> separate instance of a string! value and is stored at a
> separate memory location.
I think explaining the above in C is vastly more complex than
explaining it in terms REBOL has already established. You may
very well wreak havoc on the understanding people DO have of
the above by trying to explain it using C.
'A and 'B are both different words. They are NOT strings.
Both words refer to (have the value of) the same string. 'C
is also a different word than 'A and 'B. It refers to a
different value (a different string).
These particular notions of WORDS and VALUES are a distinct
aspect of REBOL and they are not an aspect of C. WORDS and
VALUES are within in the vocabulary of REBOL, but they are not
to be found in the vocabulary of C. C's typed variables are
an especially poor analogy to REBOL WORDS, for example please
describe the following in C:
word: 1
word: make object! [word: func [][print "I am a function"]]
word: word/word
word: 'word
I can easily explain the above in terms of WORDS and VALUES,
but I would find it very difficult to explain in terms of C's
typed variables and pointers. That's like explaining calculus
using Lincoln Logs.
REBOL is first class and EVERYTHING is data. This concept is
utterly absent from C. Please provide an example of how one
may understand the nature of REBOL's first class code/data
duality with C code.
> That is why this....
>
> >> insert b "abc"
> == "123"
> >> b
> == "abc123"
> >> a
> == "abc123"
> >> c
> == "123"
>
> The value of 'A & 'B both change but 'C remains unaltered. You can show this in 'C
( or some other language ) by use of pointers and references as Joel
> did.
.."or some other language".. hmmm.. what would be a good
language for describing REBOL... hmmm... maybe REBOL? It's
its own metalanguage, afterall! :-)
> Similarly....
>
> >> a: <abc>
> == <abc>
> >> parse a [b:]
> == false
> >> b
> == "123"
>
> How do you explain that unless you drop down to C or
> something else and show your any-string! or any-block!
> models with pointers to memory storage for the actual "data" values.
> In the above example both reference the "Same" string!
> data but 'a has the datatype! value tag! whilst 'b is
> a normal string! datatype!
Well, you might start by understanding that in REBOL there are
WORDS and WORDS can refer to VALUES. (Words are VALUES
themselves, by the way.) Once you have those concepts firmly
in hand, move onto understanding how PARSE treats set-words in
a rule.
Would you explain the movement of the knight in chess in terms
of the way you play checkers?
> Also what is wrong with helping your neighbour to paint
> his fence is you neighbour is your friend?
It depends on the informed consent of the fence painter, and
who claims credit for the fence being painted. :-)
-jeff