[REBOL] Re: Sameness - a pragmatic approach.
From: joel:neely:fedex at: 11-Feb-2003 16:13
Hi, Ladislav (et al),
I'm having to ponder my mental model here, so this is just me
thinking aloud
...
Ladislav Mecir wrote:
> > >
> > > Interestingly enough, this isn't the case here:
> > >
> > > alias 'a "aaa"
> > > equal? mold 'a mold 'aaa ; == false
> > > equal? 'a 'aaa ; == true
> > >
> > > How would you comment that? Does it look like an inconsistency
> > > to you?
> > >
> >
> > Yes.
> >
>
> To be consistent, then, maybe we should say:
>
> word1: 'a
> a: 1
> word2: use [a] [a: 2 'a]
>
> that WORD1 and WORD2 aren't "naturally" equal, because we can find some
> differences without any writing operation, shouldn't we?
>
> After evaluating an expression like:
>
> a: 2
>
> we aren't able to decide for the same words whether they are equal or not
> without a writing operation, that is why WORD1 and WORD2 aren't "naturally"
> equal in this case.
>
I had previously thought of words and values via a model in which a
word is associated with a value via a context, words in different
contexts may have names spelled the same (as in your A vs. A above),
and a LIT-WORD! value was essentially a way to "quote" a word (i.e.
to suppress the automatic evaluation of a word to the associated
value in the appropriate context). MOLDing a lit-word would just
retrieve a string that spelled its name.
Clearly that model doesn't address ALIAS properly, both because of
your example above using A vs AAA , and because of the fact that
ALIASing is apparently immutable once accomplished:
>> alias 'a "aaa"
== aaa
...
>> foo: 3
== 3
>> alias 'foo "aaa"
** Script Error: Alias word is already in use: aaa
** Where: halt-view
** Near: alias 'foo "aaa"
>> alias 'a "foo"
** Script Error: Alias word is already in use: foo
** Where: halt-view
** Near: alias 'a "foo"
...
>> unprotect 'aaa
>> alias 'foo "aaa"
** Script Error: Alias word is already in use: aaa
** Where: halt-view
** Near: alias 'foo "aaa"
At this point I can only scratch my head in puzzlement, because:
1) It's not clear to me what problem ALIAS is supposed to solve;
2) It's not clear to me why ALIASes must be immutable;
3) It's not clear to me why PROTECTion is inadequate to eliminate
accidental re-SETting of alias names;
4) It appears that there's some additional layer of WORD! objects
to which word-names refer, and which is detectable via the
LIT-WORD! "indirect reference".
Given your
> > > alias 'a "aaa"
> > > equal? mold 'a mold 'aaa ; == false
> > > equal? 'a 'aaa ; == true
I would have expected
equal? a aaa ; == true
as A and AAA are entangled in a way that guarantees changes to the
value associated with one will necessarily be visible in the value
associated with the other.
I would (in my ignorance of both the intent and implementation of
ALIASing) have expected EQUAL? 'A 'AAA to have evaluated to
FALSE , as the two literal names (spellings) are different.
On the other hand, given that you've called my attention to
> > > equal? 'a 'aaa ; == true
I'm now further baffled to observe
same? 'a 'aaa ; == false
<rant>
All of this simply reinforces my frustration at the lack of a clear,
authoritative language spec, in at least two ways.
1) The claim that REBOL is intended for "humans" vs "programmers"
doesn't hold water when there are aspects that almost every
REBOL programmer (judging by the discussions/questions on this
list) finds confusing or counterintuitive, or simply avoids
entirely because their use is too difficult to understand/predict,
and therefore...
2) The stock reply, "Let REBOL be REBOL; don't think in terms that
other languages use!" is wholly unsatisfactory, as the fact that
REBOL is actually implemented on conventional computers means
that its behavior *CAN* be explained in terms that programmers
(at least the programmers of RT ;-) can understand.
I've learned and used a large number of languages (and operating
systems) during my career, and certainly understand the value of
thinking natively
in a programming language. I certainly think
differently when writing e.g. Perl than when writing Java, and the
difference increases exponentially with e.g. Prolog vs C, etc.
However, in the case of every other language I've ever learned, I
have had access to specifications, manuals, tutorials, textbooks,
(and, in the case of languages such as Perl, Python, Ruby, etc.
the actual inventors and implementors of the language) to get the
definitive answer to any question about what the language was
*supposed* to do at any level of detail needed. For the three
languages mentioned above (among others) one can get the source
code of the implementation as the "source of last resort" to get
answers for oneself.
I'm certainly happy with the concept that a designer might try to
create a language that can be "picked up" by intelligent humans
who don't happen to possess graduate degrees in Computing Science
or some other aspect of Mathematics. However, that's a totally
different aspiration than denying those who *do* have a technical
background from the opportunity to use what they already know as
a basis for understanding a new language.
It's OK to tell a non-technical user something as informal as
This language distinguishes between "integer" values,
which are "whole numbers" without fractions, and "decimal"
numbers which do have fractions.
but if you want your language to be used by real programmers for
real applications, you'd better be willing to talk about how many
bits in an integer and the mantissa and exponent of a floating-pt
value. Those two conversations DO NOT conflict.
REBOL is a very interesting language with some neat concepts, but
as long as we are on our own to figure out how it works (or was
intended to work) we will *never* be able to persuade a significant
portion of working programmers (and the suits in the food chain)
that they should use it.
Whether REBOL can even achieve a sufficient "critical mass" of
devotees under these circumstances remains to be seen.
</rant>
--
----------------------------------------------------------------------
Joel Neely joelDOTneelyATfedexDOTcom 901-263-4446
Atlanta, Ga. - Scientists at the Centers for Disease Control today
confirmed that hoof-and-mouth disease cannot be spread by Microsoft's
Outlook email application, believed to be the first time the program
has ever failed to propagate a major virus.