[REBOL] Dialects - Bane or Blessing? (was: Teaching Rebol)
From: greggirwin::mindspring::com at: 25-Sep-2002 22:28
Hi Jason, et al
I think dialects are something we're going to learn a lot more about as we
start to really learn how to create and apply them. Since I think dialects
are so important, I'd love to hear some other viewpoints about their pros
and cons. This isn't a rant, or an attack on your view, but your note
inspired me to think a bit and, now, ask more folks here to think a bit and
share their thoughts.
<< My main concern about Dialects is that the new extra vocabulary/syntax to
learn
and lack of indication. >>
How much "indication" a dialect provides will depend on the dialect. The
PARSE dialect provides quite a bit of indication I think, which is valuable
in that context. Defining a grammar isn't the place to have lots of
ambiguity. :)
In a good dialect, there shouldn't be any *extra* vocabulary or syntax. Just
the dialect. The dialects we use in the course of REBOL development (VID and
PARSE) may *seem* to have extra rules because we don't "change gears" when
we use them. We keep thinking in REBOL and we just glom on the extra rules
because you can mix the two so easily. If you had to go to a specific
window, and only valid VID code could be typed there (no embedded REBOL
allowed), maybe it would be less confusing because your brain would switch
modes. It's really hard to think that, as soon as I type "layout [", I'm
writing in a totally different language! Even thinking about it now,
explicitly, my brain doesn't want to wrap around it very well. ;\
<< Great for the original deevloper, but alreadyknwo it inside out. >>
Ahhh, this is where I see the power of dialects coming to the fore. The
original developer needs to design a dialect for a target audience. That
target audience doesn't know anything about REBOL, and the dialect doesn't
look even *remotely* like REBOL. The users could use it for years, then be
exposed to REBOL and not have any idea how to write REBOL code. Just like
any good interface, if the designer does his job well, it will be easy to
use. If not, it will be like command lines of old, or GUIs with layers of
stuff where you can't find anything.
I look at dialects being used by non-REBOLs. Writing new dialects for
ourselves is going to be very empowering, totally cool, and loads of
fun...for us. Regular folks, the ones with "lives" that we hear so much
about, just want to communicate without thinking about *how* they're saying
what they want to say. For us, yeah, we'll want to be careful not to create
dialects that confuse us.
dialect - The form of a [spoken] language, peculiar to a region or social
group.
Thousands, or tens of thousands, of dialects exist in the world today.
People use them all the time without even thinking about them. I'm using one
now. It's what people do. The great thing about dialects is that the goal is
to teach the computer to understand *us* in a meaninful way, rather than the
other way around.
<<...even though the code looks cleaner and is focused on the applcaition
domain closely. >>
You bring up two great things about dialects. I can't improve upon your
statement, so I'll just add a note, or ten, to it.
Domain specific languages are one of the few places where really huge
productivity gains come from. They provide enormous power by letting people
think in terms of a particular context. Two great Wittgenstein quotes:
"The limits of my language are the limits of my mind.
All I know is what I have words for."
"If we spoke a different language, we would perceive a
somewhat different world."
On the tech side, look at Capers Jones 'Productivity by Function Point
Analysis' view on how different languages compare, as to how "productive"
they are in terms of code versus functionality. (bad memory guessimates
here) C is down around 2, C++ ~5, VB/Java ~10, Perl/Smalltalk ~15, SQL ~25,
Excel/Lotus ~50.
I'll let you draw your own conclusions about what these numbers mean. :)
When you write functions, class libraries, etc. what you're really doing is
extending the dialect of their parent language. While that's convenient,
it's only applicable in the *context* of the parent language, or compatible
languages. REBOL dialects don't have to play by those rules. Now, you could
do this with most any language out there, at least to some extent. I've done
it myself. The problem is that those languages tend to be limited,
inflexible, or a lot of work to write. REBOL makes it easy to write
powerful, flexible and, thereby, useful dialects.
What's confusing in some cases, like VID, is that the dialect is generally
used *inside* the context of the REBOL dialect and can also *contain* REBOL
code. It's also extremely flexible and tries to be as smart as possible to
make your life easier (e.g. not caring about facet order if it can figure
them out by datatype, etc.). Think about that recursive notion for a moment
and imagine how confusing it *could* be if done poorly. :)
I very rarely see complaints about the PARSE dialect, though there are
occasionally suggestions for how to improve it. Maybe that's because it has
more clearly defined and visible syntax.
What other dialects are out there? I have a couple, but I should go now
because this is already really rambling and I've been typing slower than I'm
thinking so it's probably not been an easy read. Sorry about that, but
thanks Jason! My brain is bursting!
--Gregg