Ruby aesthetics

Here’s my take on it (and one definition for “least surprise”)… i want
to be able to say exactly what i mean when programming, to be unambiguous.
This means to not only be objectively unambiguous, but subjectively
unambiguous. In terms of Ruby (or Perl) syntax, “unless” means the same
thing as “if not”. It is objectively unambiguous (and probably produces
identical code from the compiler). But in a subjective sense, “unless”
is clearer than “if not” in many situations. It implies that i expect
something to be false, rather than i expect it to be true.

All higher level programming languages are syntactic sugar. They exist
for the convenient understanding of human beings, not of computers. The
reducto ad absurdum position for language minimalists is to simply use
NAND for everything - after all, we can express all computer operations
with combinations of NAND gates. This is not to say that we should try to
solve every problem by adding new keywords, either (it’s been tried, and
called C++). To paraphrase an artist, expression is complete not when
there is nothing to add, but when there is nothing to be taken away. Is
Ruby more expressive because of “unless”, or less expressive? As long as
the meaning is both objectively and subjectively unambiguous, i’d say it’s
more expressive.

On a vaguely related note, i was working on a language for a while with a
friend of mine. My favorite contribution to the language was a keyword i
haven’t seen elsewhere… “forever”, to imply an infinite loop. So to
create an infinite loop, you would write

forever { … }

rather than

while(true) { … }

I have always found while(true) to be maddeningly indirect and
computer-geeky… surprising, in a bad way. The forever keyword makes
infinite loops explicit.

Needless to say, i approve of Ruby’s syntax.

William Djaja Tjokroaminata billtj@z.glue.umd.edu
09/10/02 09:54 AM
Please respond to ruby-talk

···

To: ruby-talk@ruby-lang.org (ruby-talk ML)
cc:
Subject: Re: Ruby aesthetics

Hi Dave,

Again, French and English have been very well established. I am not
proposing removing “unless” from Ruby, or using the “unless macro” in
C. But suppose we are designing a new language; we as intelligent human
beings, I think, should be able to answer the basic question, is it an
advantage or a drawback to have more varieties (like in Ruby) or bare
minimum (like in Python) in a programming language (which is by nature
different from a natural language)? I think this is significant, because,
in my opinion, Python gets its attractiveness from its minimalist
principle (“there is only one way to do it”), and also in my opinion,
there is no doubt that new programming language designers will emerge, and
they need to learn a lesson from history, just like Ruby learns a lot from
Perl, Smalltalk, Eiffel, etc. (I am not convinced, because of the Python
philosophy and experience, that the answer to this is simply “it does not
matter”.)

Regards,

Bill

Dave Thomas Dave@pragmaticprogrammer.com wrote:

There are phrases in French that are very useful, and yet which have
no direct English counterpart. Should we:

  1. Translate them word for word, and insert them in to English?
  2. Stop the French using them?
  3. Celebrate the fact that different languages are different and get
    on with the important business, which is using each effectively?

If you don’t like ‘unless’, then by all means don’t use it. If others
do, then I see no need to stop them.

Cheers

Dave

Just a remark: Ruby has “loop { }” which is the same as
your “forever”.

Regards, Christian

···

David.Stagner@mpls.frb.org wrote:

On a vaguely related note, i was working on a language for a while with
a friend of mine. My favorite contribution to the language was a
keyword i haven’t seen elsewhere… “forever”, to imply an infinite
loop. So to create an infinite loop, you would write

forever { … }

rather than

while(true) { … }

On a vaguely related note, i was working on a language for a while
with a
friend of mine. My favorite contribution to the language was a
keyword i
haven’t seen elsewhere… “forever”, to imply an infinite loop. So
to
create an infinite loop, you would write

forever { … }

rather than

while(true) { … }

I’ve seen something LIKE this years ago in c:

#define EVER ;;;

then, for(EVER) { … }

···

=====

Use your computer to help find a cure for cancer: http://members.ud.com/projects/cancer/

Yahoo IM: michael_s_campbell


Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute

I think I understand and I can accept everything that you wrote.

Let me try to pose the question differently. Suppose there is a new
language, and in concepts it is identical to Ruby. The only difference is
syntax (and hence the parser/interpreter), where minimalist keywords and
probably the identation syntax are adopted. Will the Ruby community like it?
(Probably no?) Will the Python community like it? (Probably maybe?) Will
people who never code in Python nor Ruby like it? (Maybe? Likely?)

Regards,

Bill

···

========================================================================
David.Stagner@mpls.frb.org wrote:

Here’s my take on it (and one definition for “least surprise”)… i want
to be able to say exactly what i mean when programming, to be unambiguous.
This means to not only be objectively unambiguous, but subjectively
unambiguous. In terms of Ruby (or Perl) syntax, “unless” means the same
thing as “if not”. It is objectively unambiguous (and probably produces
identical code from the compiler). But in a subjective sense, “unless”
is clearer than “if not” in many situations. It implies that i expect
something to be false, rather than i expect it to be true.

(…deleted…)

And REXX has the genuine article:

do forever

end

···

Christian Szegedy szegedy@nospam.or.uni-bonn.de wrote:

David.Stagner@mpls.frb.org wrote:

On a vaguely related note, i was working on a language for a while with
a friend of mine. My favorite contribution to the language was a
keyword i haven’t seen elsewhere… “forever”, to imply an infinite
loop. So to create an infinite loop, you would write

forever { … }

rather than

while(true) { … }

Just a remark: Ruby has “loop { }” which is the same as
your “forever”.


Steve

[ perl .sig suppressed ]

Hi –

···

On Wed, 11 Sep 2002, Steve Grazzini wrote:

Christian Szegedy szegedy@nospam.or.uni-bonn.de wrote:

David.Stagner@mpls.frb.org wrote:

On a vaguely related note, i was working on a language for a while with
a friend of mine. My favorite contribution to the language was a
keyword i haven’t seen elsewhere… “forever”, to imply an infinite
loop. So to create an infinite loop, you would write

forever { … }

rather than

while(true) { … }

Just a remark: Ruby has “loop { }” which is the same as
your “forever”.

And REXX has the genuine article:

do forever

end

I dunno… I was wondering which was more genuine. As David S. said,
“forever” implies an infinite loop. “loop” is an infinite loop.

:slight_smile:

David


David Alan Black | Register for RubyConf 2002!
home: dblack@candle.superlink.net | November 1-3
work: blackdav@shu.edu | Seattle, WA, USA
Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com