Recently I’ve found this post on Hacker News. It’s a simple web app showing how many 10 minute blocks are in your day. This reminded me how every single time tracking app I ever found was a bloated pile of mess, and this approach would be great for building my own time tracker.

It was also a good excuse to try out Odin. The project was very simple so I didn’t get to use all of Odin’s features but it was enough to get a basic understanding of the language.

DayBlocks App

DayBlocks in action
How my day looked like until now (5 PM)

The app is called DayBlocks and you can find it’s source and binary on GitHub. It’s a very simple terminal app: type print to show all minutes in your current day, separated into 1-hour blocks. each minute is colored to show:

  1. Sleep time (preset 23:00-8:00)
  2. Free time (preset - everything that’s not sleep)
  3. Work (timed by the user)
  4. Break (timed by the user)

It’s not customisable at all and I like it that way. A non-feature missing from most applications these days.

Type start [work/break] to start timing, type stop to stop timing. quit to exit the app. Everything is saved to a file, in plain text format (similar to what you get when you print) - and that’s it! Nothing more! How much I miss simple tech that just does what’s needed, without having to create an account, log in every time, customize everything. It also doesn’t take more than a split second to start up/react to your clicks… Actually, it takes some time to print the whole table because I’m printing each line separately, I like to pretend it’s an animation…

Odin

I really wanted to like this language - I’m tired of C. Almost every C++ feature is a step in the wrong direction and there’s no good alternatives (no, Rust looks like a slightly better C++). Sadly, I think I will have to wait for Odin to develop a little bit more.

Pros:

  • Order in which you declare functions DOES NOT MATTER - by far the most annoying thing about C++ is organizing everything into files, making sure it’s all included in correct order, what a mess
  • Std lib - parser and string handling were useful and easy to use
    • These two things are really all you need for simple programs. I can uninstall python now?
  • No features for error handling (yeah, it’s probably a good thing)
    • Apart from assert - it’s nice to have it built-in
  • Defer keyword
  • Implicit context system (passing allocators)
  • Syntax is tidy, clear and less error-prone than C
  • Good support for enums
    • Can do len(EnumType)
    • Range for loops: for value in EnumType
    • Printf converting enum value to a string
    • Compile time error if switch on enum doesn’t include all possible values (can be ignored with #partial if intentional)
    • I used enums a lot in this program

Cons

  • Compile time: over 1.5s for < 700 lines of code and few stdlib includes. That’s what I would expect with 100 000 loc project, it’s not annoying at this stage but makes me worried.
  • Poor documentation for std lib functionality - any novice will be surely lost, I had trouble figuring out something as basic as reading from stdin
    • Memory allocation with strings using standard lib in unclear (lack of good documentation again) - I probably introduced some memory leaks because of that
  • Errors are often unclear (better than C++, worse than they should be)
    • Haven’t tried generics though - that’s where C++ is the worst
  • Can’t define map as a constant?
  • You can accidentally create a new variable within inner scope (by typing := instead of =) and compiler won’t warn you about it
  • I couldn’t dump memory to a file directly. It’s probably me simply misunderstanding something but still, in C it’s trivial

It’s just not mature enough for me to trust it with a bigger project. I do like it though, I hope to use it in the future (still need to compare it with Zig and Jai if that ever comes out… good times for system programming languages).

These are minor criticisms and I’m sure it will improve in the future but I personally don’t feel like swapping a set of well-known issues with C for a set of unknow issues with Odin. At least not yet.