From: John Pane <[EMAIL PROTECTED]>
Part of an experiment I did during my Ph.D. research looked at the
readability of unless clauses at the beginning or end of a statement.
Users were significantly more accurate when the clause was at the end.

It's not clear that this actually addresses Russel Winder's question
about Groovy.  Let me explain why (maybe) not.

1.  That research was about designing a programming language for
    children, and the experimental subjects were therefore
    >> non-programmers <<.  Some of the subjects said they had
    programmed, but the paper gives no indication of how much,
    to what degree, or in what language.

    One expects that most of the people dealing with Groovy will
    have had previous experience with programming and will know
    that it _really_ isn't English.

2. English and many other languages exploit a feature called 'ellipsis'.
    For example,
        count the cars from Georgia and Louisana
    is a CORRECT way to ask for
        #{c | c is a car and (c is from Georgia OR c is from Lousiana}
    in English because it is an elliptical form of
        count the cars from Georgia and [
        count the cars from] Louisiana.
    Unfortunately, it's ambiguous, and relies on human intelligence
    to figure out where the gaps are and how to fill them.

    The study used ENGLISH WORDS for the logical operators
    AND, OR, NOT.  It is far from obvious that such confusion
    would carry over to symbols such as &&, ||, !.  (It's also
    far from obvious that it wouldn't.)

3.  On the specific topic of placement of unless, the paper says
    "The participants performed significantly better with the
     Unless clause at the end than they did with the Unless
     clause earlier in the statement.
     HOWEVER, given that [Unless didn't actually help much],

I don't mean to slight the research.  It's important that research
like this be done, and the choice of participants &c were all
appropriate to the questions the project was designed to answer,
namely "what would be good for a children's language".  ALL that
I am saying here is that it's not clear that the results are
relevant to Groovy.  To the extent that they are, then the
answer would be "people will prefer putting unless at the end,
but it won't improve their programs."

I note that there is just a trace of this in Ada, where the
loop exit statement is
        exit [when Expression];
So there is another alternative in the middle:
        allow [if/unless Expression]
        on control transfers such as method return and
        loop exit *only*.

Reply via email to