Slightly disappointed in Nemerle

I've been coding with Nemerle a bit during the last couple of months. I've discovered that I had set my expectations too high. It doesn't quite live up to them. Might be as much my fault as Nemerle's, but that doesn't really change anything.

I was hoping for a experience closer to OCaml (only with better cross platform library support) than I got. With OCaml, once your code compiles, you know you are doing pretty good. With Nemerle, not so much. First of all, it feels like you get to fight a bit more with the type inferer than in OCaml. This is probably partially due to the maturity of the implementation, partially due to the fact that with OCaml, I didn't use as serious class hierarchies as I do with Nemerle, thanks to the .NET standard library and heavier Gtk+ usage.

The second problem I've encountered is that when you interface a lot with C# code, you don't really get much mileage out of the functional stuff in Nemerle. When you have a List generated in C#, you don't get to fold over it. While Nemerle does have the ICollection interface extending System.Collections.Generic.ICollection with all the functional iteration tools, there are no wrapper classes and no standalone functions. If you want a foldable List, you'll have to copy stuff. Not nice.

And third, while the variables are by default non-mutable, which is nice, and when you define your types in Nemerle you can do matching and get the safety that brings, you end up interacting so much with .NET code that you have to do the normal null checks all over the place anyway.

In short, the benefits of Nemerle over the current features of C# are feel pretty limited. Maybe it would be better if you were working with pure Nemerle projects, but at least interacting with C# eliminates most of them.

Making Emacs understand ncc errors

Add this to your .emacs or equivalent to make Emacs' compilation-mode make proper links out of the Nemerle compiler's error messages:

(setq compilation-error-regexp-alist 
    (append compilation-error-regexp-alist 
            '(("^\\(.+\\):\\([0-9]+\\):\\([0-9]*\\):\\(?:[0-9]*\\):\\(?:[0-9]*\\):" 
            1 2 3))))

Update:

Or even better, using rx (thanks to this hint for reminding me about it):

(setq compilation-error-regexp-alist 
      (append compilation-error-regexp-alist 
              `((,(rx line-start 
                      (group (1+ (not (any ":"))))
                      ":" 
                      (group (1+ digit)) 
                      ":" 
                      (group (1+ digit)) 
                      ":" 
                      (*? digit) 
                      ":" 
                      (*? digit) 
                      ": ") 1 2 3))))

C# export for Gaphor

Gaphor is the best free UML tool for X I've seen yet. It's far from finished but at least it produces pretty graphs. I started writing a C# export plugin for it. The first somewhat working version is available. This has been developed with 0.10.4, no guarantees of it working with any other version. No guarantees of it working with that version either, to be exact, but at least it works for me.

Extract it inside Gaphor's source directory, in gaphor/data/plugins.

© Juri Pakaste 2021