Plurrrr

Sat 15 Aug 2020

Write your Own Virtual Machine

In this tutorial, I will teach you how to write your own virtual machine (VM) that can run assembly language programs, such as my friend's 2048 or my Roguelike. If you know how to program, but would like to gain a deeper understanding of what is going on inside a computer and better understand how programming languages work, then this project is for you. Writing your own VM may sound a little scary, but I promise that you will find it to be surprisingly simple and enlightening.

Source: Write your Own Virtual Machine, an article by Justin Meiners and Ryan Pendleton.

Types as axioms, or: playing god with static types

Just what exactly is a type?

A common perspective is that types are restrictions. Static types restrict the set of values a variable may contain, capturing some subset of the space of “all possible values.” Under this worldview, a typechecker is sort of like an oracle, predicting which values will end up where when the program runs and making sure they satisfy the constraints the programmer wrote down in the type annotations. Of course, the typechecker can’t really predict the future, so when the typechecker gets it wrong—it can’t “figure out” what a value will be—static types can feel like self-inflicted shackles.

But that is not the only perspective. There is another way—a way that puts you, the programmer, back in the driver’s seat. You make the rules, you call the shots, you set the objectives. You need not be limited any longer by what the designers of your programming language decided the typechecker can and cannot prove. You do not serve the typechecker; the typechecker serves you.

Source: Types as axioms, or: playing god with static types, an article by Alexis King.

Duality of Vector Spaces

When I was learning about Continuum Mechanics for the first time, the covariance and contravariance of vectors confused the hell out of me. The concepts gain meaning in the context of Riemannian Geometry, but it was surprising to find that one doesn’t need to learn an entire subject to grasp the logic behind co-/contravariance. An intermediate knowledge of linear algebra is enough—that is, one has to be acquainted with the concept of vector spaces and one-forms.

The duality of co-/contravariance arises when one has to define vectors in terms of a non-orthonormal basis. The reason such terminology doesn’t show up in engineering education is that Cartesian coordinates are enough for most engineering problems. But every now and then, a complex problem with funky geometrical requirements show up, like one that requires measuring distances and areas on non-flat surfaces. Then you end up with dual vector spaces. I’ll try to give the basics of duality below.

Source: Duality of Vector Spaces, an article by Onur Solmaz.