News for hackers. Stuff that matters.
Re:Welcome to C# 9.0 by jrimbault on Wednesday May 20, 2020 @03:14PM (#23250600)
In C# I'd like to able to :

- declare a namespace for the file (no indentation)

- declare that the file is a class and can only contain one (top level) class (still no indentation)

- `using` statements that don't import every symbol into my namespace :

    using System.Console;
    ...
    Console.WriteLine();
instead of :

    using Sytem;
    ...
    Console.WriteLine(); // where does "Console" come from ? god/IDE only knows
But yes, no to top-level programs.

But alreay with these few changes, I've saved 10% of the 80 columns width. I've made it easy to read a file without an IDE. You can start to write actual code at indentation level 0. I've made it easy to have one class per file and hard to have two class per file, in the spirit of making good pratice easy and bad practice hard.

Re:Welcome to C# 9.0 by daeken on Wednesday May 20, 2020 @03:32PM (#23250783)
Totally agreed on all these, though I've personally gotten around the last one by making use of `using static System.Console;` -- then you can just do `WriteLine(...);`

It doesn't solve the fundamental issue, but it definitely makes things clearer for me.

Re:Welcome to C# 9.0 by kqr on Monday May 25, 2020 @01:48PM (#23303133)
Isn't this basically stuff F# nearly defaults too?
Re:Welcome to C# 9.0 by Mindless2112 on Wednesday May 20, 2020 @05:44PM (#23252224)
You can do

    using Console = System.Console;
Re:Welcome to C# 9.0 by jrimbault on Wednesday May 20, 2020 @06:11PM (#23252571)
The point is : the C# namespaces, default behaviors and general usage, are only half of a good idea. Effectively importing every symbol in a namespace into the local namespace by default is so obviously bad.

Yes you can do `using Whatever = System.Console;`, fantastic, that's not the common idiom and it is harder to do (longer to write) than the usual idiom.