August 2018 Archives

Do we have to choose between Brexit and Indyref 2?

Trying to appeal to now-No leavers might be a premature optimisation.

| No Comments | No TrackBacks

Wings over Scotland says, amongst other things:

a second EU referendum and a second indyref do not exist in isolation from each other. Each one damages the interests of the other. An independent Scotland would reduce the rUK’s chances of reversing Brexit, and reversing Brexit would damage the arguments for an independent Scotland

The first part is obvious: given that Scotland voted en bloc for Remain, rivalled in its intensity only by Gibraltar, London and Northern Ireland, then if Scotland had already been independent by the time the Brexit referendum was held, Leave would definitely have won. And if by any chance Scotland managed to declare independence while the rUK was out of the EU, the task of rUK Remainers to turn around an increasingly ideologically-polarised polity and rejoin the EU would be that much harder.

As for reversing Brexit making independence less likely, there are, I think, two reasons, neither of which completely satisfy me. The first and most trivial is that a People’s Vote which reverses Brexit but ignores IndyRef 2 (the subject of Wings’ most recent ire) might bring to power Unionists who would screw over Scotland yet again. (How exactly this would differ from the current Unionists who are quite happily screwing over Scotland is left as an exercise for the reader.)

The second is that Wings believes that Indyref 2 can only be won by appealing to leavers - specifically, yes voters who are now no voters, and voted leave. The basic principle is sound: whether it’s because the EU27 are principled (the four freedoms are sacrosanct, and the EU will not survive if countries are allowed to cherry-pick), or ruthless (throw the UK against a wall just to show the world that the EU means business), let some other country try leaving the EU first. If that works, an independent Scotland can join the rUK in declaring article 50. If it doesn’t, well, now we know.

Still, though, it seems … odd to argue that Scotland and Northern Ireland remaining in the EU is the only way to fix the Northern Ireland border problem, but all of the UK remaining in the EU would somehow scupper independence. If the Good Friday Agreement has taught us anything, it’s that answering questions like “is Northern Ireland part of the UK or part of the Republic?” with “all three are part of the EU, so does it matter?” is a very good idea. Irrespective of your opinion about GERS, it’s undeniable that the arguments against Brexit - e.g. the sheer amount of red tape and physical space for customs infrastructure required, and the corresponding economic slowdown - are also arguments against Scottish independence from a rUK outside the single market and customs union. One of the reasons the Indyref campaign did as well as it did was that Alex Salmond could confidently reassure people that we’d keep the Queen, the pound and the BBC. Do you really want to say “OK, Brexit is a shitshow, but we would do independence properly”?

And more generally: popular opinion is already turning against Brexit, and that’s before anything has really happened yet. Charlie Stross is holding off writing a third near-future Scotland book because nobody has any idea what’s going to happen in the next few months, let alone years. Talk of a new centrist party always runs up against the formidable barriers of the UK’s FPTP electoral system, but it wouldn’t be surprising if one or both of the two major parties split, and/or the UK polity reorganised itself on constitutional lines rather than the current and traditional right/left economic divide.

So by all means look at opinion polls and try to work out how to build a coalition for independence. But when Indyref2 comes, chances are that a lot of people will have changed their mind.

Don't program in algebra

Programming is about communicating outcomes, not processes

| No Comments | No TrackBacks

My standard datetime library didn’t have a standard way of saying “th” for days - you know, “Monday 1st April” vs “Tuesday 2nd April” vs “Wednesday 3rd April” vs “Any day xxth April probably”. So I went looking for solutions.

My favourite example was probably Lingua::EN::Numbers::Ordinate because of the way it iteratively works towards the proper solution:

sub ordsuf ($) {
  return 'th' if not(defined($_[0])) or not( 0 + $_[0] );
   # 'th' for undef, 0, or anything non-number.
  my $n = abs($_[0]);  # Throw away the sign.
  return 'th' unless $n == int($n); # Best possible, I guess.
  $n %= 100;
  return 'th' if $n == 11 or $n == 12 or $n == 13;
  $n %= 10;
  return 'st' if $n == 1; 
  return 'nd' if $n == 2;
  return 'rd' if $n == 3;
  return 'th';
}

And the approach I least favoured, even though it’s far more “efficient”, was this one from Date::Format:

@Dsuf = (qw(th st nd rd th th th th th th)) x 3;
@Dsuf[11,12,13] = qw(th th th);
@Dsuf[30,31] = qw(th st);

It’s not just the way that it decides “let’s just do 0..9, 10..19, 20..29 automatically, then manually add 30 and 31” (presumably because that’s part of its data validation - if you ask it for an ordinal of 32 it will tell you that there’s no such day). Or the repetition of many “th” between 4 and 9.

It’s the fact that the programmer has decided “OK, what’s the problem?”, found a solution, and then decided “OK, how do we make the solution the most efficient possible?” and golfed their way towards the implementation. This is read-only code: it assumes that the problem has been solved, that this is the best way of solving it, and provides no information about why any of this ever happened (which is usually the way of finding bugs: to realise that the previous implementor’s approach was wrong).

The most annoying commonplace falsehood about programming is “it’s all about ones and zeroes”. It’s not: it’s been a lifetime since anyone actually programmed a computer by inputting ones and zeroes into anything. It might be ones and zeroes under the hood, but that’s as interesting as saying that the life as a materials chemist is all about quarks.

The second most annoying commonplace falsehood about programming is slightly more interesting: it says that programming is all about science, and maths in particular. That may be true in the more refined parts of our industry, but for the most part we’re writing systems that interact with humans rather than particle accelerators or lunar landers. And the way we write code should reflect that.

So: if your code is all about O(n) efficiency or what have you, by all means make it efficient. But if you’re just trying to deal with real-world problems, write the code in a way that resembles the real-world problem that you’re trying to solve. The future maintainer will thank you.

About this Archive

This page is an archive of entries from August 2018 listed from newest to oldest.

April 2017 is the previous archive.

March 2020 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.23-en