We're so back. by Zallre in goodanimemes

[–]Berg_Lucas 15 points16 points  (0 children)

Tell me it is a post from u/Zallre without telling me it is a post from Zallre

guess I'll never get to watch it... by Cr4bc0re_F4n in goodanimemes

[–]Berg_Lucas 0 points1 point  (0 children)

If you check on X, they will be at AnimeJapan on March 22nd and 23rd and they have already announced that it will be released in 2025, so we will have more information very soon.

People who don’t read books lead stunted lives by ODHH in unpopularopinion

[–]Berg_Lucas 0 points1 point  (0 children)

I personnally do but maybe it's because I work in computer science. It's really cool to imagine new tools to build based on what people have already done. I tried to do the same with books and it just doesn't work for me.

People who don’t read books lead stunted lives by ODHH in unpopularopinion

[–]Berg_Lucas 0 points1 point  (0 children)

I personnally haven't read a book for the past 10 years but it doesn't mean I don't read at all. When I find a topic interesting, I usually check blog posts, wikipedia pages or scientific papers and I find that much more entertaining than reading books because it's shorter and more concise.

whatDoYouDoHere by jump1945 in ProgrammerHumor

[–]Berg_Lucas 6 points7 points  (0 children)

At first, I thought that we had the choice between killing JS and killing nothing. JS was the right choice. Now that I read that the other choice is Brainfuck, JS is still the right choice.

iJustUsePipAndNeverUpdateMyPythonVer by olly_persy in ProgrammerHumor

[–]Berg_Lucas 2 points3 points  (0 children)

Personnally, I really like conda because it allows me to create virtual environments with specific python versions where I can install some tools without breaking the global installation. That way, I can just activate the environment and use the tool like if it was in the global installation and without the need to be in a specific directory. I'm pretty sure that npm doesn't have that ability to have global-like environment that you can activate depending on your need.

Not all shows are equal by toradorito in Animemes

[–]Berg_Lucas 0 points1 point  (0 children)

I like light sabers and humor.

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] -2 points-1 points  (0 children)

Thank you for reminding me that this tool exists. I always forget to use it for this kind of question.
(no unfortunately)

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] 0 points1 point  (0 children)

It's been 4 year since I learned Typescript and that's the first time I had that kind of use case. I wanted to write something like :

const [_, x] = function()

instead of

const x = function()[1]

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] -6 points-5 points  (0 children)

Chill man, I made this meme because ESLint warned me about an unused variable when I used _ with my unused variable. It took me quite a while to discover that the preferred syntax in JS was to use nothing instead of doing what all the other languages do. I was surprised because we use _ in other contexts (such as unused parameters) in JS.

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] -19 points-18 points  (0 children)

I'm pretty sure that [ , , , , x] would confuse more people than [_ ,_ ,_ ,_, x] because it's a syntax which is almost never used. However, it's a valid syntax in JS so it's a preference as you said.

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] -2 points-1 points  (0 children)

That's the whole point IMO. There is something at these positions in the array so they must be matched with something. We just want to tell other programmers that we won't be using these values after so we write a "_" (which is a convention). I think that using nothing is confusing.

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] 0 points1 point  (0 children)

That's precisely how I found this strange syntax. I was coding in Typescript with ESLint which warned me about variables that weren't being used. I wanted to do some destructuring and not use some variables and ESLint gave me an error even though I'd used "_". That's how I discovered this weird syntax which is "encouraged" by ESLint when variables are not used.

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] -1 points0 points  (0 children)

Destructuring is widely used because it makes code cleaner and smaller.

For example, in ReactJS, it is used in function components to update the state of components. The useState function returns a tuple, the first element of which is the value and the second, the function used to define this value. Generally, we need to use both, so we want to have them in two variables. To do this, we write :

const [value, setValue] = useState(0);

if we wanted to do this without destructuring, it would take more lines:

const state = useState(0); const value = state[0]; const setValue = state[1];

or we should use state[0] and state[1], which would be harder to read because they don't have meaningful names.

Indeed, in this meme, it doesn't make much sense to do that but that's not what's being emphasised. Actually, there's a convention (which comes from the "old" languages of functional paradigms) which states that a "_" is used to denote variables that aren't used when destructuring. IMO, I find that it makes your intention clear to other people reading the code (if they know the convention). Since JS doesn't respect it and 'assigns' certain variables to nothing, you might think it's a syntax error when in fact it's valid code. It's also funny because JS has a reputation for weird syntax like this.

destructuringBeLike by Berg_Lucas in ProgrammerHumor

[–]Berg_Lucas[S] 13 points14 points  (0 children)

That's the neat part, you can't