←back to thread

143 points todsacerdoti | 3 comments | | HN request time: 0.847s | source
Show context
nate_martin ◴[] No.43594464[source]
>The compiler itself is to be developed in OCaml.

These seems like a misstep that I've seen in a few other compiler implementation courses. For some reason these programming language professors always insist on completing the project in their personal favorite language (Haskell, OCaml, Standard ML, etc).

As a student this makes the project significantly more difficult. Instead of just learning how to implement a complier, you're also learning a new (and likely difficult) programming language.

replies(6): >>43594528 #>>43594754 #>>43594821 #>>43595250 #>>43597712 #>>43602140 #
mrkeen ◴[] No.43594754[source]
I grew up with "easy" languages. Pascal, VB, C, C++, Java, C#. And frankly I'm getting real sick of them.

I'm porting Dijkstra's algorithm over to C# at the moment, and in the last several hours here's the two most clownish things that have happened:

1) I have:

  if (node is null) {
    ..
  }
My IDE is telling me "Expression is always false according to nullable reference types' annotations". Nevertheless it enters that section every time.

2) I have:

  SortedSet<int> nums = [];
  Console.Out.WriteLine(nums.Min);
You know what this prints?

  0
The minimal element of a set which has no elements is 0.

Yes, every language has its warts, and anecdotes like this aren't going to change anyone's mind. I only wrote these up because they're hitting me right now in one of those languages that companies use "because anyone can learn them". I like harder languages better than easy languages, because they're easy.

replies(2): >>43594914 #>>43595629 #
1. neonsunset ◴[] No.43594914[source]
This is possible if you disregarded compiler warnings and assigned null to a non-nullable location.
replies(1): >>43601690 #
2. nextaccountic ◴[] No.43601690[source]
Feels like this should be a compiler error. Or saying otherwise, this location isn't very non-nullable if you can assign null to it
replies(1): >>43602101 #
3. neonsunset ◴[] No.43602101[source]
Just add <WarningsAsErrors>nullable</WarningsAsErrors> to the project manifest.