United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4519021 : RFE: Addition of "and", "or", and "not" keywords

Details
Type:
Enhancement
Submit Date:
2001-10-24
Status:
Closed
Updated Date:
2001-10-25
Project Name:
JDK
Resolved Date:
2001-10-25
Component:
specification
OS:
generic
Sub-Component:
language
CPU:
generic
Priority:
P4
Resolution:
Won't Fix
Affected Versions:
1.4.0
Fixed Versions:

Related Reports

Sub Tasks

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
                                     
2001-10-25



Hardware and Software, Engineered to Work Together