[RFC] Coding guidelines: var keyword in js per line
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] Coding guidelines: var keyword in js per line
Okay, a better example:
What you're suggesting is the equivalent of suggesting that we have one global statement per variable in PHP. Nicer diffs, but not too logical.
What you're suggesting is the equivalent of suggesting that we have one global statement per variable in PHP. Nicer diffs, but not too logical.
- Erik Frèrejean
- Registered User
- Posts: 207
- Joined: Thu Oct 25, 2007 2:25 pm
- Location: surfnet
- Contact:
Re: [RFC] Coding guidelines: var keyword in js per line
Why don't you give a real argument against this proposal rather then "examples" which either don't have anything to do with the subject or that reflect on something that is already phased out?
As far as I'm concerned there is really no hurt, you just have to type 3 additional characters rather than 3 spaces to keep things aligned.
As far as I'm concerned there is really no hurt, you just have to type 3 additional characters rather than 3 spaces to keep things aligned.
Available on .com
Support Toolkit developer
Support Toolkit developer
- callumacrae
- Former Team Member
- Posts: 1046
- Joined: Tue Apr 27, 2010 9:37 am
- Location: England
- Contact:
Re: [RFC] Coding guidelines: var keyword in js per line
I don't see any advantages, and it isn't at all DRY.
Re: [RFC] Coding guidelines: var keyword in js per line
There isn't really an argument. Changing the style of your code so that the diffs are pretty isn't a good argument. If you minify the Javascript it will probably combine all of them into oneErik Frèrejean wrote:Why don't you give a real argument against this proposal rather then "examples" which either don't have anything to do with the subject or that reflect on something that is already phased out?
As far as I'm concerned there is really no hurt, you just have to type 3 additional characters rather than 3 spaces to keep things aligned.
var
statement so it doesn't matter there. You are using strict mode so global variables aren't an issue. It all comes down to what people prefer.Code: Select all
var a;
var b;
var c;
var d;
Code: Select all
var a,
b,
c,
d;
var
because it is quicker/easier to type. Really you shouldn't be adding 3 spaces since phpBB uses tabs (did this change?). Multiple var
statements add clutter that doesn't really add anything to the code.Eric
Re: [RFC] Coding guidelines: var keyword in js per line
-1
This RFC is an equivalent of putting each global declaration in PHP code on its own line, likebeing replaced withfor sake of cleaner diffs.
Does that PHP code make sense? No, it doesn't. Nether does this RFC.
This RFC is an equivalent of putting each global declaration in PHP code on its own line, like
Code: Select all
global $db, $user, $session, $whatever;
Code: Select all
global $db;
global $user;
global $session;
global $whatever;
Does that PHP code make sense? No, it doesn't. Nether does this RFC.
Formerly known as CyberAlien.
Free phpBB styles | Premium responsive XenForo styles | Iconify - modern open source replacement for glyph fonts
Free phpBB styles | Premium responsive XenForo styles | Iconify - modern open source replacement for glyph fonts
Re: [RFC] Coding guidelines: var keyword in js per line
+1Arty wrote:-1
This RFC is an equivalent of putting each global declaration in PHP code on its own line, likebeing replaced withCode: Select all
global $db, $user, $session, $whatever;
for sake of cleaner diffs.Code: Select all
global $db; global $user; global $session; global $whatever;
Does that PHP code make sense? No, it doesn't. Nether does this RFC.
Formerly known as Unknown Bliss
No unsolicited PMs please except for quotes.psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
Re: [RFC] Coding guidelines: var keyword in js per line
You completely misunderstood the proposal. Please read it carefully. wGEric correctly understood it:Arty wrote:-1
This RFC is an equivalent of putting each global declaration in PHP code on its own line, likebeing replaced withCode: Select all
global $db, $user, $session, $whatever;
for sake of cleaner diffs.Code: Select all
global $db; global $user; global $session; global $whatever;
Does that PHP code make sense? No, it doesn't. Nether does this RFC.
wGEric wrote:It all comes down to what people prefer.
OrCode: Select all
var a; var b; var c; var d;
Code: Select all
var a, b, c, d;
Re: [RFC] Coding guidelines: var keyword in js per line
I don't think I did. In JavaScript it is usual practice to declare each variable on its own line, so adding "var" to each line is equivalent to what I wrote.Oleg wrote:You completely misunderstood the proposal. Please read it carefully.
That is unless you wanted to suggest something else from that article you linked to. In that case please do elaborate, not just link to long article.
Formerly known as CyberAlien.
Free phpBB styles | Premium responsive XenForo styles | Iconify - modern open source replacement for glyph fonts
Free phpBB styles | Premium responsive XenForo styles | Iconify - modern open source replacement for glyph fonts
- bantu
- 3.0 Release Manager
- Posts: 557
- Joined: Thu Sep 07, 2006 11:22 am
- Location: Karlsruhe, Germany
- Contact:
Re: [RFC] Coding guidelines: var keyword in js per line
I support this.Oleg wrote:Each line in JS that declares variables should have its own var keyword, in order for diffs to not change irrelevant lines.
See also: http://benalman.com/news/2012/05/multip ... avascript/
Re: [RFC] Coding guidelines: var keyword in js per line
callumacrae wrote:Okay, a better example:
What you're suggesting is the equivalent of suggesting that we have one global statement per variable in PHP. Nicer diffs, but not too logical.
I would actually be in favour of that. However in new code we are no longer using global variables, and we decided not to rewrite large sections of code in 3.x for coding style reasons, so there's no point in doing that for global variables.Arty wrote:-1
This RFC is an equivalent of putting each global declaration in PHP code on its own line, likebeing replaced withCode: Select all
global $db, $user, $session, $whatever;
for sake of cleaner diffs.Code: Select all
global $db; global $user; global $session; global $whatever;
Does that PHP code make sense? No, it doesn't. Nether does this RFC.
On the subject of this RFC +1