Blog

New stuff coming in C# 7.0

Mads Torgersen wrote a blog post highlighting what’s new in C# 7.0:

C# 7.0 adds a number of new features and brings a focus on data consumption, code simplification and performance.

The changes all seem to be in line with the recent trends of borrowing syntax sugar from other languages to C#. Nothing wrong with that: copy what’s good and shed what’s bad.

One of the changes is related to out variables. These are the C# way to deal with not being able to return multiple values (see below for good news on that front). It’s basically the same as passing by reference in, say, C. For instance:

int myOutVar;
changeMyOutVar(out myOutVar);

You could have the value of myOutVar set inside changeMyOutVar. Simple. What is changing in C# 7.0 is that you would no longer need to predeclare myOutVar:

changeMyOutVar(out int myOutVar);

The scope of the new variable will be the enclosing block. I have to say it: I don’t like it. It feels obfuscated to me. The variable doesn’t look like it should be in that scope. Compare with this popular Go idiom:

if err := DoSomething(); err != nil {
    return err;
}

The variable err is created inside the if and its scope is there as well. I know a lot of people who hate this for the same reason I don’t like the way the new out variables are to be created in C#. I find it much more clear in Go though.

The feature I absolutely loved to read about is tuples. Error handling in .NET is often done with exceptions, which I find clunky and cumbersome. With tuples, we might be able to move to something more Go-like:

(User, bool) FindUser(string username) {
    var found = _userList.Find(u => u.Username == username);
    if (found == null)
        return null, false;
    return found, true;
}

So we could do something like:

var (user, ok) = FindUser("someusername");
if (!ok) {
    // user not found, deal with this
}

Check his post for more features.

Millie 0.9.6, or “installers are hard”

I’ve been terribly busy with work lately and so I haven’t really had much time for my side projects. I did however managed to get a new version of Millie out of the door.

Got get it here.

Changes are mostly infrastructural though.

User “visible” changes:

  • Add .deb installation files for Linux
  • Add support for electron-builder
  • New settings system
  • Fix missing icon on Win64 installer
  • Split generation of 32- and 64-bit installers on windows

Minor changes and fixes

  • Merge branch ‘builder’ of github.com:robteix/millie
  • Ignore backups
  • Add missing dependency
  • Ignore main.js.map
  • Remove warning on unknown props
  • Cleanup
  • Move background declaration to MillieView
  • Stop loading old settings
  • Add script to generate release files
  • Remove log file left from first commit

That said, this release reminded me of how hard installers are to get right. Actually, they’re hard to do at all.

MacOS installers can basically only be made on macOS due to there not seeming to be decent implementations of DMG anywhere else. You can compile and create a ZIP file with your binaries, sure, but who wants that? To create a nice DMG, you need to be on macOS.

Windows is also hard to do in other systems. Not impossible, just annoying. You can get by with Mono in Linux or macOS but you need to get around a bug here and there. It works though.

Linux installers (meaning .dpkg and .rpm) are easy to do in macOS but barely doable on Windows.

In practice you end up having to create each installer on its own environment. Linux and Windows are easy to do with VMs, but you’ll need a macOS box eventually.

Windows has its own share of problems though. I hear they’re working on finally fixing their dumb limitations on path length but it’s definitely not there yet. This is important when working with things like npm that create paths hundreds of levels deep. Trying to something simple like deleting a node_modules directory on Windows is an exercise in frustration.

The installers for this release were all created in a Linux VM though. It was the closest thing I got to building it all in a single platform. No DMG for macOS though.

I’m sad today

So this is me today.

640px-Sad-pug

Years ago, my wife and I had a friends couple we worked with for some years. Someday they stopped talking to us. They refused to answer our calls or answer our emails. They never accepted out friend requests on Facebook.

We never knew why.

This happened over 10 years ago so naturally life moved on. From time to time, it happens that I see something from them on Facebook seen as we have a lot of friends in common, but neither of us acknowledges the present of the other.

I recently joined a Slack team and to my (and I’m sure his) surprise, my former-friend was there as well. Over the course of the next few weeks, we’d be talking in the same channel to other people but again, never directly to each other. I wanted to but I knew he was mad at me for something and I didn’t want to force it. What I did try doing was to engage in the channel as if nothing ever happened, just like everyone else.

But it was unconfortable. There was always that elephant in the room. So last Thursday I send him a message in private. I told him I never knew what I had done but that I apologized for whatever it was. I told him that he didn’t have to forgive me but I would really appreciate knowing what it was.

But he wouldn’t answer. So today I decided that there was no point in making two people uncomfortable all the time and I left the channel.

In the end, it’s no big deal. As I said, this was something that happened (whatever it was) over 10 years ago. But it makes me sad that I’ll never know what I did wrong.

(Image CC-BY-SA by Wikimedia Commons)

Une lettre ouverte à la madame qui a pointé son doigt vers ma fille

Conscient du fait que mon français n’est pas très bon (j’apprends), je pense cependant qu’il est important de l’écrire dans cette langue, car vous m’avez fait savoir que toute autre langue n’est pas acceptable.

Il y a quelques jours, j’étais chez un restaurant Valentine avec ma fille de six ans. Nous y étions allés parce qu’elle adore leur hot-dog et puisqu’elle avait fait un super effort à l’école ce jour-là, j’avais décidé de la récompenser. Vos raisons pour y être doivent être encore plus mondaines que ça.

Nous sommes arrivés au Québec depuis moins de trois mois et ma fille est toujours en train d’apprendre le français. Et bien qu’elle s’efforce de se faire comprendre par un monde qui ne la comprend pas, elle a encore des difficultés. Elle devient souvent frustrée. Et pourtant elle persévère. Sachez que je suis très fier d’elle.

Elle venait d’entrer à l’école avant les vacances d’été, juste pour apprendre le français. Un jour, les élèves devraient avoir un examen de mathématique et les enseignantes avaient décidé de sortir ma fille de la salle pour continuer à étudier le français. Ma fille a commencé à pleurer et supplier. Les enseignantes ne comprenaient pas pourquoi. Ils m’ont alors appelé et je suis allé à l’école. En y arrivant, nous avons finalement compris : elle se croyait punie et elle ne savait pas ce qu’elle avait fait pour le mériter. Elle implorait le pardon. C’est de ce genre de situation à laquelle elle doit faire face tous les jours.

Encore une fois, elle a six ans.

Elle a perdu toutes ses amies. Elle a dû laisser presque tous ces jouets. En tant que père, ça me brise le cœur de la voir en regardant des autres enfants qui jouent, parce que je sais qu’elle veut jouer avec eux, mais elle est souvent gênée à cause du français.

Je suis certain que vous serez d’accord avec moi quand je dis que ça n’est pas facile pour un adulte, et encore moins pour une petite fille. Mais elle fait un vrai effort là et je suis tellement fier d’elle. Vraiment fier.
Et c’est pour cette raison qu’il m’a fait tellement mal quand vous avez décidé de lui réprimander de ne pas parler français avec son papa.

Elle jacassait comme d’habitude quand vous l’avez interrompue pour me dire qu’il fallait parler français au Québec. Ça m’a surpris un peu, mais j’ai commencé quand même à vous expliquer qu’elle apprenait. Vous avez décidé de m’ignorer et de pointer votre doigt à une petite fille et de crier « en français ! »

Je suis un nouvel arrivant et je n’avais aucune idée, à ce moment-là, comment réagir. Je ne savais pas si vous auriez l’appui du reste des gens chez le restaurant ou pas. Mon instinct était juste de protéger ma fille de vous. Ma petite fille qui se protégeait derrière moi, intimidée par une madame qui partait en colère pour quelque chose qu’elle ne comprenait pas.

Et pourquoi ?

Je vous demande, madame, c’est à quoi exactement que vous vous attendiez ? Je comprends que vous considérez votre langue importante. En général, j’appuie l’idée que tout le monde doit être capable de se communiquer en français au Québec. Je pense que c’est absolument juste que personne ne vous demande de parler l’anglais ou d’autre langue, quelle qu’elle soit. Vous êtes au Québec et le français devrait être suffisant pour y vivre. Je suis d’accord avec tout ça.

Mais si ma fille veut parler à son papa en sa langue maternelle, qu’est-ce que vous avez à voir avec ça ?
Essayez de vous mettre dans notre place. Essayez de vous imaginer à un autre pays. Est-ce que vous arrêtiez de parler français avec vos enfants ou votre conjoint ? Soyez honnête.

Je ne sais vraiment pas ce que vous pensiez à réussir, madame, mais ce que vous avez réussi à faire c’est de me faire repenser le Québec et les québécois. Vous m’avez fait me demander si les québécois sont tous des colons. C’est ce que vous avez réussi, madame.

Mais même là, vous avez échoué.

Lorsque vous êtes partie, des gens chez le resto sont venus s’excuser de vous. Une femme a donné à ma fille des crayons et une feuille de papier pour qu’elle puisse dessiner afin d’arrêter de pleurer.

J’ai donc conclu que non, vous ne représentez pas le Québec. La plupart des québécois avec qui j’ai eu le plaisir d’interagir m’ont traité avec respect. La plupart des québécois avec qui j’en ai parlé m’ont dit la même chose : vous, et ceux comme vous, avez perdu la guerre. Vous êtes une relique d’un passé honteux de cette belle province. Vous représentez le passé.

Ma fille est l’avenir. Deal with it.

Philae Lander signing off

And so ends one of the most exciting science missions in recent years. The team at ESA managed a remarkable feat while also engaging the rest of us emotionally. Great job to all involved.