JDK-4519021 : RFE: Addition of "and", "or", and "not" keywords
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2001-10-24
  • Updated: 2001-10-25
  • Resolved: 2001-10-25
Description

Name: rmT116609			Date: 10/24/2001



ISO C++ recognizes several "synonym" keyword tokens as part of the language;
ISO C provides a standard header file <iso646.h> which defines macros that
provide the same functionality as the C++ keywords.  This request for
enhancement deals specifically with three of those keywords: 'and', 'or',
and 'not'.

While I realize that Java is not C or C++, it still would be convenient to be
able to use keywords 'and', 'or', and 'not' in place of the existing logical
operators '&&', '||', and '!', respectively.   The intent is to render logical
expressions a little more human-readable.

    if (a > b  ||  !big  &&  a != null) ...        // old
    if (a > b  or  not big  and  a != null) ...    // new

Personally, I find the English words more immediately understandable than the
old C punctuation operators.

Note that this request does not advocate the adoption of the other ISO C++
synonym keywords (e.g., 'xor_eq').  The other operators ('~', '>', etc.) look
fine to me as they are.  Nor does this request advocate eliminating the
existing logical operators, but simply adding additional synonyms for them.

The drawback to this proposal, of course, is that it carries a low
benefits-to-weight ratio.  And adding the new keywords might break existing
code (though I think this is fairly unlikely).  This would probably be placed
in the "syntactic sugar" category.
(Review ID: 134396) 
======================================================================

Comments
EVALUATION Adding keywords is extremely disruptive in a widely used language. Adding them as pointless sugar is out of the question. ###@###.### 2001-10-25
25-10-2001