4 ms·
Consistency, mostly. It's all methods on classes everywhere else, why make it different here? Even with "top level statements" the startup code is wrapped in a
by SideburnsOfDoom 6y ago
Consistency, mostly. It's all methods on classes everywhere else, why make it different here?
Even with "top level statements" the startup code is wrapped in a "main" method, it's just compiler-generated in this case.
The CLR insists that code statements are always in method on classes, I believe. In cases where it appears otherwise (e.g. a lambda) the compiler is generating a wrapper class.
- emodendroket 6y agoBecause it’s just noise that doesn’t mean anything to me, so why keep it? Same as type inference, expression-bodied members, and other LOC savers.
- SideburnsOfDoom 6y agoSo you're going to go with a top-level entry point even with a substantial program? OK, I can see that happening. I guess the point is that your substantial program will also have plenty of classes and methods elsewhere, so the idea that "you can do a one-liner without having to first learn about declaring classes and methods and namespaces" isn't relevant to you. You save a few LOC 1 time over in your top-level entry point though. OK.
- emodendroket 6y agoYeah, true. I don’t find the “for beginners” thing too compelling but I do like the idea of removing boilerplate.
- SideburnsOfDoom 6y agoI think that MS is at this point fairly concerned with the "long game" for .NET, i.e. get the next generation onboard now, reap benefits for decades to come. Or equivalently they noticed that .NET wasn't "cool with the kids" and set out to fix that.