True crime

a year ago by tfm to c/programmer_humor

load all comments
cupcakezealot 30 points a year ago

i would say why would you just not to isAdmin = true but i also worked with someone who did just this so i'll instead just sigh.

also the real crime is the use of javascript tbh

path: 0 18801252, hotness: undefined, score: 30, children: 15
Lemminary 23 points a year ago

That's TypeScript. I can tell by the pixels defining a type above.

path: 0 18801252 18801371, hotness: undefined, score: 23, children: 14
Maiq 6 points a year ago

Was looking at it and could not figure out why their weren't any semicolon's.

path: 0 18801252 18801371 18803066, hotness: undefined, score: 6, children: 13
ScintillatingStruthio 13 points a year ago

Neither Javascript nor Typescript require semicolon, it is entirely a stylistic choice except in very rare circumstances that do not come up in normal code.

path: 0 18801252 18801371 18803066 18803965, hotness: undefined, score: 13, children: 12
Lemminary 13 points a year ago
Explanation for nerds

The reason is the JS compiler removes whitespace and introduces semicolons only "where necessary".

So writing

function myFn() {
  return true;
}

Is not the same as

function myFn() {
  return 
    true;
}

Because the compiler will see that and make it:

function myFn() { return; true; }

You big ol' nerd. Tee-hee.

path: 0 18801252 18801371 18803066 18803965 18804443, hotness: undefined, score: 13, children: 3
Ephera 9 points a year ago

That's terrifying, especially in JS where no type system will fuck you up for returning nothing when you should've returned a boolean.

path: 0 18801252 18801371 18803066 18803965 18804443 18804912, hotness: undefined, score: 9, children: 0
exu 5 points a year ago

Common JavaScript L

path: 0 18801252 18801371 18803066 18803965 18804443 18806393, hotness: undefined, score: 5, children: 1
Maiq 4 points a year ago

That's good to know. Don't know how I didn't know this. Been writing JS since 2000. Always just used them I guess. Ecmascripts look funny to me without them

path: 0 18801252 18801371 18803066 18803965 18804200, hotness: undefined, score: 4, children: 4
Lemminary 3 points a year ago

Same here. My brain interprets them as one long run-on sentence and throws a parsing error.

path: 0 18801252 18801371 18803066 18803965 18804200 18804490, hotness: undefined, score: 3, children: 0
ScintillatingStruthio 2 points a year ago

Fair enough, I like it better without but I don't have a strong preference and have no issue adapting to whatever the style of the repo is.

I learned about it researching tools to automatically enforce formatting style and came across StandardJS, which eliminates them by default.

path: 0 18801252 18801371 18803066 18803965 18804200 18821915, hotness: undefined, score: 2, children: 2
Ephera 2 points a year ago

Hmm, a webdev colleague said he'd normally prefer without semicolons, but used them anyways for better compile errors.

path: 0 18801252 18801371 18803066 18803965 18804904, hotness: undefined, score: 2, children: 2
ScintillatingStruthio 1 point a year ago

Interesting, I'm not aware of any way they would affect compile errors. I'd be curious to know more.

path: 0 18801252 18801371 18803066 18803965 18804904 18821925, hotness: undefined, score: 1, children: 1
programmer_humor
programmer_humor

@programming.dev

login for more options
33571
2550
7101

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn't find it funny, you're banned. Ha-ha!... For real: do not use the community for "statements". There are other places for such content. Keep it chill and funny.

go to feed...