[REBOL] Re: REBOL-SIMPLE dialect
From: henrikmk::gmail at: 20-Aug-2008 12:01
On Wed, Aug 20, 2008 at 9:15 AM, Carl Read <carl-cybercraft.co.nz> wrote:
> On Tuesday, 19-August-2008 at 20:06:52 Maxim Olivier-Adlhoch wrote,
>>
>>You see, what makes REBOL distinct is not the computing model it has,
>>or its functions, or library richness... its its syntax itself.
>
> Thank you MAx. My planned (but not implimented;) reply to Greg would have been something
along the lines that leaving out the datatypes in his REBOL-Simple would've been missing
the point of REBOL, but I doubt I would've shed much light on the why.
>
> So maybe REBOL-Simple shouldn't be a dialect, but just a reduced set of REBOL's default
words - and perhaps a few new ones?
The default word set in REBOL is actually quite simple. Block
manipulation is astonishingly simple and elegant compared to, say,
manipulating arrays in PHP. This is where REBOL's great design pays
off.
I think it's a bad idea to restrict the word set of REBOL. It's like
saying you want the English language to consist only of 30 words, so
we don't have to print dictionaries anymore. That gives you problems
with expressability, although it's easy to remember 30 different
words. You may have to use more words to express a particular thing,
because some words are not available to you, or some things are just
impossible to express without having a word for it. A more correct
thing would be to weed out all synonyms to reduce the chance of
running into a word you don't know. But contrary to English, REBOL
does not have many synonyms. It has a few, but they are there because
they make sense and increase readability.
I think you would actually want to add mezzanines where it makes
sense. The cost of having more words to look up in a reference is
lesser than having fewer words to remember. Let me illustrate why:
Some things are tremendously easy to do out of the box, like simple
email validation:
if email? somewhere-blabla.com [print "Yes, that's an email"]
It doesn't get much simpler than this and most beginners can figure
out what's going on there. But some mundane things are much harder,
like reformatting dates to a different format. We don't have a:
to-rfc-822 25-Jun-2008/04:12:56
Or:
to-csv [[1 2 3 4][5 6 7 8]]
There's a mezzanine missing to perform these trivial conversions, so
the code would appear very simple or "beginnerish". The action behind
the function might be very complex. To ask a complete newbie to write
out a CSV file of a block of blocks, might be a bit much, so you begin
to consider the contrast of having the user to write 20 lines of code
to write that CSV string out, versus having only to write the line
above.
I don't think it's the job of R2 or R3 itself to have built-in CSV
file conversion methods as CSV is unfortunately not as generic as we
like to think. But I do think the problem is right there. By using
mezzanines to simply the language in general you can increase
readability and reduce visible complexity. We just have to find
sufficiently generic cases to solve and carefully pick which ones to
implement.
R2.7.6 and R3 have several new mezzanines to handle general cases,
like moving elements around in a block with the new MOVE function.
Other words that fit the profile, implemented for R2.7.6 and R3:
ALSO
FIRST+
SHIFT
TO-RELATIVE-FILE
TAKE
Each one either represents a significant amount of code reduction or
fills a natural "hole" in the REBOL function list, one where you'd ask
why don't we have a function like this?
.
This is where you want development to happen and it's certain to be
discussed in the r3-alpha AltME world where R3 development happens.
If you find more generic cases to implement, post them here, and if
they are good, they may be discussed for implementation. Better yet:
Produce a well-tested and optimized mezzanine and present it here.
R3 also has new functions to make certain things much clearer, where
you would use an existing word in R2 to do the same thing with less
clarity. In R2 you would get the words of a block by typing:
>> first my-object
== [self name address street age]
You cannot possibly know this without reading up on extra
documentation or asking another developer or stumbling upon it by
random.
In R3:
>> words-of my-object
== [self name address street age]
That's just one little quirk removed to increase clarity drastically
and of course it just one function of a whole set that adds partial
reflectivity to R3.
--
Regards,
Henrik Mikael Kristensen