Economics

May 18th, 2008

I used to think economics was a terribly dry subject, but lately (especially since I've become part of the working population and a homeowner) I have been finding it interesting to think about how wealth, money and value are created, destroyed and moved around.

For example, would we all be better off if we tried to create wealth that lasts at the expense of ephemeral wealth? Perhaps to some extent, but on the other hand one can have too many marble statues and too few cheese sandwiches.

Where the money goes

May 17th, 2008

There was an interesting piece on the radio a while ago about some people who had a religious objection to war - specifically, their religion said that they could not pay taxes if that money would go to funding a war.

That got me wondering - what would be the consequences of trying to accommodate these people? Suppose that your tax forms had a series of boxes which you could check to tell the government what you want your tax money to go towards. Then the government could try to ensure that the war was funded only by the tax money from people who had ticked the "war" box on the tax form, and fund everything else with what is left over.

Of course, the government couldn't guarantee that peoples' money went where they wanted it to go (if they could, many people would probably just leave all the boxes unticked, or just tick the cheapest boxes in an attempt to pay no tax or less tax.

But even as a non-binding thing, the aggregate data could be useful as a gauge of public opinion - if the war is costing much more money than the taxes paid by the people who actually think it's a good idea, maybe it's time to elect a government that will end the war. Similarly for roads, schools, healthcare and welfare. Such a thing might encourage governments to be more open about what your money is being spent on and why.

Copyrighting public domain information

May 16th, 2008

Some people seem be confused about copyright and public domain, thinking things like:

  1. I used some public domain code in my program, so I have to release it as public domain as well
  2. I should be able to take some public domain code, add my own copyright to it and then prevent anyone else from using the public domain version
  3. I need a new law passed so that I can copyright this list of facts I compiled.

These are all wrong. Public domain isn't a copyright license like the GPL - it's just the absence of copyright, meaning that you can do what you like with it.

There's nothing stopping anyone from taking copyright-expired works of arts or lists of facts and copyrighting them, but such a copyright would be completely useless because it couldn't be enforced - if you sue someone for violating your copyright on that work they have an iron-clad defence - they can just say "my work is based on the public domain version, not your version" (in the case of copyright-expired works) or "I compiled my own list of facts which happens to be the same as yours because both are based on the same reality" (in the case of the phone book example) and you would not be able to prove that they had referred to your copyrighted work.

No new law is necessary because there's an easy workaround - just change something slightly to make it a new creative work - add a fake name to your phone book or change a few words in that old story. Then not only do you have a perfectly good legal case against anyone who copies your work, you also have a way to prove it (their copy will also have your changes). And you won't be "removing" anything from the public domain to boot. Sure you probably can't make much money by taking public domain works, changing something and then releasing a copyrighted version, but that's seems quite reasonable to me because you haven't actually contributed much (if anything).

I understand that map makers have used this technique in the past - changing the position of roads slightly or adding features to the map that don't exist in reality in order to make their maps copyrightable "creative works" and to enable them to track down counterfeiters.

Crisp protocol

May 15th, 2008

When I was working for Microsoft, I used to take cheese sandwiches to work for lunch every day. I like to have salt and vinegar flavored crisps in my cheese sandwiches. None of the vending machines at Microsoft sell such things so I have to take my own. This being the USA, salt and vinegar crisps are generally only sold in big bags which last me a week or more. I generally remember to buy more crisps at the supermarket when I am getting close to running out, but remembering to actually take them to work was, for some reason, more problematic.

I therefore needed a crisp refill protocol. I used to email myself at home when I needed more, so I would remember to put crisps in my bag when doing my morning email. But after a while I found myself forgetting even in the short time between answering my email and making my lunch. I realized I needed to be reminded right when I am making my lunch, and worked out an even simpler protocol - I just put a twist tie in my empty lunch box and then I see it when I'm refilling it. This is even simpler and worked much better (though I still managed to fail to bring in crisps once while using this protocol). This protocol does mean that all the twist ties end up at home though.

Now that I work at home, this is all so much simpler.

Stack measuring

May 14th, 2008

We generally do what we can to make programs reliable, but there is one particular cause of software failure which seems to have been surprisingly under-attacked. Probably because it is fairly rare in real-world situations. That failure is stack overflow.

Many real-world programs have recursive algorithms where the recursion depth depends on user input and is unchecked, and where the activation records are allocated on the stack. Current computer systems do not recover well from stack overflow (you generally get an access violation which the program cannot recover from because it is in an unknown state). This means that it is possible to supply input which crashes the program.

The compiler for my ideal language will detect when a program uses a potentially unbound recursion and allocate the activation records for such functions on the heap instead of the stack. This means that calling such a function can potentially throw an out of memory exception, which is much easier to recover from than a stack overflow (since we still have a stack to work with, and because the state of the program is well-defined - as far as the calling function is concerned the called function threw an exception and as far as the called function is concerned it never got called.)

A nice side effect of this is that now every function with an empty set exception specification has a well defined maximum stack size, which means that when you create a thread you know exactly how much stack it needs. This means stack guard pages are no longer necessary (stack can be treated just like any other area of memory) and potentially means that threads that perform small tasks can be created with very little overhead, possibly making thread pools unnecessary.

A programmer can track the maximum stack size of every thread in their application. If a change causes the stack size to increase dramatically this may be due to calling a very high-level function from a very low-level function, which may indicate a bug. Similarly, adding recursion without realizing it also indicates a possible bug, so it would be nice if the compiler could also alert the programmer to that.

ALFE build system

May 13th, 2008

When I finally get around to building my ideal language, it will have a linker and build system built in. It seems very silly to write your code in one language, your makefile in another, your configure script in a third etc.

The compiler will be invoked with the name of one source file on the command line, and that source file includes all the other required source files by means of an "include" statement which works similarly to the "#include" of C and C++, but never includes any given actual file more than once.

The program can also specify the name of the output file to generate, which can be a binary (.exe or .dll for Windows, or equivalent on other platforms) or intermediate file to be used with a C or C++ linker (.obj or .lib, or equivalent). Similarly, object and library files can be included just as source files can.

On a first pass through the program, the compiler will enumerate the complete set of input files and check their timestamps. If no input files are more recent than the output file, compilation will stop early.

Eric Clapton story

May 12th, 2008

A friend of mine told me this story a while ago. I have no idea if it's true. A friend (or possibly a friend of a friend) of his was a big Eric Clapton fan, but lived out in the boonies far away from any potential tour stops. But eventually he learned that Clapton would be playing at a (relatively) nearby city, and started saving his pennies so that he could go.

He managed to gather together enough money to buy a beaten up old car which (he hoped) would hold together long enough to get him to the city and back. After an epic journey he arrived in the city on the day of the concert and started trying to buy a ticket - only to find out that the show was completely and utterly sold out. Some tickets were being scalped, but for much more money than he had left. Dejected, having got so only to be foiled at the last hurdle, he wandered to a nearby seedy bar to drink himself into a stupour.

The barman asked why he looked so depressed, and listened with a sympathetic ear as the fan related his story.

Some hours later, the sounds from outside the bar suggested that the concert had ended and our hero decided that he should get back to his car to sleep off the drink before the long drive home. The barman enigmatically said "just stick around a little longer".

And he was right to - because shortly after that, Eric Clapton himself walked into the bar and proceeded to jam for the small audience there until the early hours.

Evolution of morality

May 11th, 2008

In my university days I would often have philosophical debates with religious friends. One of them once tried to convince that, if there was no God, there would be no reason to "be good" - that the root of morality had to be spiritual in nature.

As reasons for believing in Gods go, that one seems to be a particularly bad one. Most atheists don't go around raping and murdering people.

My friend presented me with a thought experiment. "Suppose you could kill someone you didn't like, in such a way that it would be provably impossible for anyone to find out it was you - would you do it? A Christian wouldn't, because it's against the wish of God, but an atheist would have no such compunction." Well, first of all it's ridiculous to speculate about an impossible hypothetical situation - no matter what form the proof took, it's impossible to be sure that no mistake was made and that you could never be found out, so as far as you can tell there is always an element of risk. Also, my friend was effectively arguing that the only reason he wouldn't kill is because someone (God, if no-one else) would always find out and dole out punishment. Avoiding a potential punishment seems to me to be the least moral reason for avoiding murdering people - the golden rule is a much better one.

My friend could not conceive of how a sense of morality could have arisen in the human race by evolution alone. But after a small amount of though I realized that there are many evolutionary advantages to helping the other members of your community. If you help your community, the community as a whole is strengthened. The other members of this community are likely to share more of your DNA than members of rival communities. So any advantage to your community improves your DNA's chance of surviving and reproducing. Thus, communities with a sense of morality will tend to be favored by the evolutionary process over communities with no sense of morality.

It isn't just individual survival and reproduction that drive evolution - groups of related individuals exhibit all prerequisites for evolution as well (variation in hereditary characteristics producing survival and reproduction advantages) so social behavior can evolve just as well as body shape.

In order to evolve, social behavior does not have to be encoded in DNA. Ideas can (and do) evolve and propagate just as genes do. The human mind provides an environment that is fertile for memes to breed and evolve. This is good, as speeding memetic evolution gives a survival advantage for our species (arguably, it the one thing that has allowed us to be so spectacularly more successful in control and adaptation than any other).

But just as we apparently have some "junk DNA" in our chromosomes which is reproduced faithfully but doesn't actually do anything useful, we may have accumulated some "junk memes" as well. Perhaps these aided our survivability in the past but now serve no useful purpose. I'll leave you to speculate as to what these memes may be.

The Land of Infinite Fun

May 10th, 2008

I've only read one of Iain M. Banks's books Excession) so far but hopefully I will get around to reading some more, because the guy has an incredible imagination. One concept in particular has stuck with me:

Technically, it was a branch of metamathematics, usually called metamathics. Metamathics; the investigation of the properties of Realities (more correctly, Reality-fields) intrinsically unknowable by and from our own, but whose general principles could be hazarded at. Metamathics led to everything else, it led to the places that nobody else had ever seen or heard of or previously imagined.

It was like living half your life in a tiny, stuffy, warm grey box, and being moderately happy in there because you knew no better. and then discovering a little hole in one corner of the box, a tiny opening which you could get a finger into, and tease and pull at, so that eventually you created a tear, which led to a greater tear, which led to the box falling apart around you. so that you stepped out of the tiny box's confines into startlingly cool, clear fresh air and found yourself on top of a mountain, surrounded by deep valleys, sighing forests, soaring peaks, glittering lakes, sparkling snowfields and a stunning, breathtakingly blue sky. And that, of course, wasn't even the start of the real story, that was more like the breath that is drawn in before the first syllable of the first word of the first paragraph of the first chapter of the first book of the first volume of the story.

Metamathics led to the Mind equivalent of that experience, repeated a million times, magnified a billion times, and then beyond, to configurations of wonder and bliss even the simplest abstract of which the human-basic brain had no conceivable way of comprehending. It was like a drug; an ultimately liberating, utterly enhancing, unadulterably beneficial, overpoweringly glorious drug for the intellect of machines as far beyond the sagacity of the human mind as they were beyond its understanding. This was the way the Minds spent their time. They imagined entirely new universes with altered physical laws, and played with them, lived in them and tinkered with them, sometimes setting up the conditions for life, sometimes just letting things run to see if it would arise spontaneously, sometimes arranging things so that life was impossible but other kinds and types of bizarrely fabulous complication were enabled.

Some of the universes possessed just one tiny but significant alteration, leading to some subtle twist in the way things worked, while others were so wildly, aberrantly different it could take a perfectly first-rate Mind the human equivalent of years of intense thought even to find the one tenuously familiar strand of recognisable reality that would allow it to translate the rest into comprehensibility. Between those extremes lay an infinitude of universes of unutterable fascination, consummate joy and absolute enlightenment. All that humanity knew and could understand, every single aspect, known, guessed at and hoped for in and of the universe was like a mean and base mud hut compared to the vast, glittering cloud-high palace of monumentally exquisite proportions and prodigious riches that was the metamathical realm. Within the infinities raised to the power of infinities that those metamathical rules provided, the Minds built their immense pleasure-domes of rhapsodic philosophical ecstasy.

That was where they lived. That was their home. When they weren't running ships, meddling with alien civilisations or planning the future course of the Culture itself, the Minds existed in those fantastic virtual realities, sojourning beyondward into the multi-dimensioned geographies of their unleashed imaginations, vanishingly far away from the single limited point that was reality.

The Minds had long ago come up with a proper name for it; they called it the Irreal, but they thought of it as Infinite Fun. That was what they really knew it as. The Land of Infinite Fun.

It did the experience pathetically little justice.

I think that is my idea of heaven - it would be sort of like doing maths with brain orders of magnitude more complex than my own.

Grand unified blog

May 9th, 2008

I've incorporated all my old website pages (many of which were woefully out of date) into this blog, thus giving me an excuse to leave them out of date (nobody expects old blog posts to be kept up-to-date). There were 80 of them which is more than I would have guessed.

I have no idea when some of the pages were created, so I figured it out the best I could. Please ignore any temporal anomalies you might run into here. Some of the page dates I was able to figure out by looking at the timestamps of images that I created for the page but for a lot of them the only clue was the page's timestamp. So a lot of the pages ended up on the 12th of July 2000, which is probably when I last changed the website's background.

One nice thing about using WordPress for everything is that now (or at least once I update the old pages to redirect to the corresponding blog pages) the entire site validates as XHTML 1.0 Transitional! Woo-hoo standards compliance!

I might still go back and edit old posts from time to time. Hey, it's my website - I can do what I like with it. I'll try to remember to delete any comments that such edits render incorrect. So if you notice a broken link, spelling mistake, factual error or some other update which you think I should make to an old post, feel free to comment on the post in question.