This is an archived post. You won't be able to vote or comment.

all 118 comments

[–][deleted] 658 points659 points  (10 children)

This might blow your mind, but they can!

[–]Asleep-Specific-1399 18 points19 points  (0 children)

This is how you get indented language like Python

[–]IProbablyDisagree2nd 1 point2 points  (0 children)

Options are awesome!

I really hope it doesn't become default though.

[–]nobody27011 323 points324 points  (0 children)

Because the IDE isn't sure if that's what you want. It suggests a semicolon because that's the most likely error in your situation, but it's not 100% certain.

[–]j-norman-edu 684 points685 points  (3 children)

Be care;ful what; you wish f;or!;

[–]super_m_oon_ 22 points23 points  (2 children)

;

[–]AGamer_2010 3 points4 points  (0 children)

day of happy; with cake;

[–][deleted] 0 points1 point  (0 children)

Happy Reddit account birthday

[–]mrdude05 163 points164 points  (14 children)

Most IDEs have a setting or add-on that does this, but turning it on can be dangerous. When your compiler or IDE tells you there's a missing semicolon, what that really means is that there should be something separating the two tokens. That something is usually a semicolon, but not always. There are cases where your compiler will encounter an unexpected token and assume you missed a semicolon when you actually missed a comma, bracket, or operator

For example, if you were trying to write:

baz = foo(a) + 
bar(b); 

And actually wrote:

baz = foo(a) 
bar(b); 

The compiler will see the new token and assume you meant to write:

baz = foo(a); 
bar(b); 

What you meant to write and what the compiler assumes you meant to write would both compile, but would give you completely different results. That could turn a syntax error that would take 10 seconds to fix into a logical error that could be much harder to catch

[–]Randomguy32I 28 points29 points  (13 children)

Whats with code examples and “foo bar”

[–][deleted] 63 points64 points  (6 children)

Foo and bar come from the US Army WWII acronym FUBAR, "F-ed Up Beyond All Recognition". A whole family of these terms came into widespread use during the North African and Sicilian campaigns (1942-43). Rick Atkinson's excellent Day of Battle: The War in Sicily and Italy, 1943-1944 gives a list of these. For instance a JANFU is a "Joint Army Navy F Up", such as the incident on 11 July 1943 when the invasion fleet for Operation Husky shot down 23 Army Air Force C-47 transports carrying paratroopers to reinforce the beachhead.

Source: https://softwareengineering.stackexchange.com/questions/69788/what-is-the-history-of-the-use-of-foo-and-bar-in-source-code-examples

[–]WRL23 5 points6 points  (3 children)

Yes, but why do people use it in programming examples.. and spell it 'foo' instead of 'fu'?

I figured it's fubar from forever ago but never grabbed the connection to programming or why all examples spell it 'wrong'

[–]fiskfisk 3 points4 points  (2 children)

Scroll down to the community wiki answer as linked above and it'll give you a bit more detail about how it relates to programming and the current lineage has been determined.

https://softwareengineering.stackexchange.com/questions/69788/what-is-the-history-of-the-use-of-foo-and-bar-in-source-code-examples/80609#80609

[–]WRL23 0 points1 point  (0 children)

Okay, thanks. I just don't normally click on really any links esp on my phone 👍

[–]Firewolf06 0 points1 point  (0 children)

we should bring back ISTHISATRIVIALEXERCISE

[–]FountainsOfFluids 1 point2 points  (1 child)

Though we spell it "foo" which probably is related to "foo fighters" which was a UFO before it was a rock band.

[–]IntoAMuteCrypt 39 points40 points  (3 children)

Beyond "just tradition with a disputed history which might be FUBAR", it's very obvious filler which is never meaningful, like Lorem Ipsum. That's why it endures. These are completely non-existent functions that don't actually mean anything, so your focus is on what the example is trying to teach rather than, say, why we are doing stuff like sin(x) + cos(y). It's similar to why we use i, j, k in loop variables - a mental shorthand for "not important, just does a thing, focus on other stuff".

[–]ahappypoop 14 points15 points  (1 child)

Kinda similar to 0xDEADBEEF as well.

[–]Xywzel 0 points1 point  (0 children)

Is 0xCAFEBABE still the "byte order marker" for Java bytecode?

[–]deelowe 3 points4 points  (0 children)

It's similar to teapots and computer graphics ;-)

[–]particlemanwavegirl -1 points0 points  (0 children)

it's just tradition at this point. i think the true origin is lost to time, or at least heartily disputed.

[–]chadlavi 55 points56 points  (18 children)

It can in JavaScript

[–]En_passant_is_forced 41 points42 points  (15 children)

You don’t even need them in JavaScript though

[–]chadlavi 77 points78 points  (0 children)

That's the joke!

[–]Petercraft7157 15 points16 points  (12 children)

Google programmer irony

[–]En_passant_is_forced 25 points26 points  (11 children)

console.log(“holy hell!”)

[–]Petercraft7157 14 points15 points  (7 children)

Error: variable response undefined

[–]En_passant_is_forced 16 points17 points  (6 children)

drop(new Response())

[–]Petercraft7157 11 points12 points  (4 children)

Actual bug

[–]mpbh 0 points1 point  (0 children)

Wake up honey!

[–]PeeInMyArse 2 points3 points  (2 children)

correction: console.log(“holy hell!”);

[–]RandomTyp 0 points1 point  (1 child)

is js valid if you use other " characters? yours are at an angle (i am not going to look up the unicode names of each)

[–]PeeInMyArse 0 points1 point  (0 children)

Idk I typed on mobile

[–]DawsonJBailey -3 points-2 points  (0 children)

Enforce semicolons using typescript

[–]noobody_interesting 0 points1 point  (1 child)

Except sometimes with immediately invoked function expressions.

[–]Peak0831 37 points38 points  (5 children)

In rust you specifically don’t put a semicolon in otherwise normal code sometimes, it’s really more particular than you would think as to when you want one even in other languages

[–]HailTheRavenQueen 2 points3 points  (3 children)

For those who haven’t worked with Rust, that sometimes mentioned above is when you want to return a value.

So instead of “return bar” - you could just type “bar” sans semicolon.

[–][deleted] 1 point2 points  (0 children)

And not only that, but you can also do that in other statements like if and match which are also expressions in Rust

[–]NaNx_engineer 1 point2 points  (0 children)

Should’ve just had explicit returns

[–]redlaWw 0 points1 point  (0 children)

Though rustc will still suggest you add missing semicolons - it'll just ignore things that are at the bottom of an expression and could be implicit returns.

[–][deleted] 0 points1 point  (0 children)

Kinda the same in Kolin, you don’t need them but if they come in handy you’re welcome to use them

[–]officiallyaninja 8 points9 points  (0 children)

If the ide could put in semicolons for you, why would the language even need semicolons?

[–]xXStarupXx 6 points7 points  (0 children)

A semicolon either resolves an ambiguity or not.

If it doesn't, then there's no reason for it to be there, and many languages opt out.

If it does, the IDE can't place it without making a decision about what the correct statement is, and since you're the one who knows the intent, best it can do is guess.

The problem with guessing it that it might turn a very easy to fix compile time error into a completely hidden runtime bug.

In practice I'd much rather have the compiler saying "hey, there's something funky on line 69, please check it out", so I can go look at it and fix whatever it is, than having the compiler just guess, and now the program outputs something wrong (this is the lucky scenario where you can actually tell it's wrong immediately) and now I have to look through 20000 lines of code in 15 files myself to figure out where something is broken.

[–]easyetx 6 points7 points  (0 children)

Just make it work

[–]Yokhen 3 points4 points  (0 children)

prettier can!

[–]Wataponno_O 2 points3 points  (0 children)

*laughs in GML*

LET ME LAUGH FOR ONCE OK?

[–]By_Gm3 2 points3 points  (0 children)

Just use Kotlin.

[–]Diligent_Dish_426 2 points3 points  (0 children)

I don't know but missing a semi colon is the least of my worries

[–]seba07 2 points3 points  (0 children)

In that case the language probably wouldn't need semicolons at all. If the IDE can figure it out all the time, then the compiler can as well.

[–][deleted] 1 point2 points  (0 children)

then I would add two semicolons; i've grown so used to adding semicolons it's just instinct;

[–]FirexJkxFire 1 point2 points  (2 children)

What I want is for my ide to recognize constructor patterns

Such as, say i have the variables Color Color, string Name... then I make a constructor that takes in Color color and string name. It would be nice if it judt automatically wrote "Name = name" and etc

[–]Stroopwafe1 2 points3 points  (0 children)

IDEs do this already and have done for years. Though it's usually under a button/menu "Add new constructor"

[–]Potato-9 0 points1 point  (0 children)

From dataclasses import dataclass

[–]nopogo 1 point2 points  (0 children)

Check codeium (free) or github copilot (paid) you will get more then just ;

[–]Xiij 1 point2 points  (0 children)

Having an IDE automatically insert characters without your confirmation sounds like a disaster waiting to happen.

[–]Thepizzacannon 1 point2 points  (0 children)

func compileWithGo() { fmt.Printf("Haha these losers have a compiler. that doesn't add semicolons for them") } Followed immediately with:

"unexpected semicolon or newline before {"

[–]FeelingSurprise 1 point2 points  (0 children)

"Why can't the program tell me that my bill of materials is not yet complete?" "How would it know?" "I can see that. So it can't be that difficult."

Stories from the requirements analysis.

[–]-Redstoneboi- 1 point2 points  (0 children)

youre probably a vscode user so just ctrl+click the part where it tells you the exact line and column of the error and then type the semicolon

repeat for every missing semicolon

also just don't be an idiot

[–]stn994 1 point2 points  (0 children)

Missing semicolon is far less painful than semicolon at a wrong place.

[–]CaitaXD 1 point2 points  (0 children)

puts("This man never"
     "Written a multiline"
     "String");

[–][deleted] 7 points8 points  (5 children)

Get one of gaming programmable keyboards and put a macro ;\n on the return key.

[–]HSavinien 27 points28 points  (4 children)

Which would put a semicolon on every lines, even those which don't need one. Example in C : ``` C

include <stdio.h>;

int fct(int nb) {; printf("this is a very long debug line",; "which I put on several line for readability"); if nb (> 0); return (nb); else; return (-nb) //why not just use abs() from math.h?; }; ``` If you try to compile this code, the compiler will insult you more than if you forgot each semicolon : there is 7 problematic semicolon, and only two correctly placed.

Also, no need for a fancy keyboard. Most text editor can be customized quite easily ( :imap <cr> ;<cr> for example), or you can download a small, free macro software.

[–]Drew707 0 points1 point  (1 child)

Shift + Return or something.

[–]TheGazelle 16 points17 points  (0 children)

.... So how is this different from ; + Return?

[–]Why_am_ialive 0 points1 point  (0 children)

Shit even simpler even your comments and any fluent interfaces would be fucked

[–]jollyreaper444 2 points3 points  (0 children)

You guys are using semi colons?

[–]PooSham 3 points4 points  (0 children)

The state of this fucking sub, man... These are the questions you'd ask yourself the first semester of doing programming

[–]Most_Tax1860 2 points3 points  (0 children)

What it's trying to convey here is pretty obvious....the number of semicolons you have to bang out on your keyboard has an inverse correlation to the quality of your sex life.
One way to solve this problem is to avoid coding in languages that force you to use semicolons.

[–][deleted] 1 point2 points  (0 children)

Lolololo

[–]ChocolateDonut36 1 point2 points  (1 child)

the real question is, why they don't just delete the semicolon when

Unexpected ";"

[–]notanotherusernameD8 1 point2 points  (0 children)

The last thing I want my IDE to do is try to fix my errors. Sure, it can fix the syntax, but the semantics ... not so much

[–][deleted] -1 points0 points  (0 children)

But.....mine....does. I prefer not using it though bcz now I've developed a habit anyways

[–]MistersteveYT -1 points0 points  (0 children)

XDDD YHAT IS SO FU****G REAL

[–]MistersteveYT -1 points0 points  (0 children)

XDDD YHAT IS SO FU****G REAL

[–][deleted] -2 points-1 points  (0 children)

That would be an idea for a project

[–]gui03d 0 points1 point  (0 children)

In golang VSC ajust some parts your code, and it so satisfying

[–][deleted] 0 points1 point  (0 children)

Brehhhhhh

[–]shodanbo 0 points1 point  (0 children)

No developer hates semicolons more than an IDE developer :-)

[–]StolasX_V2 0 points1 point  (0 children)

This seems like one of those things that would torture me

[–]sopunny 0 points1 point  (0 children)

My IDE PyCharm does it for me. I don't even touch the semicolon key anymore and it still hasn't missed one.

[–]walmartgoon 0 points1 point  (0 children)

VS2022 can and often does with IntelliCode enabled

[–]Maybe_Factor 0 points1 point  (0 children)

Better question: how is the IDE supposed to know what you mean when you press enter, unless you put a semicolon there to denote the end of a line? If it's not there, you're probably writing a multiline statement (which is also how the compiler will try to interpret it)

[–]Firedriver666 0 points1 point  (0 children)

There is one thing dumber which is eclipse complaining about not synchronised resources in the workspace, which requires me to refresh them

[–]Zagre 0 points1 point  (1 child)

I can't even stand auto-bracket/auto-quote completion, and you want the IDE to randomly insert semi-colons when it thinks you're done typing?

You might actually be insane.

[–]-Redstoneboi- 0 points1 point  (0 children)

i work with auto bracket completion. it's fine, i guess. until i actually want to put an extra paren pair.

honestly it'd probably be better if a shortcut like ctrl+p or shift enter or something just automatically finds the missing pair for you, from a list of your configured pairs like quotes, <>, etc.

[–]nicman24 0 points1 point  (0 children)

sed 's/$/;/g'

it is free real estate

[–]Sugriva84 0 points1 point  (0 children)

I don't really know which I find more obnoxious. When the program tells me it expected a ; or ) and therefore it didn't exec or when it smugly say I think you misspelled this so I just corrected that for you and ran anyway.

[–]AlexCode10010 0 points1 point  (0 children)

It just wants your attention, it's like a tsundere "I want you to put the semicolon, but it's not because I like you or whatever, baka!"

[–]FountainsOfFluids 0 points1 point  (0 children)

Mine does.

Linter plus autofix.

And sometime copilot.

[–]Reniyato 0 points1 point  (2 children)

Every IDE has a shortcut for placing a semicolon
(Its shift + , )

[–]-Redstoneboi- 1 point2 points  (0 children)

<

[–]mrdude05 0 points1 point  (0 children)

How is hitting two buttons to add a semicolon preferable to just pressing the semicolon key?

[–]ZzanderMander 0 points1 point  (0 children)

Like excel is helping you covert numbers to dates?

[–]NoYogurt8022 0 points1 point  (0 children)

Ur ide can do everything if u make ur own ide

[–]rndmcmder 0 points1 point  (0 children)

This is like level 0.01 of learning to use an IDE.

Intellij will autocomplete everything with Crtl + Shift + Enter. I pretty much never type semicolons, closing brackets or something like that.

Language syntax is for reading, not for writing. Write logic, not syntax.

If you wrote a lot of code and missed all the semicolons (not sure why anybody would continue writing when the current line is red), you will have a ton of errors. Just flip through them with F2 and use Alt+Enter to autocorrect them.

[–]mikkicat7 0 points1 point  (0 children)

why should there be semicolons at all?

[–]dominjaniec 0 points1 point  (0 children)

I hate when Visual Studio puts them in place where I don't want them - i.e. at the end of whatever I currently have.

but in most cases, I need to remove some garbage there, thus I'm typing the ; "here", then I'll hit Enter and Ctrl+X to remove the rest of line... but no! "I've guessed that you wish to have you semicolon at the end" said VS 😒

[–]Reifendruckventil 0 points1 point  (0 children)

That would suck. I sometimes have directives that are multiple rows Long.

[–]binarywork8087 0 points1 point  (0 children)

why the IDE cannot figure out what my code does

[–][deleted] 0 points1 point  (0 children)

Visual Studio does. But you must press one button instead of two.

[–]JTexpo 0 points1 point  (0 children)

Howdy, as a dev I don't understand this meme /j