I agree with Erb. Nontheless, "expression refactorings" would
be nice to be able to refactor expressions so they show the
intent or meaning most clearly (which of course, only the
progammer can decide).

Along these lines, it would be nice if one could select
a piece of a boolean expression and apply "de Morgan"
style refactorings:

!a && !b -> !(a || b) -> !a && !b

Don't know how useful this would be in practice,
but it sure sounds worth exploring...

My 2 cents.
-Thomas

> -----Original Message-----
> From: Erb [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 14, 2001 7:59 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [Eap-features] Code Style - parenthesize boolean
> expressions
> 
> 
> OK, but the idea of "simplified" is very relative with expressions.
> Some might say the first form is "simpler" (it has fewer parentheses,
> for example).  And it also depends on what you are trying to 
> "say" with the
> expression; if you translate the expression into human language, which
> way of saying it makes more "sense" in the particular case.
> 
> Thomas Singer wrote:
> 
> > I would like to see something like "simplify boolean expressions".
> > 
> > Example:
> > 
> > if (!(a == b && c != d)) {
> > }
> > 
> > would be simplified to
> > 
> > if ((a != b)
> >  || (c == d)) {
> > }
> > 
> > Tom
> > 
> > 
> > At 21:21 13.12.01 -0800, you wrote:
> > 
> >> +1
> >>
> >> We always try to use this style and not relay on operator 
> precedence.
> >>
> >> Tal
> >>
> >> > -----Original Message-----
> >> > From: [EMAIL PROTECTED]
> >> > [mailto:[EMAIL PROTECTED]]On Behalf Of Scott Sirovy
> >> > Sent: Thursday, December 13, 2001 7:21 AM
> >> > To: '[EMAIL PROTECTED]'
> >> > Subject: RE: [Eap-features] Code Style - parenthesize boolean
> >> > expressions
> >> >
> >> >
> >> > +1 -- This is another good code layout option.
> >> >
> >> > -----Original Message-----
> >> > From: Per Mellqvist [mailto:[EMAIL PROTECTED]]
> >> > Sent: Thu, December 13, 2001 8:44 AM
> >> > To: '[EMAIL PROTECTED]'
> >> > Subject: [Eap-features] Code Style - parenthesize 
> boolean expressions
> >> >
> >> >
> >> > I'd like an option in the Code Style settings to
> >> > insert parentheses in boolean expressions when not present.
> >> > Preferably with some added options for when to use spaces
> >> > (not in the innermost subexpr).
> >> >
> >> > The point of course would be to make the code easier to read,
> >> > and not have to try to remember all precedence rules to figure
> >> > out what goes on.
> >> >
> >> > A simple example
> >> >
> >> > if (a != null && !b.equals("") || c != 0) {
> >> > }
> >> >
> >> > would become (I hope:)
> >> >
> >> > if ( ( (a != null) && (!b.equals("")) ) ||
> >> >      (c != 0) ) {
> >> > }
> >> >
> >> > // Per Mellqvist
> >> >
> >> > --------------------------------------------------
> >> > DISCLAIMER
> >> > This e-mail, and any attachments thereto, is intended 
> only for use 
> >> by the
> >> > addressee(s) named herein and may contain legally 
> privileged and/or
> >> > confidential information.  If you are not the intended 
> recipient of 
> >> this
> >> > e-mail, you are hereby notified that any dissemination, 
> distribution or
> >> > copying of this e-mail, and any attachments thereto, is strictly
> >> > prohibited.
> >> > If you have received this e-mail in error, please immediately
> >> > notify me and
> >> > permanently delete the original and any copy of any e-mail and
> >> > any printout
> >> > thereof.
> >> >
> >> > E-mail transmission cannot be guaranteed to be secure or 
> >> error-free.  The
> >> > sender therefore does not accept liability for any errors or 
> >> omissions in
> >> > the contents of this message which arise as a result of e-mail
> >> > transmission.
> >> >
> >> > NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
> >> >
> >> > Knight Trading Group may, at its discretion, monitor and review
> >> > the content
> >> > of all e-mail communications.
> >> >
> >> >
> >> > _______________________________________________
> >> > Eap-features mailing list
> >> > [EMAIL PROTECTED]
> >> > http://www.intellij.com/mailman/listinfo/eap-features
> >>
> >> _______________________________________________
> >> Eap-features mailing list
> >> [EMAIL PROTECTED]
> >> http://www.intellij.com/mailman/listinfo/eap-features
> > 
> > 
> > 
> > _______________________________________________
> > Eap-features mailing list
> > [EMAIL PROTECTED]
> > http://www.intellij.com/mailman/listinfo/eap-features
> > 
> 
> 
> -- 
> 
> Erb
> 
> ==============================================================
> "The only time I like in the morning is afternoon."
>      - Russell D. Cooper
> 
> "If you do everything, then you're all done."
>      - Melissa F. Cooper
> 
> "Most of you are familiar with the virtues of a programmer.
> There are three, of course: laziness, impatience, and hubris."
>      - Larry Wall
> ==============================================================
> 
> 
> _______________________________________________
> Eap-features mailing list
> [EMAIL PROTECTED]
> http://www.intellij.com/mailman/listinfo/eap-features
> 

************************************ 
If this email is not intended for you, or you are not responsible for the
delivery of this message to the addressee, please note that this message may
contain ITT Privileged/Proprietary Information.  In such a case, you may not
copy or deliver this message to anyone.  You should destroy this message and
kindly notify the sender by reply email.  Information contained in this
message that does not relate to the business of ITT is neither endorsed by
nor attributable to ITT. 
************************************ 


_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

Reply via email to