Log in

No account? Create an account
Like the moment when the brakes lock / And you slide towards the big truck - MrPutter: doing things the hard way, because it is there.
January 27th, 2008
08:30 pm
[User Picture]


Previous Entry Share Next Entry
Like the moment when the brakes lock / And you slide towards the big truck

(5 comments , Leave a comment)

[User Picture]
Date:January 28th, 2008 02:28 pm (UTC)
So that's what the Haskell nickname was all about.

It never occurred to me that the cranes at Baikonur could look so different from the gantry at Cape Canaveral.

I'm puzzled by all the red lights over Java. It would already have been very densely populated by 1993. Also, for some reason London, Paris, Tokyo, and Osaka seem to be whitish, whereas most other cities are yellow. The sheer size of the Moscow conurbation is breathtaking. Tokyo as well (especially given the scale difference on the maps), but that's a much more heavily populated megalopolis, as is Hong Kong/Shenzhen/Guangzhou. Surprisingly few red dots over the rest of China though, I'd have expected massive growth in the south.

Hyperlinked footnotes are great, but they are even better when there is a link at the end to the point from which you jumped.
[User Picture]
Date:January 28th, 2008 08:21 pm (UTC)
> a link at the end to the point

Back button on yer browser? Well, I'll keep it in mind, anyway.
[User Picture]
Date:January 29th, 2008 12:01 am (UTC)
> so different from the gantry

My feelings too, which is one of the reasons I included the image. That, plus it looks eerily similar to a giant iron venus flytrap.

(actually, my main point was to illustrate how with all the attention being focused on Astana, the rest of the country's infrastructure was just being left to rust)

> seem to be whitish, whereas

Yeah, I'm not sure what to make of that. Someone was hypothesizing that the white light was "less intense" than yellow or somesuch, but that doesn't make sense when I look at the pictures.

> what the Haskell nickname


The nickname to which you refer came when I was attempting to modify the contents of a file. My first attempt was pretty quick-and-dirty, and consisted of: (1) Open file for reading, Read, Close; (2) Mangle information; (3) Open file for writing, Write, Close.

Which didn't work. At all. After some investigation, I discovered that in step (1), once I closed the file handle, all the information I had read from it "disappeared" and was no longer available to my program for steps (2) or (3).

I know and understand Haskell pretty well, so a few seconds' thought quickly revealed to me why this was the case (beyond the scope of this discussion, but despite appearances, the reason is not quite so, uh, unreasonable as would be in other languages).

So the revised algorithm became: (1) Open file for reading+writing, Read; (2) Mangle information; (3) Rewind file pointer to the beginning; Write; Close.

I didn't mind this so much, as it is a vastly more thread-safe algorithm than was the first (important when writing discussion fora) and I would have probably eventually had to settle on something similar anyway.

Except that it still didn't work.

This because Haskell doesn't reset the file size at all when opening for read/write (fair enough, being consistent with other languages), but furthermore has no way of explicitly inserting an EOF marker into the stream (which is to say, it has no analogue to C's ftruncate()). So if, for example, my original file's contents were "abcdef<EOF>", and I collapse the "bcd" to just "b", then my resulting file ends up being: "abefef<EOF>". Which is totally not what I want. My workaround ended up being to devise my own special 'EOF' character that I can insert into the stream, and for which I had to write code to explicitly check every time I opened the file anywhere.

Which seems to me entirely retarded, and something that the Operating System should do for you... that's why we have EOF to begin with!

Anyway, grumble. I managed to work around every issue, so the language isn't completely hopeless. But it ended up being a damn sight more hassle than I had expected.
Beware of Road Surprises Powered by LiveJournal.com