Rebol readability=> was {Re: [Edu-sig] Top 5 All Time Novice Obstacles => #3 Where am I ?}

Jason Cunliffe Jason Cunliffe" <jasonic@nomadics.org
Mon, 23 Sep 2002 14:08:20 -0400


> destinationfile: join first split-path file append first parse/all second
>                  split-path file "." ".html"

lol
Yes that's a great bad example! But you make excellent points.

As I said before, one of the interesting edu-sig questions is:
"Why, in practice, so many people very quickly find Rebol very comfortable and
easy to read?

I'm not into this for any langauge flamebait reasons. Rebol does something very
clever which people respond well to. I hope we ask what's going here on? and can
gain insights from it.

Rebol imitates some aspects of the structure and habits of our natural human
languages. In the future, I imagine programming languages, especially the
interpreted scripting ones, will also be calmly included in that category. If
not spoken, at least under subsection: "languages/human/written".

I can also imagine highly visual/symbolic ones too - but I do not believe we
have seen those yet. Though one can argue that no-phonetic writing systems are
precursors [Egyptian or Mayan hieroglyphs, most Chinese ideograms]. "Toontalk"
that Phillip Kent just mentioned is a step in that direction. Andy DiSessa's
Boxer is a hybrid of script and visual symbol.

http://www.soe.berkeley.edu/boxer/papers.html

Because Rebol is an interactive intepreted language.like Python one naturally
spends equal time between the shell and text editor. A Rebol programming session
often feels less 'structural' than Python. Like FORTH one tends to think in
terms of words a fledh them out out into phrases at the shell. Then cut'n'paste
to the editor.

The process means that it is very natural to write very simple short manageable
phrases in the shell, quickly, iteratively building them up by inserting
modifiers, variables and conditions. Then generalizing as functions or object
structures.

cat sat mat
the cat sat on the mat
the cat named "nyaowny" sat on the persian rug

story: [Her little kitten sat on the persian rug, in the spot where the ornate
pattern became perfect camoflage. One day [Insert chapter 2]]

now tell me a story

When one formalizes this and pastes into text editor, to keep it readable, it is
typical to break lines to clarify the clausal and argument structures. Rebol's
equivalent of Python brilliant uniform whitespace indentation is not a
satisfactory one. But it works - define words well [keep them short and clear],
use line breaks liberally and blocks [].

story: [
    Her little kitten
    sat on the persian rug,
    in the spot where
    the ornate pattern
    became perfect camoflage.
    One day [Insert chapter 2]
]

There has been quite a bit of discussion on the REBOL list by developers trying
to agree on a uniform syntax for [] indentation. One solution actually had
switchable styles! The price for the freedom and flexibility of blocks is lack
of uniform sytle. One reward is that one can just paste rebol code and 'do it.



> Now as a Rebol programmer, you happen to know that "join" takes 2 arguments
> ...

Yes. As a rebol programmer you do have to know, and one does soon learn the core
vocabulary.

I gravitate to using words which take block argument words

rejoin ["some string" variable function [param1 param2]]

If it gets any longer than that,
    time for line breaks.
    Keep each phrase
    on its own line
    so it reads like a poem!

Rebol uses a LOT of datatypes and functions args can specify them. With
docstrings that improves debug clarity. Also there's a 'try' statement, so
conscientious programmer can proper error trapping. for ones own code.



> When I played with Rebol, this kind of thing drove me nuts:  because line
> boundaries aren't significant either, there are no reliable visual clues
> about the scope of function calls, where arguments begin or end, or even
> where conceptual statements begin and end.  Make one mistake, and it can
> have semantic effects to the very end of the file's source code.  That makes
> tracking down a runaway triple-quoted string in Python look like pure joy.

Yes.
I can imagine someone as profoundly skilled in Python as you, might have a
harder time. In the beginning I found it very odd switching between Python and
REBOL.

- Is the REBOL approach better or worse then as a 'first' language ?
- Better because people find it very easy?
- Worse because it won't sacle or give them tough expectations in others?

I often wonder how these programming langugages are perceived differently
according to people's mother tongue [English, French, German, Korea, Chinese
etc..]?
Word order, lack of prepositions, conjugation, richness of specialforms,
richness of verbs and ajectives, strictness..

Likewise how much does multiple languages help?
They say all children have tremendous facility to learn several languages
together at a young age. And that bi- tri- multi-lingual kids finds ti
getseasoier and easier to absorb more languages. As they maure tehy can fill in
the cirrect sytactic and grammar.

For example, The HIPPO club members encourage simultaneous exposure to many
languages as young as possible. Their premise is that basic pattern recognition
and confidence come first. Structure will emerge and can be taught formally
later along with correctness. It is no coindicdence that the same people
developed the brilliant

"Who is Fourier?"

Though curiously most people find Rebol very fast to find mistakes. It could do
wiht much better error prompts. Something that is harder to do because it line
numbers and object paths are not cetain like Python. Its an issue the more
advanced progammers have been discussing.

Again, I think it is useful to look at why people find it so easy to find
mistakes in Rebol. As an atrocious semi-dislexic typist, the syntactic
differences are theory. If I make a single typo it will still screw up any
program. And multiple ones can be tough. As long as scripting languages are the
base of edu-sig , solid typing is a #1 requirement.

> argument as the start of a new function call.  The lack of redundant syntax
> is pleasant in short and correct programs, but doesn't scale.

Yes. Scale is another topic on Rebol list from time to time. I don't think
anyone really knows for sure, as few large projects have been built in Rebol to
date. REBOL/View and /IOS are perhaps the largest. Much of that REBOL code
sitting above the compiled C kernel words. Scripts do tend be extremely short,
compared with other languages. The word-based modular design of rebol programs
is easy to grasp. Usually easy to share. But like FORTH it depends. The best
Rebol programs are very easier to follow. Python source is mostly
understandable, more than most languages, but great Python code is an eye-opener
and pleasure.

Some work is being done right now to develop a framework. For beginners, Rebol
motivates by its very rapid prototyping. Python does too, but scales well. Leo
is important new scalability tool. Starting from nothing it lets one think play
with large scale projects and explore [design & analyze]. But is also helps
manages and understand them as they grow dense. Seeing the structure is hard to
do.

> Rebol has some very cool ideas, btw -- this wasn't one of them.

What do you think are the good ones?

./Jason