[REBOL] Re: Tools for Rebol Coders
From: greggirwin:mindspring at: 8-Jan-2002 11:48
Hi Sunanda, et al
I didn't jump in on the style thread, but I can include my thoughts here as
they are applicable in this context as well.
<< -- I write some code that calls something from your site that calls
something
from someone else's. And at some point it crashes with an "Error near a /
b".
Is that my code or yours or the other person's or a Rebol-supplied mezzanine
function? I don't care how un-purist it is to expect the call stack to be
printed. But I need it at this point or the application is dead in the
water. >>
I think this points out that we, as REBOL developers, need to take into
account the context in which our code is intended to be used. I can
appreciate being able to write simple reblets that are self-contained and
often times may get by with a minimum of error handling and formal design.
If you are writing code to be used in distributed applications, you darn
well better have everything error trapped and be as helpful as possible when
it comes to tracking down errors. I think Design by Contract will be
enormously helpful in that regard but I haven't had time to work up a
dialect implementing it yet.
That said, I think call stack information could be very useful in certain
cases as well.
<< -- I think we've all agreed that we find different styles harder to read
than
others. So if you and I are collaboratively developing code, I'd want to
prettyprint yours into a style I prefer, and you'd do the same with mine.
This would open doors to collaborative programming. >>
I'm not sure about this. My thoughts about style are based on only 6 months
of experience with REBOL, and I have yet to find my REBOL "voice". What I
*am* finding, is that I use different styles in different contexts. The
style I use when writing in the Layout dialect is different than what I use
when writing in my FSM dialect. For pure REBOL code, I have some code that
is very much block style (style B) but I have other code which is very
concise.
I think that my goal will be to write code is that easily understood, and
easily maintained and I don't know that a single "style" will be the best
fit in all cases for REBOL code. For example, if you are writing a novel,
you would use a different style than if you were writing an instruction
manual or a "How To" booklet. Writing an article for a technical journal
would be different still. You may also have a large amount of data mixed in
with your code (think Easy-VID, or embedded instructions in an app), what do
you do with the data, style wise?
How easy something is to maintain doesn't necessarily mean that updates
requiring the minimum number of keystrokes are the best. I believe in making
the behavior and *intent* as clear and obvious as possible, which doesn't
necessarily lock you in to a single style with REBOL nearly as much as with
other languages, IMO.
If we go down the pretty-printer route, it will dissect a carefully
formatted program modeled on the idea of "Literate Programming" and possibly
destroy all the structure and meaning contained therein. Yes, that's an
extreme example, but I think REBOL will really change the way *I* write
programs (it already has) and eventually we'll discover more appropriate
tools, which aren't necessarily based on tools we've used for other
languages historically.
A pretty-printer could still be useful for a certain body of code, to be
sure, but there are wide variety of styles in the library and I don't think
the style someone used has anything to do with how easily I can decipher the
code. The overall organization of a script affects that to a much greater
extent. I.e. the more I have to keep in my head, which isn't visible on the
screen I'm looking at, the more difficult it is to decipher.
Just some thoughts from a baby REBOL. :)
--Gregg