Coding with Honour
Limerick Lisp-style

In honour of the Functional Programming eXchange, on a bus to which I am writing this.

 (a (program (writtenp :in 'lisp))
     (may 'be (and (simple) (elegant) (crisp)))
     (but (cry '(C pros) "too *fancy();"
             "for (i; simply(); &cant++ + ++see)"
             "{ the code; for (;;) { the parenthesis; } }")))
My first Manhattan

My first Manhattan

Made enchiladas.

Made enchiladas.

Why the Digital Economy Bill is flawed

My MP, Meg Hillier, was kind enough to respond by post to my email about the proposed “three strikes” legislation in the UK. The main content of her response was to forward me a letter she received from Stephen Timms, the Minister for Digital Britain (his actual job title, I’m not making this up), to “clarify the Government’s position on this issue”.

The forwarded letter mostly just rattled off the party line - illegal file sharing is illegal, artists need to be compensated, the usual unjustified claims of urgency - but it did mention the recent report by the UK Intellectual Property Office, awkwardly entitled © The Way Ahead, which is actually pretty encouraging reading: I will discuss it in a separate post soon.

My previous email focused on problems with the “three strikes” approach. Since the Digital Economy Bill was published we’ve discovered that “three strikes” is only one of several nasty tricks up Mandy’s sleeve. Therefore, and because I felt from her letter that Ms Hillier hadn’t really taken my concerns on board, I wrote back.

Update 2009/12/02 - since the Digital Economy Bill is currently being debated in the House of Lords, I also sent an edited version of this email yesterday to Lord Clement-Jones, who is taking part in this afternoon’s Second Reading debate.

Dear Ms Hillier,

Thank you very much for your swift response to my email of 17th November. Thank you also for forwarding a copy of Stephen Timms’ letter outlining the Government’s position, reasoning and intentions regarding illegal filesharing. I am grateful to him for drawing my attention to the UK Intellectual Property Office’s report © The Way Ahead, which I have read with interest.

Unfortunately, Mr Timms’ letter does not reassure me. On the contrary, it reinforces my perception that the policies set out in the Government’s Digital Economy Bill were drafted in haste, based on the shrill lobbying of special interests rather than empirical evidence and objective reasoning.

I do not believe the available evidence justifies imposing technical sanctions on internet users without trial in court, as the Government proposals would allow. The UKIPO report, published only a month ago, finds that “a lack of strong evidence across the world makes it difficult to establish the case for changes to aspects of copyright law and practice”. Meta-analyses of the economic literature have similarly observed a poor quality of available evidence and a lack of consensus.

Mr Timms’ letter does not even include the word “evidence”; I note with concern that this omission seems to be typical of Government communications on this topic.

This is not the only thing wrong with the Digital Economy Bill. I wrote my previous email before the Bill was published. Since then I have read with alarm section 17, which grants the Secretary of State power to amend by statutory instrument the Copyright, Designs and Patents Act of 1988 “if it appears to the Secretary of State appropriate to do so”. To grant such broad powers to an unelected official is incredible, undemocratic and indefensible.

I acknowledge the problem this “power to amend” is designed to tackle: technology changes too quickly for primary legislation to keep up. However, the case has not been made that this justifies circumventing the democratic process, especially in such an important and controversial area as copyright law. To me it rather suggests, to paraphrase the UKIPO report, that Parliament should amend copyright law to be more technologically neutral.

Therefore I once again urge you to reject the Digital Economy Bill unless it is substantially amended, including the removal of section 17, and the addition of a guarantee of trial in court before technical limitations can be imposed on internet users. I would also appreciate it if you could pass on my concerns to the Minister responsible for the Bill, for example by forwarding him this email.

I am sure that, as a Government minister, you will be under considerable party pressure to support this Bill, and that I am unlikely to convince you. However, I must reiterate that I will not vote for any MP or party who does support it, nor will many of my personal and professional acquaintances.

Finally, I would like to inform you that I am publishing my emails to you on my blog, where my previous email has been read by over 70 people at time of writing. With your permission, I would like to include your responses in these blog posts.

Thank you again for reading this email.

Yours sincerely,

Sam Stokes

Update 2009/12/14: response

Meg Hillier sent a brief reply to this email, stating that she supports the Digital Economy Bill because “filesharing has a big impact on people’s livelihoods”. This is a disappointing response, as it basically ignores the content of this second email. I will continue the correspondence, but as this blog is already more politics-heavy than I intended, I will stop publishing my emails unless there is a noteworthy development.

Regex style in Ruby

Reading Patrick McKenzie’s excellent practical example of metaprogramming, I came across a line of code I didn’t understand:

That line taught me three new things about Ruby:

  1. The syntax for the subscript operator [] allows multiple arguments. (It turns out I already knew this in another context: [1,1,2,3,5,7][2,3] => [2,3,5])
  2. You can subscript a String with a Regexp, returning the first match: "goal"[/[aeiou]/] => "o" (nil is returned if there is no match).
  3. If you throw in an index n, then you get the nth capturing group of the first match: "xaabb"[/(.)\1/, 1] => "a" (or nil again if no match).

That last one is interesting, because it means there’s a concise way I didn’t previously know about to achieve a common regex task: checking if an input string matches a given format, and if so, extracting part of the format. Say we want to pull out the domain from an email address, but complain if we can’t find it:

Before learning this trick I would have either used a temporary match object a la Java, or gritted my teeth and used a global variable Perl-style:

Both of those seem rather verbose. They can be golfed into one-liners, but the readability starts to suffer:

So I’m left wondering what’s the most readable and/or idiomatic style for regexes in Ruby. TMTOWTDI indeed! Even now I know what it means, "xaabb"[/(.)\1/,1] makes me double-take slightly - it’s an unusual way to use [] - but I guess it’s just another Ruby idiosyncracy I’ll come to know and love.

On "three strikes": email to my MP

An email I wrote to my MP (using the very handy WriteToThem) regarding the UK Government’s so-called “three strikes” proposals to combat illegal filesharing.

Dear Ms Hillier,

I am writing to ask you to vote against the Government’s forthcoming Digital Economy Bill, unless the currently proposed measures to impair or disconnect without trial the internet connections of those accused of illegal filesharing are removed from said Bill.

Copyright holders are already entitled to initiate private lawsuits against those they believe to be infringing their rights. This of course involves a trial in court, with the accused party presumed innocent until proven guilty. Methods of detecting infringement are known to be unreliable, leading to false accusations, but currently this is the accuser’s problem.

The Government’s plans would remove the inconvenient (to the rights holder) need for a court case to punish the accused. The unreliability of detection would become an issue for every internet user, since these plans do not require proof of infringement, only repeated accusation.

This circumvention of justice is justified only by evidence produced by the rights holders themselves. It ignores evidence that the music industry has actually grown over the last five years, and that filesharing may be an opportunity for the content industries rather than a threat.

I am also very concerned about the precedent that would be set by these proposals. Music and film are not the only industries whose business models have been shaken by the emergence of new technology. The news industry, for example, is considering charging for its previously free online content. Without question people will find ways to circumvent these “paywalls” and access the content for free. Will we then allow news publishers to join in selecting people for disconnection? I myself, as an independent software developer, am a creator of copyrighted works. Can I disconnect people I believe have used my work without permission? If not, why can the BPI do it but not me?

I believe the Government’s plans to be short-sighted in conception, wrong in principle, and likely in practice to do more harm than good. I will vote against any politician who supports them.

I also ask you to sign Early Day Motion 1997, which echoes many of these sentiments.

Thank you for reading.

Yours sincerely,

Sam Stokes

Update 2009/12/02: response

Ms Hillier was kind enough to respond by post to my email. I will not reproduce her response here, as she has not given her consent to publish it; however I have blogged about the further email I sent in reply.

Since the Digital Economy Bill was published between my first email and my second, the latter brings up some new points, in particular regarding the lack of evidence to justify these measures and the broad powers to be given to the Secretary of State.