Hacker News new | past | comments | ask | show | jobs | submit login
[flagged] Struct with “main method” as an entry point (tabsoverspaces.com)
15 points by cincura_net 8 days ago | hide | past | web | favorite | 18 comments

It's not clear to me what's interesting about this. main() is normally a member of a class but can also be a member of a struct. Is that it? Are there some consequences that I'm missing?

Reading the code I thought it was Java. Only the tags of the articles hint it is C#.

Why can't people state what language they are talking about in this kind of articles?

"Why can't people state what language" <> "the tags of the articles hint it is C#"

(This was an earlier version of Python.)

“doesn't equal” ≠ “is the opposite of”

Nor is it monoid composition.

fair enough

Normally I would agree with you, there are many instances of articles where the language/framework in question is just assumed to be known. However, in this case, the post is clearly marked ".NET, .NET Core, C#".

“Clearly marked” in muted small text.

"muted small text" directly below the headline.

Could it be more prominent? Yes. But it's not like the author didn't attempt to communicate the language context, and in that I argue, this blog is still doing better than many other.

This was the whole basis of C#'s grandaddy C++, was it not? Thinking "What if structs didn't just have data, but methods?" The Class was born, but it is basically still a superset of 'struct'. I guess the wrinkle here is that is specifically a main() but the article payoff singularly fails to deliver. "This compiles" is rather unenlightening.

Struct in C# means type has "by value semantics", whereas class in c# means "reference type", so the keywords have a quite different usage compared to C++, where it's about whether public/private is default. Still a frivolous and "so what" blog post though.

Apparently, everything can be a blog post today.

I understand your POV, but I did have a blog with tiny snippets of things that surprised me.

The blog is called tabsoverspaces...

I just went to the toilet.

Write a blog post about it, and post it here.

Well, now, this is the fundamental I/O question of life, is it not?

TFA concerns wild variations on the ingredients.

Somebody had to be the first one to put pineapple on pizza, and to put main() on a struct.

So everything is ultimately related.

This is not interesting in the least.

The author "discovered" that the static Main method in C# can live in either a class or a struct. However, this distinction does not matter as its simply a static member; the enclosing type is not instantiated by the runtime. In fact, the class that declares Main is idiomatically declared static since in general you don't need to create instances of it.

The author should find a more interesting topic before advertising his blog on HN.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact