News for hackers. Stuff that matters.
Re:A modern “Hello, World” program requires more than just code by sbilstein on Thursday March 05, 2020 @11:32PM (#22501016)
Real talk: is the comma in “hello, world!” necessary?
Re:A modern “Hello, World” program requires more than just code by emptybits on Thursday March 05, 2020 @11:50PM (#22501071)
Hello, sbilstein! ;-) It's considered grammatically correct.

> When the salutation in your letter or email starts with Hello or Hi, then you should put a comma before the name of the person you're addressing. It is also standard practice to put a comma after the name of the person you're addressing. ... You could also use an exclamation mark if you wanted to emphasize an emotion (like surprise). [1]

[1] https://www.grammar-monster.com/lessons/comma_with_dear_hell...

I'm not an expert but I've always seen it written this way and plenty of other sources suggest this practice. e.g. https://www.grammarly.com/blog/comma/

Re:A modern “Hello, World” program requires more than just code by Stratoscope on Friday March 06, 2020 @12:48AM (#22501268)
Modern English usage does not pay much attention to the traditional ideas of being grammatically correct.

The trend today is to omit needless punctuation. In the case of "Hello, world!" vs. "Hello world!", there is no one who would be confused by either version. The comma does not change the meaning at all, so you can include it or omit it as you prefer.

But take a look at one example of modern usage. If your name is Mike (like mine), which would you be more likely to see at the beginning of an email:

Hi, Mike,

or:

Hi Mike,

Pretty sure it will be the latter. In fact I can't remember the last time I saw this salutation with a comma.

(Edit: after writing that, I noticed that my last sentence is an example of what I'm talking about. I think the "grammatically correct" version would be "In fact, I can't remember..." - but many writers today would leave out that unnecessary comma.)

Edit 2: Hello, downvoter! ;-)

Gosh, does anyone write like that any more? It seems so archaic.

See, the thing about the comma is that it isn't a question of being "grammatically correct" or not. The purpose of the comma in modern English is to show where you would pause when speaking.

Which way would you pronounce it? "Hello world" just like any other two words in a row? Or "Hello <pause> world"?

The way you pronounce it is what should inform you about whether you write the comma or not.

Re:A modern “Hello, World” program requires more than just code by gibolt on Friday March 06, 2020 @12:04AM (#22501122)
Depends on your intent. If you are referencing a world when everyone can only say "Hello", the comma may be removed
Re:A modern “Hello, World” program requires more than just code by ganstyles on Thursday March 05, 2020 @11:43PM (#22501050)
Yeah! And while we're on the subject, is the ", World" even necessary?
Re:A modern “Hello, World” program requires more than just code by jfengel on Friday March 06, 2020 @09:13AM (#22503678)
It's cute. "Hello" is just greeting the programmer, as if it were one person to another. "Hello, world" is like a new baby introducing itself to a planet. It's both tiny and momentous; the contrast is humorous. That feels friendly.

Especially viewed in its original context, introducing a new programming language (C) to a planet that wasn't quite as crowded with programming languages as it is today.

Since then it's just tradition. Feel free to leave it out. But it's iconic for a reason.

Re:A modern “Hello, World” program requires more than just code by sk0g on Thursday March 05, 2020 @11:49PM (#22501063)
Traditions are traditions, and an industry as young as ours needs to hold on to the very few we have!

Moving goalposts around on the Hello World code golfing world has some 'consequences' - there's languages with built in hello world that try and get it printing with minimal code, and removing the comma, for example, would invalidate that hack.

Re:A modern “Hello, World” program requires more than just code by superasn on Friday March 06, 2020 @12:07AM (#22501130)
One tradition I'm happy got lost in the way is using FOO, BAR, BAT in examples. It made the simplest examples hard to understand and those words never made any sense to me.

It's always better to use contextual words in most examples.

edit: for more clarity this article (1) explains it quite well

https://dev.to/kiarathedev/why-i-don-t-use-foo-bar-baz-1kf7

Re:A modern “Hello, World” program requires more than just code by sk0g on Friday March 06, 2020 @12:12AM (#22501151)
I'd honestly rather have a,b,c than that! Nobody writes code with such placeholder variable names, so why demonstrate it that way?

Placeholder variables like i and j don't count! Foo, Baz, etc are annoying to read too, IMO.

Re:A modern “Hello, World” program requires more than just code by runarberg on Friday March 06, 2020 @12:33AM (#22501217)
I use foo, bar, baz, etc. all the time when I’m writing tests. But I agree generally it is better when examples use meaningful name `cd /path/to/file` as oppose to `cd /foo/bar/baz`
Re:A modern “Hello, World” program requires more than just code by kunglao on Friday March 06, 2020 @12:14AM (#22501160)
What's wrong with FOO? It's fun to say and can use it almost anywhere when you need a random word. Has saved me seconds here and there when I didn't need to think of a word because I have FOO :)