4 ms·
Aren't top level programs basically "baby mode" for relatively simple programs or web webassembly based examples that target beginners? As far as I've heard it
by tester34 6y ago
Aren't top level programs basically "baby mode" for relatively simple programs or web webassembly based examples that target beginners?
As far as I've heard it does not exist e.g when it comes for ASP and I believe that what "OP" meant.
I may be very wrong here
- GordonS 6y agoI haven't used C# 9 yet, but I write a lot of console apps and services/daemons using .NET Core (the world is bigger than web apps :), but I don't see why you can't use top-level programs for ASP.NET Core apps, as they have an entrypoint too. You would of course still have all the usual ASP.NET configuration and DI setup to do though, so the impact would be rather limited.
- nathanaldensr 6y agoMy understanding of this feature is that it's to encourage beginners to write code that does something without first having to learn about namespaces and the entry point concept. I expect most commercial apps and open-source projects will continue to use namespaces and an entry point method in their code.
- whizzter 6y agoExactly! And on top of that I've mentioned in many conversations how teaching Java and C# as a first language often confuses people into believing that programming is about syntax rather than logic, because they spend so much time searching for syntax errors in their first hello world application. For hello world with 29 tokens if i count correctly for C# vs 4 tokens for a Python program, guess where beginners have an easier time to fail?
- elboru 6y agoIt’s also great for testing concepts or libraries, “what happens if I call this object like this or like that?” I used to use LINQPad for that, now I don’t need to, VS Code and this new feature is enough!
- jve 6y agoDon't you guys think that entrypoint is only 0.0000...1% of your development time? Not having to write Namespace, class, main method (which comes in template anyway), is not something I would use to compare languages. Its nice for beginners, not having to explain every weird word they see, but not much for professional development. However managing complexity with various language features all over the project makes impact.
- recursive 6y agoIf you're working on the same code-base for years, then yes. If you write a few programs per day for throw-away data manipulation or system maintenance or something, then no.
- jpalomaki 6y agoMaybe they were thinking about REPL, scripting and Jupyter style notebooks. Having this feature aligns nicely with those use cases.