@wallhackio not an undergrad but purrsonally i just despise how if-elseif chains look
@aescling but switch statements add a bunch of indentation so for me it's picking your poison
@wallhackio @aescling Do they?
switch (some_enum) {
case VALUE1:
do_something();
break;
case VALUE2:
do_something_else();
break;
}
vs.
if (some-enum == VALUE1) {
do_something();
} else if (some_enum == VALUE2) {
do_something_else();
}
That's the same amount of indentation...
@vaporeon_ @aescling oh I have a skill issue it seems
@vaporeon_ @aescling I would always do it like
switch(gorp) {
case 'norp':
console.log('norp');
break;
case 'sorp':
console.log('sorp');
break;
default:
console.log(' what the gorp???');
break;
}
@wallhackio @aescling Cursed
Will not work in C
@vaporeon_ @aescling this is JavaScript
@wallhackio @aescling You can switch statement on a string in JavaScripts? Even though gorp and 'norp' don't point to the same address? ![]()
@vaporeon_ @wallhackio you wanna see some real fucked up shit? switch (true):
// the navbar links to every chunk of the gallery.
// the current page does not get a link.
// index 0 links to `/`.
/** @type {Node[]} */
const linksByIndex = [];
for (let i = 0; i < chunkedImages.length; i++) {
switch (true) {
case i === chunkIndex:
linksByIndex.push(li({ class: "active" }, `${i + 1}`));
break;
case i === 0:
linksByIndex.push(li({}, a({ href: "/" }, `${i + 1}`)));
break;
default:
linksByIndex.push(li({}, a({ href: `/${i + 1}.html` }, `${i + 1}`)));
}
}
@aescling @wallhackio Nooooooooooooooooooooooo
Just use an if statement at that point...
@aescling @wallhackio Seriously, why would you write this? I'd just write if (i === chunkIndex), else if (!i), and else...
@vaporeon_ @wallhackio i just irrationally hate if /else if /... that much
@aescling @wallhackio
Reported
@vaporeon_ @aescling I with vaporeon on this, I'm going to ask our admin to ban you
@wallhackio @vaporeon_ banning the syscatmin… sure that would go down well :P
@wallhackio @vaporeon_ when was the last time you actually had to complain to me that it was broken
@aescling @vaporeon_ I was hoping I could say "right now" but unfortunately it is currently functional
@wallhackio @vaporeon_ the issue was only ever that systemd was not configured to restart it after it got OOM-killed, and more broadly that i had configured the various components of mastodon in such a way that the server had to deal with memory purressure in the furst place
@aescling @wallhackio Surprised that you're using Systemd. Aren't you the runit or s6 or something like that user?
@vaporeon_ @wallhackio i don’t bother to set up services fur packages i installed from my package manager if they already come with systemd configurations
@vaporeon_ @wallhackio anyway yeah i use s6 otherwise
@aescling @vaporeon_ clearly propaganda