Re: RFC: coding standards document
| From: | Stig S. Bakken | Date: | Tue, 05 Dec 2000 23:52:56 +0000 |
| Subject: | Re: RFC: coding standards document | ||
| References: | 1 2 3 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-563@lists.php.net to get a copy of this message | ||
Chuck Hagenbuch wrote:
>
> Quoting Ulf Wendel <ulf.wendel@phpdoc.de>:
>
> > Is this a request for comment or a standard...
>
> It is a proposed standard.
>
> > > -------------
> > > [1] Indenting
> > > =============
> >
> > > Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR
> >
> > Tabs, size: 4 spaces as for the PHP C code.
> >
> > > ------------------------
> > > [4] Function Definitions
> > > ========================
> > >
> > > Function declaractions follow the "one true brace" convention:
> >
> > > function fooFunction($arg1, $arg2 = '')
> > > {
> >
> > function fooFunction($arg1, $arg2 = '') {
>
> Both of these could go either way, but I've had several people agree with #4 as
> written, and I think Stig weighed in in favor of spaces instead of tabs.
I can explain my reasoning a bit. My main problem with tabs is that
different editors have different tab widths, and even if you can
configure this, it's nice with source that is nicely formatted without
special editor configuration. Take this simple example with 5-space
tabs:
function foobar($arg)
{
[tab]printf("%d<BR>\n",
[tab][tab] $arg);
}
In an editor with 8-space tabs, it will be:
function foobar($arg)
{
printf("%d<BR>\n",
$arg);
}
And with 2-space tabs:
function foobar($arg)
{
printf("%d<BR>\n",
$arg);
}
If we just stick to spaces, it will look the same. I hope all the
editors that are in use here can use spaces instead of tabs.
- Stig