On Jan 31, 12:14 pm, "Robert Miller" <rsmil...@[EMAIL PROTECTED]
> wrote:
> "Jeff M." <mass...@[EMAIL PROTECTED]
> wrote in message
>
>
<news:8975c441-5b74-4a30-906c-d39c96b56e95@[EMAIL PROTECTED]
>...
>
> > I think it's im****tant to distinguish well factored code vs. "compact"
> > code via a language "feature". Both are useful for different things,
> > but "compact" code leads to Perl (left to the reader to decide if
> > that's good or bad). Well factored code can be done in any language,
> > but I find that Forth actively encourages it through negligible
> > performance costs of calling functions.
>
> If you want truly compact code, try APL. Unfortunately, in the case of
APL,
> the compactness came with serious readability issues due in part to its
use
> of a special character set. I believe it was Dijkstra who said something
to
> the effect, 'There is even A Programming Language whose proponents
delight
> in showing their collegues a line of code with the challenge, "You'll
never
> guess what this does"'. (And typically that line of code performed a
> substantial task.)
Sure, but my (perhaps poorly expressed?) point was that compact !=
better, factored == better. Factored code is still brief and many
times more readable. Compact is just brief, and often unreadable. I've
never looked at APL, but I'm curious now. :)
Many times, brevity comes from libraries as well. For example,
consider this example in REBOL:
send me@[EMAIL PROTECTED]
"Hello, world!"
That's brief, and does quite a lot of work under the hood. Is it
anything spectacular? Not really, because everyone knows there's
really a ton of code behind it; nothing magical is going on. With a
similar library in Forth I could easily code the same thing:
s" Hello, world!" email< me@[EMAIL PROTECTED]
> send-email
It's equally brief, just as readable, and there's just as much code
that exists underneath it, making it possible. In the end, stating
that a language is "compact" means nothing by itself. It's either
syntactically compact - typically resulting in write-only code - or
has a large foundation of functionality allowing for a large amount of
work to be done with as few function calls as possible.
Languages like Lisp and Forth are very good for two reasons: first,
they actively encourage factoring in many ways (which ends up leading
to very readable and terse code at the highest level) and second, they
are extensible, meaning if you really need to add syntactic sugar for
brevity/readability, that's possible as well.
Jeff M.


|