Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11014 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95111 invoked by uid 1010); 9 Jul 2004 06:48:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 93518 invoked from network); 9 Jul 2004 06:47:57 -0000 Received: from unknown (HELO mx.thebrainroom.net) (69.55.226.195) by pb1.pair.com with SMTP; 9 Jul 2004 06:47:57 -0000 Received: by mx.thebrainroom.net (Postfix, from userid 517) id 51E2B1488035; Thu, 8 Jul 2004 23:47:57 -0700 (PDT) Received: from BAUMBART (p508EBB70.dip.t-dialin.net [80.142.187.112]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mx.thebrainroom.net (Postfix) with ESMTP id 03E2C1488033; Thu, 8 Jul 2004 23:47:53 -0700 (PDT) Date: Fri, 9 Jul 2004 08:48:00 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <233337039.20040709084800@marcus-boerger.de> To: Marc Richards Cc: internals@lists.php.net In-Reply-To: <20040708233326.73283.qmail@pb1.pair.com> References: <5.1.0.14.0.20040707203931.02fa6200@mail.ionzoft.com> <40ED64A0.7050305@cschneid.com> <20040708151952.92187.qmail@pb1.pair.com> <20040708215205.23281.qmail@pb1.pair.com> <20040708222005.4329.qmail@pb1.pair.com> <20040708233326.73283.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on jc.thebrainroom.net X-Spam-Status: No, hits=0.8 required=5.0 tests=PRIORITY_NO_NAME autolearn=no version=2.63 X-Spam-Level: X-TBR-Filter: Virus scanned and defanged Subject: Re: [PHP-DEV] what happened to that new isset() like language From: helly@php.net (Marcus Boerger) Hello Marc, Friday, July 9, 2004, 1:33:02 AM, you wrote: > Rasmus Lerdorf wrote: >> On Thu, 8 Jul 2004, Marc Richards wrote: >> >>>Rasmus Lerdorf wrote: >>> >>>>On Thu, 8 Jul 2004, Marc Richards wrote: >>>> >>>> >>>>>Does it? There are other similar constructs that don't e.g. +=, $a ? $b >>>>>: $c, .=; >>>> >>>> >>>>These have roots in other languages and as such have a familiarity to >>>>them. ?: would be a brand new operator nobody has seen before and one >>>>that looks a lot like the ternary operator which everyone knows about. >>>> >>> >>>We can always create a name for the construct (in the same way the >>>ternary statement has a name) and properly document it. If it becomes >>>useful and popular, people will start calling it that. Proper >>>documentation doesn't require an actual function name. >> >> >> That wasn't my point. The point was that every operator in PHP is common >> and known to the majority of people familiar with any other language. You >> are proposing adding a new operator never seen before. Giving it a name >> won't help because how will people know this name? > They won't. Not until they hear about it or read about it. But that is > true whether it is a function or and operator. Making it a function > won't make everyone magically cogniscent of it. Of course it will be > important to make it easy to search for information about it on PHP.net, > which includes allowing people to search for ?: and providing a courtesy > link from the ternary operator section. >>The way you name an operator is to make it a function. > Huh? I must be misunderstanding what you mean to say, because as far as > I can tell that just isn't true otherwise we would have functions like > add(), subtract() and ternary(). >>>>>I think that part of the reason that these things are so terse is >>>>>because if would defeat the whole point to use a function name; The aim >>>>>is to be concise. >>>> >>>>No, the aim is not conciseness. That has never been PHP's goal. The aim >>>>is clarity. >>> >>>I wasn't saying it was a PHP goal, I was it is the goal of certain >>>constructs like += or .= >> >> >> += is not unique to PHP in any way. Pick 10 random mediocre PHP or >> non-PHP developers out of a crowd and ask then what += does and I bet a >> good number will be able to tell you. Do the same with ?: and you will >> first have to carefully explain that no, this is not the ternary ? : >> operator, but rather a single ?: operator and then ask them to guess at >> what it might do. How many do you think will figure it out? >> >> We don't do things to save people typing a couple of extra characters here >> and there. We do things to lower the WTF factor of the language as much >> as possible. The overall design from the very beginning has been to meet >> the expectations of the common developer. The common developer expects >> common operators such as += ++ -- != to do the right things. > Are you saying PHP will never introduce an operator that doesn't already > exist in a large number of other languages? >> Not having >> these would give us a high WTF factor. Nobody in the world expects a ?: >> operator which is not the ternary operator. And having such an operator >> would indeed be a big surprise and as such its WTF factor is high. >> > To be honest I am kinda hot and cold about how close it is to the > ternary operator. On the one hand the two could be easily confused, but > on the other hand they are in fact very similar in function in which > case we could "market" (meaning document) them as being related. > Ternary operator: > $a = $b ? $b : $c; > Compound Ternary operator: > $a = $b ?: $c; > The only asymmetry being that the "compound ternary operator" doesn't > throw and error if !isset($b) whereas the regular one does...deal > breaker? I dunno. AND ?: won't be ternary....the whole reason for that operators name is that obviously noone had a good name for it. But since it is the only ternary operator (at least in all the languages i know) everybody calls the construct ternary operator. -- Best regards, Marcus mailto:helly@php.net