RE: [PHP-DEV] PHP 6.0 Wishlist

From: Date: Thu, 25 Aug 2005 08:11:47 +0000
Subject: RE: [PHP-DEV] PHP 6.0 Wishlist
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-18398@lists.php.net to get a copy of this message
if (2 < $x <= 4) {} Doesn't this collide with its current meaning: if ( (2 < $x) <= 4) {} i.e. parsing left to right, the true/false result of 2 < $x, is compared with <= 4. Changing the meaning could break some programs. Tex Texin Internationalization Architect, Yahoo! Inc. > -----Original Message----- > From: Jordan Miller [mailto:jmil@hymiegladstone.com] > Sent: Wednesday, August 24, 2005 4:38 PM > To: internals@lists.php.net > Subject: [PHP-DEV] PHP 6.0 Wishlist > > > I just joined this list and caught this thread (no suggestions like > this in the archive)... > > For v6.0... how about allowing comparison operator expressions like > the following: > > if (2 < $x <= 4) {} > > I prefer this concise way as it is common for mathematics > expressions, and much easier to grasp physically on first glance. > From what I can tell, this expression can currently only be > written as: > > if ( $x > 2 && $x <= 4) {} > > Would adding this syntax to PHP be incredibly difficult or lead to > performance slowdowns? > > I think I remember reading that PHP always evaluates > expressions from > right to left, so I guess there may be a considerable > codebase change > required. Maybe there could be a default function workaround > for this > or some other way to automagically process these more concise > expressions without too much of a slowdown?? Just curious. > > Jordan > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.internals (#18398) next »