Razzi's guide to csharp
csharp is a programming language that is a lot like java.
csharp repl
There’s a repl built into Mono called csharp.
Install it on debian as follows:
$ sudo apt install -y mono-csharp-shell
$ csharp
Mono C# Shell, type "help;" for help
Enter statements below.
csharp> Console.WriteLine("HI")
HI
csharp> "a string here".Split()
{ "a", "string", "here" }
mono versus dotnet
If you go to the Mono homepage, you see this scary looking deprecation message.
A bit of history here is that csharp and dotnet (.NET) grew out of Microsoft’s proprietary .NET Framework. Xamarin was a company that developed C# toolchains for non-microsoft platforms (such as linux).
Eventually Microsoft bought Xamarin, and deprecated Mono to push its own newly-crossplatform .NET Core. They then handed off maintenance of the Mono project to Wine.
All I really want for C# is a repl to tinker around with while I do things like develop Unity games using C#.
So for my use case Mono actually fits better, since it comes with the csharp repl out of the box which works well.
Dotnet has its own command line program called dotnet and you can use that to install things like
dotnet-repl.
However that application is … gaudy, complete with blinking cursors, and it doesn’t have the conventional Unix-like command line keyboard shortcuts.
(This is one of the longstanding issues with C# - it’s split between Windows and non-windows, and tends to prioritize windows)
So I’d rather keep using Mono and csharp and not choose C# at all if I can avoid it. It’s quite a feat of engineering that with the CLR (Common Language Runtime) you can use different programming languages, but Java also has its ecosystem of languages and Python + c is a better ecosystem and programming environment in my opinion.
They lost me when they advertised cross-language inheritance … I’d rather use composition and plain data objects.
So when I put the link to the source code here, I’m linking to the Wine mono repository, since that is what I’m most likely to use. To Microsoft’s credit, they did standardize C#, which is part of what enabled Mono in the first place.
standard
https://ecma-international.org/publications-and-standards/standards/ecma-334/