Archive for the ‘Language Design’ Category

Carry out my sentence

Wednesday, January 13th, 2010

Early on in PHP’s life, its type system contained only strings, ints, reals, arrays, “resources,” and null. A number of features have been bodged in on top of this minimal system without really extending it. “Function pointer” functionality was one of the first.

(more…)

I really don’t know what you mean

Monday, January 11th, 2010

It’s Monday, and I’m sick, so you get some low-hanging fruit today. The following snippet produces a syntax error in PHP:

1
2
3
4
5
6
7
< ?php
function monolithic_dimensions() {
    return array(1, 4, 9);
}
 
print monolithic_dimensions()[0]; // syntax error, unexpected '['
?>

(more…)

I’d rather die than give you control

Saturday, January 9th, 2010

Most modern languages have a construct that allows code to run at the end of a block regardless of how flow leaves a block. This allows code to reliably close resources, perform rollbacks, and otherwise maintain invariants relatively easily, even in the presence of exceptions.

(more…)