There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

jeanma , in Golang be like

OP never said he/she commits such code but wants to iterate, test, explore.

Of course, unused var should not be part of a commit.

darvocet , in No Scrum - Parody of TLC "No Scrubs"

The third one with the hot voice is pretty cute.

DarkDarkHouse , in Golang be like
@DarkDarkHouse@lemmy.sdf.org avatar

As your future colleague wondering what the hell that variable is for, thanks Go.

MJBrune ,

A quick “find all references” will point out it’s not used and can be deleted if it accidentally gets checked in but ideally, you have systems in place to not let it get checked into the main branch in the first place.

Flarp ,

Yeah that should be looked for in a CI line check, not a compilation requirement

anemoia_one , (edited )

Yeah any compiler should support environments or config files. Our CI would never work with without –env “stage”

aport ,

You mean a system like the compiler

MJBrune ,

Or a linter. Or code reviews. Or anything else. The nice thing is that if the compiler doesn’t demand something, it can be given to the engineer as an option. The compiler should have the option to do it. The option could even be defaulted on. Afaik there is no way in Golang to disable that error (this is the line that does it: github.com/golang/go/blob/…/stmt.go#L67-L69). like --no-pedantics or such. Golang’s compiler openly refuses to give engineers more choices in what they think is the best system to handle it.

aport ,

Who needs an option to leave unused variables around the code base? Lazybones?

MJBrune ,

You’ve literally never commented out a line or two but left the variable declaration while debugging?

iforgotmyinstance ,

Changing it will bring down the entire system.

We’ve spent ten million dollars and do not know why.

Nioxic ,

Isnt the syntax highlighting it as mever used?

So why would they wonder?

Camilo ,

If it is a pure value, I’d assume yes, but if it is tied to a side effect (E.g. write its value to a file), then it would be not used but still could break your app if removed.

I’m not familiar with rust language specifically, but generally that’s what could happen

Willem ,

I prefer for it to be just a warning so I can debug without trouble, the build system will just prevent me from completing the pull request with it (and any other warning).

ennemi ,

If only there was some way the compiler could detect unused variable declarations, and may be emit some sort of “warning”, which would be sort of like an “error”, but wouldn’t cause the build to fail, and could be treated as an error in CI pipelines

CoderKat ,

Let’s not pretend people acknowledge warnings, though. It’s a popular meme that projects will have hundreds of warnings and that devs will ignore them all.

There’s a perfectly valid use case for opinionated languages that don’t let you get away with that. It’s also similar to how go has gofmt to enforce a consistent formatting.

ennemi ,

You can, if you want, opt into warnings causing your build to fail. This is commonly done in larger projects. If your merge request builds with warnings, it does not get merged.

In other words, it’s not a bad idea to want to flag unused variables and prevent them from ending up in source control. It’s a bad idea for the compiler to also pretend it’s a linter, and for this behaviour to be forced on, which ironically breaks the Unix philosophy principle of doing one thing and doing it well.

Mind you, this is an extremely minor pain point, but frankly this is like most Go design choices wherein the idea isn’t bad, but there exists a much better way to solve the problem.

iammike ,

Some people simply ignore warnings, that’s the main issue. Trust me, I saw this way too often.

If you cannot compile it than you have to fix it, otherwise just mark unused variables as ‘not an error’ via _ = someunusedvar.

masterairmagic , in Golang be like

Go is not a programming language. It’s an angry rant of a bored Google engineer.

AeonFelis ,

IDK, Brainfuck is still classified as a programming language and Go is not that far behind it.

lowleveldata , in The superior bracket style

ok cool do whatever you want. Imma put in a pre-commit hook to auto format everything.

sociablefish ,

im gonna install my own reformatter to reformat it back on my machine, win-win

katre , in Who is this "Jenkins" and what now has broken him?

Ha ha. I work on Bazel (a great build tools, bazel.build), and I agree 100%.

dingleberry ,

God I hate bazel/blaze.

katre ,

Thanks? I’m not sure why you wanted to share that with me.

lukini ,
@lukini@beehaw.org avatar

You shared randomly, they shared randomly. Balance in all things.

socsa ,

Hey buddy can you step over here, there’s a very tall cliff I want you to see

AzzyDev ,

Please ignore everyone else being unkind - I’m somewhat new to build systems in general, what are the advantages/disadvantages of Bazel compared to other build systems?

cthonctic , in No Scrum - Parody of TLC "No Scrubs"
@cthonctic@kbin.social avatar

It's very funny for sure and I was just about to share it with the other SWEs in our off-topic chat. But I just can't listen to it, had to close the tab after like 50 seconds. Perhaps on mute and with CC?

ericskiff ,

You made it 45 seconds longer than I did. Still waiting for my hair to stop standing on end.

cthonctic ,
@cthonctic@kbin.social avatar

I really tried hard to persevere - but I'm weak and it was too much.

bappity , in Pick a side Javascript
@bappity@lemmy.world avatar

NaN

Ddhuud , (edited )

!NaN

(Translation: I agree)

Rednax , in Golang be like

I hate this in C++ when it does this with parameters of an overidden function. I don’t need that specific parameter, but if I omit the variable name, I reduce readability.

Dienes ,

[[maybe_unused]]

Rednax ,

Which is have been able to use since we switched to C++17 … a couple of months ago.

newIdentity , (edited ) in Golang be like

Isn’t it the same with ESLint 6 (JavaScript/ES6)?

IUsedTo ,

I don’t believe so.

newIdentity ,

https://sh.itjust.works/pictrs/image/d379a67d-36d6-4694-b5ab-6fc7a3c1bbe9.webp

Are you sure?

(this is my work pc so wayyy to much work to make a screenshot and upload it)

peterj74 ,

That’s from ESLint, not javascript itself. JS doesn’t care about unused variables

newIdentity ,

That’s why I said ESLint

Exusgu ,

ESLint won’t prevent you from running your code, which is what the OP is on about. Hence the confusion in this thread.

newIdentity , (edited )

Oh it will. At least in combination with Vue. At least that’s the default. Of cause you can disable it.

killeronthecorner ,
@killeronthecorner@lemmy.world avatar

You’re describing many things that are not JavaScript the language. If you create and use tools that will stop you then yes they will stop you.

newIdentity , (edited )

I said ESLint. Not Javascript. ESLint is a linter for JavaScript. That’s why I put JavaScript in brackets. Some people don’t know what ESLint is. I’m talking about ESLint the whole time. Its not JavaScript specific but it’s mostly used for JavaScript

You yourself are talking about ESLint. You said that ESLint won’t prevent me from creating unused variables and functions when it clearly does. It won’t even run and throw an error

Edit: ohh it’s a Lemmy bug. The comment didn’t update yet. Originally I said “ES6” then I changed it to “JavaScript” and then I changed it to “ESLint (JavaScript)”

iByteABit ,

There’s a load of confusion in this thread.

What the post is about is compiler based clean code enforcement. JS doesn’t do this, but your editor in combination with ESLint prevents you from running the program. However this isn’t a general JS thing, just the way your setup works.

killeronthecorner ,
@killeronthecorner@lemmy.world avatar

Just saw your edit, and yeah, that makes sense as to the confusion.

Either way, your comment enquired as to whether it was “the same” and it still isn’t because for Go it’s a language feature and ESLint is not a language, it just allows you to create similar behaviour for JavaSvript which, by default, does not exhibit that behaviour.

jim_stark ,

JS simply does not care.

noli ,

Depends on your eslint config, but yeah that’s an option.

Dalinar ,

You’re confusing it with your linter. Java script don’t care.

newIdentity ,

That’s why I said ESLint

It’s a Linter for JavaScript. Some people might not know what ESLint is that’s why I put it in brackets

Darkaga , in No Scrum - Parody of TLC "No Scrubs"

Thanks for this, I'm sending it to my Scrum Master.

yum13241 , in Shower thought:

Speculative haxecution.

dipshit , in Golang be like

that’s just clean coding. use your fucking vars

asdfasdfasdf , in Pick a side Javascript

Any senior developer who says that should instantly get a demotion to intern.

ImpossibleRubiksCube ,

Followed by a public beating.

Kerrigor ,
@Kerrigor@kbin.social avatar

Forced to develop on Windows

HarkMahlberg ,
@HarkMahlberg@kbin.social avatar

Which part? Saying that it's simple, or making fun of saying that it's simple?

ImpossibleRubiksCube ,

We can do both. This is clearly not a laughing matter. 🤨😤🚬🔨🐖

HarkMahlberg ,
@HarkMahlberg@kbin.social avatar

Haha, ok I didn't see which community this was posted in.

Moc ,

There are two kinds of simple

  • Simple to learn to use
  • Simple to understand, and use at a complex level.

JavaScript is the first, but definitely not the second.

yads , in No Scrum - Parody of TLC "No Scrubs"

Hilarious

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines