For most of its life, PHP has been a “weakly” typed language: values can freely shift from one state to another, and mould themselves to what an operation requires; or, in the case of objects, largely duck-typed: you don’t need a formal contract to call a method. There is, however, a trend in the language to adopt stronger typing constraints, first in function parameters, and now elsewhere in the language. As with so much in PHP, this is being done piecemeal, and without a clear road map. This is partly deliberate: a gentle introduction of optional features is less disruptive; but it is dangerous: compromises made now will shape the language for years to come.
I think it is time to grasp the nettle and say that there is a definite policy of introducing a new typing model to PHP, and a roadmap of what that means for the language. The implementation may still be incremental, but each change will be a step in a consistent direction. This post is my musings on what such a model might look like.
Although I’ve thought about it for a long time, I find myself increasingly unsure about electoral reform, and questioning much of what is being said after Thursday’s election. I’m certainly no fan of the current system, with its awkward patchwork of safe seats and local tactical battles; and I’m distinctly unhappy to see the Tories handed the power to implement some really damaging policies; but I’m not sure the two things are really connected, or what a better system would actually look like.
I’ve long been fascinated by the social challenges of online communities, and how they mirror and differ from “real life” societies. I was recently pondering this with regards the Facebook “real names” policy, and whether it was necessary, or at least reasonable, for them to assert that level of control. Then I was reading about the #GamerGate situation, and ran into similar thoughts about the necessity, and the perils, of policing online spaces.
We live in a time where there is a lot of debate about religion – is it a force for good, or for bad? Is belief in a supreme being fundamentally less enlightened than acceptance of the scientific consensus? And so on. But a lot of the arguments on both sides are poorly thought through, and make fundamental errors of logic, or simply overstate their case to get attention. I think a large part of the reason for this is that “religion” covers such a complex tapestry of ideas, that arguments that start following one thread in that tapestry get snarled up in other parts, where the original argument no longer makes sense.
Many moons ago, I posted a surprisingly popular answer on StackOverflow regarding how to write to CSV files using PostgreSQL. The answer, in a nutshell, is the COPY statement. But there’s a catch – PostgreSQL imposes strict security limitations on the use of this statement, which are best dealt with using another feature, the SECURITY DEFINER option to CREATE FUNCTION. Here, I will attempt to explain in more detail what these security restrictions are, and how to do what you want without simply disabling that security.
So here I present its boiled down essence, in the form of an imaginary dialog1. It follows the same order as the original post, so if you want the details on any of these points, please look over there before arguing with them. (more →)
and using my favourite under-used HTML element, the definition list 8) [↩]
Ever since a friend posted a quote on Facebook from this article about same-sex marriage by Archbishop John Sentamu, I’ve had a lengthy analysis and response drifting through my mind. The government consultation ended on the 14th of June, and they’ve indicated they intend to press ahead with legalisation, but the debate is still very much alive. To my mind, equalisation of marriage seems entirely sensible, and those objections to it not based on outright prejudice are missing some crucial logical point. This is obviously just my opinion, but I’m going to attempt to back it up with some thorough logical analysis below.
For my birthday, my sister’s fiancé gallantly lugged all the way from California a pre-publication copy of Neal Stephenson’s latest novel, “REAMDE”. At just short of a thousand pages, it must have taken a fair chunk of his luggage allowance, and like a 3-hour movie, you can’t help but feel that a book that long might have benefited from a stricter editor. Certainly, Stephenson’s love of technical detail, and tendency to throw all his ideas into one pot, is very much in evidence. And yet I found myself utterly unable to put it down all the way through. (more →)
There are a lot of URLs out there on the Web; and a pretty big number of those URLs are either alternative names for something, or old locations that have been superseded. So “redirects” from one URL to another are a common feature of the web, and have been for many years. But recently, the way these redirects behave has been changing, because performance-conscious browser developers have started caching redirects, rather than re-requesting them from the server every time.
In theory, this makes perfect sense, but in practice, it causes web developers like me a lot of pain, because nothing “permanent” is actually that permanent. I’m not saying no browser should ever cache a redirect, but I do have a few suggestions of ways they could be a little more helpful about it. (more →)
I’ve never been very good at spending money. I’m lucky enough to have always had money to spend, but it often ends up sitting in the bank, unused. It’s not that I don’t know what I want or need to spend it on – for a geek, I have remarkably few shiny gadgets – but simply that I don’t like shopping.