
Struct with “main method” as an entry point - cincura_net
https://www.tabsoverspaces.com/id/233805
======
andyjohnson0
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?

------
Iv
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?

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

(This was an earlier version of Python.)

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

~~~
alipang
Nor is it monoid composition.

------
feintruled
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.

~~~
nmeofthestate
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.

------
marpan
Apparently, everything can be a blog post today.

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

------
tobyhinloopen
I just went to the toilet.

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

~~~
smitty1e
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.

------
nathanaldensr
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.

