October 2017
M T W T F S S
« Aug    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories

Archives

Archives

Promised Properties

 Three weeks ago I started a new project that uses nodejs and which forced me to learn some asynchronous programming. I couldn’t quite manage to adapt.

Because this was server code that ties together other web services and my own database, many of the helper functions ended up having multiple asychronous steps. The lack […]

C++ casting operators

Today in my research, I came across an interesting challenge. I’m editing an older version of JavaScriptCore (JSC), redefining the most basic typedef in the sytem, EncodedJSValue. Previously it was a simple void*, but I need to gift it with some special secret sauce, so I changed it to a struct.

typedef struct EncodedJSValue { […]

The Good IR: Multiple Returns

This post is part of a seres: The Good IR (BasicBlocks and control flow instructions) The Good IR: Other Control Flow Structures The Good IR: Instructions and Values The Good IR: Reporting Semantic Errors via Type Checking The Good IR: Multiple Returns —–

Why Have Early Returns?

I’ve been meaning for awhile now to do […]

The Good IR: Reporting Semantic Errors via Type Checking

This post is part of a seres: The Good IR (BasicBlocks and control flow instructions) The Good IR: Other Control Flow Structures The Good IR: Instructions and Values The Good IR: Reporting Semantic Errors via Type Checking The Good IR: Multiple Returns —–

It’s actually, quite fascinating: not only is type-checking relatively simple to do, […]

Where’d that null come from?

One of the most annoying things that can happen to a computer programmer is the dreaded NullPointerException, or in C++, the segfault that occurs due to dereferencing a null pointer. The null pointer error has this ‘feature’ which makes it a ‘pleasure’ to debug: the source of the null can be arbitrarily far away from […]

The Progress Phallus

My friend Ray runs numerical simulations and wanted to have a decent progress bar for his code. A bit of web searching revealed some code, that takes care of this automatically. However, we thought that an ordinary progress bar is simply too conventional. We should gay it up with some ascii art into a beautiful […]

Higher-Order Functions in Java

This Summer I’ve been teaching Intro to Computer Languages. It’s a really awesome class, with alot of good material in it. Last week, my students got back the results of their midterms, and were disappointed in their scores. Immediately, I heard some clamoring for an extra credit. Not only was the average midterm score […]

A language should be focused on writing Internal DSLs

I’ve been reading Martin Fowler’s book, Domain-Specific Languages, this weekend. He covered a number of ways in which you can structure your code to achieve what he terms an Internal DSL. Quite a bit is focused on the discussion of a fluent interface. It turns out in many languages there are only so many ways […]

Const-correctness

One of my fellow lab-mates has already posted about const-correctness, because of some similar issues. My work today, takes it a tiny bit further into sheer insanity.

If you don’t start your program off using a const-correctness discipline, it’s very likely that you will find yourself in a world of hurt when you try to […]

Type-dispatch with Exceptions

I’m one of those Object Oriented programmers that consider type-inspection to be a design flaw. Much to my chagrin, I’ve found myself making occasional use of the Java instanceof keyword. In my most recent class lecture, we discussed Exceptions, and I later realized that one could essentially type-dispatch using the exception mechanism, because the catch […]