Archive for May, 2010

GCC Project

GCC as a free software project is clearly very successful. Over more than 20 years it’s grown from nothing to become the standard compiler for several operating systems and many microprocessors. So far in 2010 the core part of the compiler alone has seen over 1000 commits by over 100 contributors. GCC continues to get significant new features; e.g., the recent GCC 4.5 release includes a new link time optimization facility.

On the other hand, the GCC project has some problems. The major individual contributors to GCC are hired to work on it. That means that they have a lot of time and resources to use to improve the compiler, which is good. However, it also has some negative effects. It’s difficult for new volunteers to join the community. It’s hard for them to learn the code base and it’s hard for them to keep up with the pace of change. It’s also hard for them to learn the conventions of how the project works, and they get little help in getting their patches in. Also, the people who work on GCC have learned the intricacies of the code base over time. They do not rely on the internal documentation. The effect is that the internal documentation for some parts of the code base is quite weak, and none of the main contributors are motivated to fix it.

Another, separate, problem is that there is no single person or group with a clear ability and willingness to decide on the direction of the project. In the past the direction has been set at different times by people like Richard Stallman, Richard Kenner, Jeff Law, and Richard Henderson. None of them are playing that role today. The effect is that nobody can see whether significant new features should or should not go into the project, which leads to a tendency for inconclusive discussions and unreviewed patches. People hoping to contribute are left with no clear path forward. (I should mention that groups like the GCC Steering Committee and the GCC Release Managers are effective but do not take on this role, which is more that of an architect.)

A third problem is that GCC has no public relations activity. The project web page tells you what GCC is but says nothing about how it compares to other compilers or how it has improved over time. There are some common criticisms of GCC, such as the belief that it is measurably worse than proprietary compilers, or that it is stagnating, which the project makes no attempt to discuss or dispute.

None of these issues are critical. As I said, GCC is highly successful. But they are areas where I think GCC could improve. Unfortunately, pointing out these issues is insufficient; it’s necessary for peole to step up to take on these roles. The various companies which pay people to work on GCC are generally less interested in these aspects of the project, which makes it that much harder to find people to work on them.

Comments (7)

Iron Man 2

A few thoughts on Iron Man 2.

I liked it.

How odd to see a decent romantic comedy mixed into a superhero movie. Most recent romantic comedies have been terrible. Forgetting Sarah Marshall wasn’t too bad, but the last one I can remember as being solidly good was Fifty First Dates.

The movies was much more like a comic book than most, with a few scenes of subplots tossed in every so often. In comic books it works because you get more of the story every month. Can they really make that pay off in other movies which are at best a year later? Or is it mainly aimed at people who read the adaptations?

Don Cheadle and Scarlet Johansson did good jobs with minor characters, which shows the importance of getting good actors. Samuel L. Jackson was amusing as always. Mickey Rourke was excellent.

The final scene, after the credits, sets up for Thor, which according to IMDB is going to be a movie next year. Thor is everybody’s favorite Norse god, but he’s a much weaker character than Iron Man. He has no character weaknesses, except for a tendency toward bravado which becomes rapidly uninteresting. His difficulties are all structural: take away his hammer and he turns back to human. All the best Thor comic book stories are very long, very cosmic, and concentrate mainly on the characters around him. The very best one, the multi-year epic by Walter Simonson, starts off by finding a character who is an even better Thor than Thor himself, and has a whole issue in which Thor does not appear at all. None of this suggests a good movie to me. IMDB does list Kenneth Branagh as director; he’s made some great movies (my favorite is Much Ado About Nothing) and some very weak ones (Frankenstein).

Comments

Libertarian Civil Rights

The recent clamor over Rand Paul’s comments on the Civil Rights Act were a useful indicator of one of the problems with the libertarian approach to society. Paul was clear, in retrospect, that he supported the Civil Rights Act, but he was also clear that he was concerned about its effect on business owners.

Any society is a balancing of rights among all its members. All societies agree that people have different rights in different roles. The complex cases for societies are deciding what to do when those rights conflict. The libertarian point of view tends to emphasize one particular right over all others: the right to private property. But that is not the only right in our society, and cases like segregated lunch counters give that a nice clarity. If a business is open to the public, then if we are a member of the public, we have the right to expect it to be open for us. There are a number of ways which society permits business to discriminate; most obviously, businesses may discriminate against people without money. But society does not permit businesses to discriminate against people on the basis of skin color. This is not a grey area.

If you focus only on the right to private property, then the ability of businesses to discriminate against customers is a troubling case. That is how Paul got into trouble and had a hard time giving a clear answer to a relatively simple question. If you consider this issue as a balancing of rights, then there is no difficulty.

There are certainly hard cases in rights balancing; this just isn’t one of them. A hard case is how much accommodation a small business must provide a disabled customer. E.g., we all agree that the business must serve someone in a wheelchair, but is a business required to make it possible for that person to get to all parts of the store?

If Paul wants to get elected and be an effective senator, he must not only learn to answer simple questions in a straightforward way. He must also learn that the role of the politicians is to balance rights, not to promote one specific right over all others.

Comments (8)

Destructors

The Go language does not have destructors. Instead, it has two more dynamic mechanisms. A defer statement may be used to run a function on function exit or when processing a panic. A finalizer may be used to run a function when the garbage collector finds that a block of memory has nothing pointing to it and can be released. Both approaches are dynamic, in that you have to executed the defer statement or call the runtime.SetFinalizer function. They are have no lexical scoping; a single defer statement in a loop can cause its argument to be called many times on function exit.

These ideas are significantly different from destructors, which are associated with a type, and are executed when an object of that type goes out of lexical scope or is explicitly deleted. Destructors are primarily used to release resources acquired by an object of the type. This is a less important concept in a garbage collected language like Go.

The absence of destructors means that Go does not support the RAII pattern, in which an object is used to acquire a mutex or some other resource for the scope of a lexical block. Implementing this in Go requires two statements: one to acquire the mutex, and a defer statement to release the mutex on function exit. Because deferred functions are run on function exit, the mapping is not exact; you can not use this technique to acquire a lock in a loop. In fact, acquiring a mutex in a loop and correctly releasing it when a panic occurs is rather difficult in Go; fortunately it is easy to handle correctly by moving the body of the loop to a separate function. In any case, Go discourages this type of programming. Mutexes are available in Go, but channels are the preferred mechanism for synchronization.

Are defer statements and finalizers sufficient replacement for destructors in a garbage collected language? They are for me. When I write C++ my destructors are almost entirely concerned with releasing memory. In fact, in the gold linker I often deliberately omitted destructors, because many of the data structures live for the life the program; in such a case, destructors serve only to slow down program exit. I would be interested to hear of a pattern of programming which relies on destructors for cases other than releasing memory or RAII.

Comments (5)

Stay Home

I’m puzzled by people who travel to the few remaining parts of our world that are untouched by people, write about how beautiful they are, and encourage us to do what we can to save them in their natural state. The way to save untouched nature is to not go there at all (we could permit small controlled exceptions for scientific study). A better way to preserve nature would be to write about the beauty of our cities. Leave the non-human world to itself.

In fact, the best way to live easy on the earth would be to take residence in a box outside Shinjuku station. In a city of 13 million, one more will have no detectable environmental impact.. Don’t try to practice renewable living in a forest glade. Go where there are lots and lots of people already, and stay there.

Comments (3)

« Previous entries Next Page » Next Page »