April 9, 2023

C#

C# (and perhaps even .NET) could be viewed as Microsofts response to Java and the JVM bytecode business. C# compiles to CLR (common language runtime), which is what the .NET infrastructure provides. C++ can be used on Windows platforms also. It compiles to machine code and is much faster than C#.

They like to say that C# is "component oriented" rather than "object oriented". The aim of all this is to facilitate "black box" use of components, which ends up downplaying inheritance.

I have always found inheritance to be cute more than useful, so I can get onboard with all this. There is more to it, as components seem to have an existence as binary entities, whereas objects get assimilated into a compiled executable.

C# on linux

The following link offers a download of Visual Studio Code for Linux

It offers me an RPM file (120M) and then takes me to the above getting started link.
I do this:
su
dnf install code-1.77.1-1680651749.el7.x86_64.rpm
They want you to watch their instructional videos. They miss the most important thing, namely how to launch it. It turns our typing "code" at the command line does the trick. (It turns out this is /usr/bin/code which is a symlink to /usr/share/code/bin/code). The videos are pretty bad. The guy could use a better microphone -- and the first thing he tells you do do is to type "Command-O", but my keyboard has no command key. Is he working on a Mac?

Try it on Windows

I have a Windows 10 machine handy. I wonder if that would be easier, cleaner, better for purposes of fooling around with C# (and even F#). I have no intention of doing any serious project with C#, I just want to get a feel for the language and learn a bit about what Microsoft is doing with .NET.

One likely plus is that I can get the actual Visual Studio IDE (Community edition). The Professional edition costs money, but the Community edition is free and should be more than adequate for my stated purposes. Note that even the community edition is not available for linux, despite many people clamoring for it.

What about F#

Fire up Visual Studio and tell it to create a new project. The first screen has a pull down menu for languages, use it and select F#. Select an F# console application. Give it a name (I name my first experiment "functional").
Away you go! Easy.

However, F# is not Haskell. It is not lazy and it is not pure -- but it is "more practical".

Vim plugin

This is getting way beyond what I need to work with now, but I want to save a link to this for later. Apparently there is a Vim plugin for VS Code and using VS Code in that way is not uncommon. Any straightforward search will turn up plenty of links.
Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org