Zeev Suraski wrote:
> 
> At 05:40 08-09-01, Chuck Hagenbuch wrote:
> >It's the kind of thing that gets used a lot in HTML, where otherwise there
> >wouldn't be a function call at _all_ - just static text. Replacing gettext()
> >with _() in this case actually does improve readability, in my opinion.
> 
> That's exactly what I said - there are several other
> functions/operators/labels which are used a lot and repeatedly, and we
> never made any exceptions as far as clarity goes.

_() is not documentated as function because it is an alias.

> > > >  It's documented, for what it's worth:
> > > >http://www.php.net/manual/en/function.gettext.php
> > >
> > > That's unfortunate.  IMHO, it should be phased out.

No, that would be the worst case you can do now, since _() have been
there since PHP 3.0.7. Look at the first character in:
        http://www.zugeschaut-und-mitgebaut.de/php or
        http://zend.com/phpfunc
in the alphabetical lists for PHP 3 and 4. Sure you can't see on most
monitors that the single character '_' is slanted and this means it is
an alias.

> >Exceptions in php extensions have been made before where the extension
> >mirrors
> >the c library exactly, in order to not confuse people familiar with the
> >library. This is another one of those cases - people familiar with gettext
> >will
> >be very confused if _() doesn't work the way they expect it to.
> 
> You're talking about exceptions in the naming convention?  Well, the more
> accurate way to describe it is that originally, modules tried to copy the
> low-level API function names 1::1.  Only at a later stage we started to
> strive towards a standard naming convention.  Today, when adding new
> functionality, the low level API function names play no role, and the
> functions are named using the PHP naming convention.  We explicitly decided
> that in the lengthy discussion about function naming convention that took
> place half a year ago or so.  There was no clear decision as to what to do
> with the existing functions that are named after their low-level counterparts.

To remove _() as alias is IMHO a bad idea. It would be better to use new
function names for the agreed function naming convention and make the
current function names an alias. The performance decrease would IMHO
less than the performance increase by switching to lowercase function
names.
 
> At any rate, this is not the kind of exception I was talking about.  _
> includes 0.0 information about what it does, and unless you know exactly
> what it does, you're lost.  It's not an issue of shortening words, or
> neglecting to put underscores between words.  Not only do you not stand a
> chance understanding what you're reading without looking at documentation,
> but you also have absolutely no way of finding what this does if you
> actually look it up in a manual.

Only gettext() is documented and not _(). For the underscores between
words in function names, compare the mysql functions with the pgsql
function names. This is really annoying if you switch from mysql to
pgsql and have to look up the correct function names, because you cannot
only substitute the prefix mysql_ to pg_.

-Egon

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to