So, I've been learning Rust recently. It's been a huge breath of fresh air for me. It's basically everything I've ever wanted in a community and programming language.. But wait, C# is pretty cool too... Well, let's take a step into why I find Rust to be so refreshing, despite me loving C#.

Linux as a first class citizen

Rust is supported on Linux as a first class citizen. This is in stark difference to .NET, where Mono seems to be the red headed step child. I love Mono. This website is running Mono. No matter how awesome Mono is though, it can never shake off the fact that .NET and C# is primarily driven by Microsoft, who would be glad if every copy of the source code of Linux was lost.

Xamarin is now the official steward of Mono. They seem to be much more focused on ensuring that their proprietary Mono support on Android and iOS continues to be awesome (which it is). It seems like the only advancement to Mono happens only because it happens to work on every platform.

Rust has financial backing from Mozilla. Mozilla has always struck me as one of those "good" companies. Some people would say this about Google, but I don't think making people into ads without consent is not evil. Mozilla has always been good about open sourcing nearly everything they do. And they do it under permissive licenses! The whole of Rust is under Apache/MIT license. Meanwhile, Microsoft is busy making sure that their licenses say can't be "run on a platform other than the Windows platform;"

Open Design. Open Community.

I joined the #rust IRC channel. I was quite shocked at how active it was. And how much discussion about the direction of the language itself happens on there. Again, this is the exact opposite of .NET and C#. Basically what happens with C# is Microsoft goes behind closed doors, tries to find things that need to be easier, and then when the next version of Visual Studio is due to come out, unleashes these changes on us. If we don't like the changes, that's too bad. Now, honestly, I must say that most of these changes are not necessarily bad. It's more the principal of the matter. It's like if C# was your wife (or husband) and your family had saved up money for three years to get a new car, and then C# went shopping with her ex from high school (Microsoft) and brought home a scooter and a gas guzzling Hummer. It's not that either one aren't useful in some circumstances, but that money (ie, time) could've been better used on something else.

And that's not even to mention the fact that Microsoft decided to send home with C# a mutt dog that shits on everything(ie, WinRT support in .NET). I for one do not like the direction Microsoft is taking .NET. In fact, with WinRT it looks like the Windows division had a secret plan to try to make .NET suck as much as possible. Obviously they want us to all be using C++, because all their advancement happened there.. oh and now C# can interface to C++ code easier... so you can port your existing C# code to C++. It seems like Microsoft is actively trying to prevent me from writing for their platform even. Sometimes I think they'd be happier if all the developers just went away and let them focus on making Word suck more.

Now, this rant has a point. Rust isn't like this. If I don't like a feature, I can talk about it in IRC.. and here is the amazing part, people will actually listen. Sure, the writers of C# and such hang out on Stackoverflow and answer design questions and such, but it's not like Microsoft is asking the community "well, what do you want?".. because if they had, then WPF probably wouldn't be dead in the water. But I digress.

Most of the stuff Microsoft develops that is open source, they don't really accept contributions to either. Recently (last year) they finally started accepting pull requests and doing development openly in ASP.NET MVC though. So, they're starting to move toward the right direction, but I won't be happy until .NET framework is completely open source.

Embrace the magic. Screw the magic.

There are two kinds of developers. The ones that prefer magic, and the ones that don't. I explicitly abhor magic in most cases. This is why I don't use ASP.NET MVC. Magic is the life blood of it!

Now, what do I consider magic?

Strings that somehow get translated to significant method or type names at runtime Using reflection to call certain hard-coded method names (that aren't part of an interface) Using attributes to define essential behavior.

I can hear the yells now. "Convention over configuration!" No, fuck your conventions. I want compiler errors, not runtime or logic errors.

Example, here is how to configure a route in ASP.NET MVC:

routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults );

Hmm, let's count the number of ways we could mess this up. Well, we might screw up the super magic names of "Home" or "Index". I think that the anonymous object's fields of controller and action are also significant. I don't know ASP.NET MVC. Personally, with something like intellisense at Microsoft's disposal, I don't understand why they chose such a dynamically typed way of doing this.

Magic isn't as bad in dynamically typed languages at least, because magic doesn't make you lose as much as in a statically typed language. This is why I'm not going to mention something like Ruby. I actually enjoy writing Ruby. When they do magic, I'm not losing the entire benefit of using a compiled and statically typed language. Instead, I'm just losing an easy understanding of how things work.

Rust, on the other hand, is designed from the very start that compiler errors should be given for everything that is probably wrong. They have an enormous focus on compile-time safety. They track your pointers and ensure a null pointer will never happen. Sometimes things are impossible to represent in this safe environment, so they also provide the unsafe keyword. The whole community seems to be chanting "compiler errors, not runtime errors". And for good reason. Compilers are powerful tools! They should verify that code will do what it is suppose to, not just spit out machine code

Just use Visual Studio. Oh, you're on Linux?

C# was never designed to be written outside of Visual Studio. With it's long names, magical code generation (in some projects), and official tool support for only MSBuild, it makes a lot of assumptions. This would be fine if Visual Studio worked on Linux, but it doesn't. The only choice for Linux is Xamarin Studio, or some crufty combination of Makefiles, MSBuild(for interop with Visual Studio), and a bit of insanity. And if you've never had the pleasure of using Xamarin Studio, let me just tell you first hand. IT SUCKS. It can get you through in a pinch, but in general, it sucks really bad. Apparently it doesn't use MSBuild natively, which causes interesting behavior sometimes. The UI doesn't obey themes properly, leading to a very ugly editor in my case. VI-mode is a running joke; and finally, it's #1 feature is that restarting it will fx it when it freezes.

Well, Xamarin is maintaining it, maybe it works better for their official platforms (Windows or Mac OSX).. erhm.. no, it doesn't. It sucks equally as bad there. The strange thing is that when it was MonoDevelop, it didn't suck quite as bad. I mean, the UI was a bit uglier (but did work properly with themes), it didn't support the new stuff like portable class libraries, and it was still pretty bad.. but I actually did not mind using it exclusively. It usually was good enough for me to not constantly be annoyed. Xamarin changing it into XamarinStudio was the worst thing that ever happened to it.

Rust, on the other hand, does not have an ulterior motive to drive the sales of a text editor. It's very easy to type, and very easy to use with many tools. I'm not going to say makefiles are perfect, but at least they work everywhere. Rust seems to follows the C style convention of keep names as short as possibly readable. (but you won't see names like atoi in rust, because the designers aren't Satan). I've been using Kate (due to it's awesome vi-mode) for Rust development. I constantly have to look at references because I'm still learning, but in general you seem to type less than C#. I do miss intellisense, though. It's a very useful feature when you're discovering methods and such of an object.

It's like C, except it's from this decade

Honestly, I've never had a big problem with writing C. I love the simplicity and the pure understanding I can have of the code I write. Also, it's nice to see a Linux-first platform. But I can't stand the cruft of actually trying to get things done in C. Function prototypes, preprocessor includes, no assistance with memory management... ugh. This is what makes Rust so awesome. It's like C, except for with all the cruft fixed, and with a few other awesome things added like closures and green threads. You can even use rust to write an OS kernel with just a bit of added assembly. Try doing that with C#..

Other languages?

To be fair, I did look at other languages. Some of these languages looked cool, but just didn't quite mesh with me like Rust did.

Go -- lacks generics and I don't enjoy some of the design decisions

Crystal-lang -- I actually looked at this and wanted to use it, but I couldn't get it to work and the community seemed rather lack luster.. and the language/compiler lacks an open source license

Something crazy and functional -- I've tried some functional languages.. they're pretty cool, but just not what I wanted right now

My dream of a language almost perfectly coincides with Rust

Compiles to native (no runtime)

Compiler errors, not runtime errors

Strong type system with duck typing

Has a strong generic type system

Generally embraces my "no magic" life style

Linux as a first class citizen

Could semi-easily replace C as a systems language

As you can see, Rust fits the bill pretty well. It's not perfect, no language is.. but it's the best I've seen yet

What now?

Well, I'm going to continue learning and using Rust. And I'll continue using C#, because it's what brings home the bacon.. but all of my open source effort will be toward Rust. Rust has a community I believe in and their ideals are something I can agree with. Some people like magic mixed with their static typing, and that's ok. Some people don't care at all about Linux support, and that's ok. I'll be over here though, using Rust, chanting "compiler errors not runtime errors" and using Kate on Arch Linux :)

So far, I'm working on learning Rust by trying to write something like my LucidMVC project, but in Rust, dubbed RustyMVC.