~jakintosh/hare

/pages

Hare

Hare is a "boring" programming language started by Drew DeVault, which aims to be a systems programming language for free and open operating systems that exercises restraint in its design. It aims to perform many of the same jobs that C does, but with an unambiguous specification, and with a few more modern safety features.

/hare Stream

December 5, 2023

/stream /programming /hare /december-adventure

Another short December Adventure session today, but I implemented some functionality for creating and listing accounts within a project. For now, this is done by adding files to an 'accounts' directory inside the project, and having each account file be the stringified version of an account struct. I should probably put together some kind of de/serializing functions that make it easier to re-ingest the text file back into program data later on, and also clean up the way I'm creating "resources" since I'll need to do a lot more of that. Honestly, if I have more than a few minutes to work on this tomorrow I should take a step back and do a bit more planning now that I have all of this infrastructure working.

December 4, 2023

/stream /programming /hare /december-adventure

I only had about twenty minutes for my December Adventure today, but managed to implement the books list command using the config work from yesterday. I also refactored those config functions to work as a general key-value store, which made it very easy to then also implement books set project to set the active project. Overall, the work I did yesterday made it so that implementing these other commands was pretty straightforward. I need to come back to this a bit later and think through the error handling a bit better, because for now it just unwraps all the errors with !.

						
$ ./books list
spiral-house
home
					
$ ./books set project home
ok
						
					

December 3, 2023

/stream /programming /hare /december-adventure

Had a pretty packed day, but found a few moments to tinker. Spent most of today's time starting to learn about the fs, io, and os modules of the standard library. Wrote a few functions for reading and writing files, and now the CLI for books lets you set a directory where it looks for your projects by default. Trying to lean on the filesystem to do all of the work in this project, so this "setting" is just a file $XDG_CONFIG_HOME/books/root that contains the path.

						
$ ./books set root ~/books
ok
					
$ cat ~/.config/books/root
/home/jak/books
						
					

December 2, 2023

/stream /programming /hare /december-adventure

Today's work on the December Adventure was more fleshing out of the command tree as I was thinking about the different types of resources that need to be created and managed. Things like accounts, journal entries, and so on. Fleshing out the tree has been a good test of my cli module, and is also a good way to think through the use of the program as a set of resources being managed.

I also needed to figure out a way to have the user set an active project and let the program know where to find project directories, and this led me to learn about the XDG Base Directory Specification, which is what defines the ~/.local, ~/.config, and ~/.cache directories, and what types of files should go in each. I learned something new, and also figured out how I should handle the default storage of configuration and state data for this program.

December 1, 2023

/stream /programming /hare /december-adventure

I've been cutting my teeth on /hare for a few weeks now, and yesterday I finally got my "learning project" (a CLI argument parsing module) finished. So today, I started work on a CLI double-entry bookkeeping program which I think is going to be my December Adventure for 2023.

Today's work was fleshing out a command tree using my new argument parsing module, and then learning about how the Hare compiler uses multiple source files. I can now compile a binary that executes a few placeholder subcommands.

November 14, 2023

/stream /technology /programming /hare

Over the past few days, I've been starting to get acquainted with the Hare programming language. Someone on Merveilles mentioned something about it, and after looking it up something really clicked about it for me. I'd been really starting to sour a bit on Rust, especially the complexity of the ecosystem, and was thinking that I should start to learn 'C'. So finding the Hare language, which is an opinionated 'C' replacement whose opinions heavily match my own, has been a joy.

From what I can tell so far, the core idea behind Hare is that "Understandability of the Toolchain" should be the highest goal. You can bootstrap the compiler with gcc in about 30 seconds, with about 30k lines of source code. That's faster than building most simple Rust binaries with an empty cache. In terms of language features, it is focused on proven ideas implemented well, and consistency over syntactic sugar. As an example of its philosophy, its implementation of tagged unions turn a very basic type system into something that punches way above its weight class in terms of capabilities and program correctness. It makes a big leap from something like C towards something like Rust, but with an order of magnitude less complexity.

So far, the only things close to a "dealbreaker" is the limited editor integrations, like in-editor compiler warnings, and autocomplete/autoformatting. Perhaps I can try my hand at an LSP implementation...

Start