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? The way you name an operator is to make it a function. > >>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. 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. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php