These are chat archives for arenanet/api-cdi

21st
Feb 2016
smiley
@codemasher
Feb 21 2016 21:13
Yoda or no?
if('strong' === $theForce){}

// vs.

if($theForce === 'strong'){}
darthmaim
@darthmaim
Feb 21 2016 21:25
imho no, $theForce === 'strong' reads better and IDEs add warnings anyway when you use if($theForce = 'weak')
smiley
@codemasher
Feb 21 2016 21:45
although Yoda has that cool jedi flair, i prefer the latter too.
i mean, you don't usually say "blue the sky is." unless you're a 24/7 yoda cosplayer or so XD
Pat Cavit
@tivac
Feb 21 2016 22:13
we explicitly ban yoda-style because it's hard to read
smiley
@codemasher
Feb 21 2016 22:16
what about egyptian-style braces?
smiley
@codemasher
Feb 21 2016 22:18
haha, you stalker you :D
Pat Cavit
@tivac
Feb 21 2016 22:24
:+1:
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:00
Disallow space after keywords? But..why? D:
Why not? :3
IMO consistency is the only thing that matters
then again, our C++ coding standards are pretty much the opposite of the JS ones
(but very few people write both C++ and JS, so it doesn't matter too much really)
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:32
if(true) vs if (true)...Unless I'm code golfing, I prefer the latter XD
smiley
@codemasher
Feb 21 2016 23:33
you also intend with 4 spaces? XD
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:33
I actually agree with that!
@Eearslya code golfing? if(expr)stmt vs expr&&stmt.
Former is an additional character.
smiley
@codemasher
Feb 21 2016 23:33
i didn't actually say that i use spaces for intendation... :D http://lea.verou.me/2012/01/why-tabs-are-clearly-superior/
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:35
This is one of my only serious attempts at code gold
..golf*
#define P(a) putchar(a), b,e,f;main(a){scanf("%d%d%d%d",&a,&b,&e,&f);for(;;)scanf("%*d"),f==b?:f>b?P(78)f--:(P(83)f++),e==a?:e>a?P(87)e--:(P(69)e++),P(10)0;}
smiley
@codemasher
Feb 21 2016 23:35
:+1:
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:35
..Where did that comma come from
oh wait it's supposed to be there. right.
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:36
But there was supposed to be a newline
@codemasher spaces make more sense when a per-line character restriction exists
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:37
But yeah, I legitimately could not find a way to make that code smaller.
smiley
@codemasher
Feb 21 2016 23:37
@lye
then again
why does a character ber line restiction exist in first place?
like... 80 :D
you're asking some really hard questions here
I think ours is 78 actually
I just have visual studio configured to draw a line :/
(this is for C++, JS standards don't have that restriction)
smiley
@codemasher
Feb 21 2016 23:38
i wonder if those peole who make those coding guidelines are still working on 640x480 screens
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:39
Nah, the 80-character limit isn't so much because of screen space
It's in place nowadays to prevent coders from doing too much in 1 function
smiley
@codemasher
Feb 21 2016 23:39
(ikr)
codemasher @codemasher uses a loose line length of 140
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:40
I actually read up on common C/C++ guidelines..One of the rules they mentioned was along the lines of "If you need more than 3 indents, you're doing it wrong"
smiley
@codemasher
Feb 21 2016 23:40
which fits perfectly into the IDE with all panels open on a 1920 screen :D
@Eearslya thats a good one^^
should be a rule in JS :D
I need more than 3 indents to draw Mt. Fuji.
(though I guess that was HTML)
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:46
I should do more code golf stuff; it's pretty fun
smiley
@codemasher
Feb 21 2016 23:47
btw. this channel is a thing! https://gitter.im/chillerlan/gw2hero.es
Eearslya Sleiarion
@Eearslya
Feb 21 2016 23:49
Oh, I lied, one more code golf thing I did
main(e){int a,b,c,d,n;a=5527;scanf("%d",&n);for(;n;n--){d=0;scanf("%d",&c);if(c<0)d=1,c=0-c;if(c<=a)b=(a==c?0:d),a=c,e=0;}if(e)a=0;if(b)putchar('-');printf("%d\n",a);}