A Gentle Introduction to Practical Types
posted September 29, 2017
Types Programmers talk a lot about types, but what is a “type”, anyway? It is, in essence, the set of all possible values for some variable. Defining such a set gives us some information about what we can do with the value of that variable, in general.
For example, when speaking about numbers, we might say, “let x be any integer” or “let y be any real number not equal to zero”.
SBrain, an extension of BrainF*ck
posted May 02, 2017
SBrain, or Semantic Brain, is a language based on Urban Müller’s famous language Brainf*ck with only 8 symbols (3 bit instructions). SBrain’s additions increase the number of symbols to 32 (6 bit instructions), including bit-shifting and arithmetic, and add a stack and a register.
Having these additional facilities allows SBrain to be far more expressive while retaining its attractiveness as a genetic medium for evolutionary algorithms. I’ve been interested in genetic programming for a long time.
Getting started with Piston, a game library for Rust
posted March 14, 2017
I’ve been interested in game programming for a while, and I periodically sample the Rust ecosystem’s offerings around game programming. Piston seems like the most promising candidate, but the tutorials are out of date, so here’s a simple one. Last update: March 2017.
This tutorial will show you how to build a simple windowed application with a time-locked update rate and keyboard controls. You can extend it with image loading, music, and many other features of the Piston library.
posted February 16, 2017
Session types are a technique for using a rich type system, like that of Rust or OCaml, to prevent the representation of certain kinds of illegal states. Here, I’ll illustrate them with a (somewhat contrived) example.
What is the use-case? Let’s take the example of a system representing packaging and shipping boxes. I want to create a Package datastructure, pack data into it, close it (preventing adding data), address it, and then ship it.
Rewriting tinyhttpd in Rust, Part One
posted October 21, 2016
In 1999, J. David Blackstone, or, as he is know online, jdavidb, was taking CSE 4344 (Network Concepts) at UT Arlington. Those were the glory days of Sparc Solaris, and Blackstone wrote, for his college course, a C program called tinyhttpd. It is, essentially, a very short version of the immensely complex programs that seem run the world these days: web servers. Unlike the million-line behemoths (think Apache, nginx, et cetera), tinyhttpd is a HTTP 1.