Erlang Thoughts
Like most of the rest of the world, I've been reading Programming Erlang. It's the first technical book in a long time where I actually feel like reading it cover-to-cover. We'll see if that motivation holds out. As far as the language, the functional aspects don't bother me; after XSLT, then Lisp and Scheme, immutable variables and tail recursion are easy enough. That said, there's a ton of discussion as other people new to the language grapple with it.
Cedric Beust has a good point about the way receive clauses seem to be structured.
Refactoring a receive clause is like refactoring a switch/case: in general, not very convenient and even if you decide to replace it completely, you need to introduce polymorphism, which Erlang doesn't seem to support at all. Similarly, it doesn't seem possible to override an existing method and specialize it, nor is it possible to add a method to an existing module (or have a module extend an existing one).
Looking at Steve Vinoski's solution to Tim Bray's problem, I was struck by the way he restructured the problem: make it parallelizable. Sort of a literal interpretation of the adage "when performance stinks, throw another processor at it".
Steve Loughran has an interesting point. It's not so much that the syntax feels old, it's that developing in the REPL is a bit sloppy. It's great for exploring, but what you'd like to have out of all that is test cases.
Right from the outset you'd write some tests that describe the functional behaviour of the deployed system, then you set something up to run those tests all the time Current IDEs, they compile and analyse your code in the background, and flag errors. But imagine if they also, continually, highlit which clauses didnt have coverage, if they were triggering deployment and test runs on five different (virtualized) machines, and could flag which functions were failing on the Mac but not Windows. There'd be a console if you needed it, but it would be as secondary to the development process as actually manually viewing the application/web site is in today's test-centric teams. You look at the site to make sure it is pretty, not that it works, because that is the job of tools like Selenium.
Steve goes on to wonder how to implement this in Erlang. Reading ONLamp's Introduction To Erlang, I observed the following:
In fact, when you write something like
X = 3., it is interpreted as a pattern, and the left and right sides are analyzed. On the lefthand side, we find an unbound variable, and the right side, a value. Erlang figures out that the smart thing to do is bind that variable to the value and that is when assignment actually happens. However, when you attempt to assign a new value to X, the pattern is different. In this case, the lefthand side is recognized as a bound variable, and will throw an error unless the value is exactly the same as the one the variable is bound to.
What this sounds more like is an assertion, like in xUnit. Well, sort of. It's a let statement the first time it's seen, after that, it's an assertion. I don't know if that fact is useful or not.
— Gordon Weakliem at permanent link
The New Outsourcing
I've read similar stories before, but the NY Times has a good story on how the world economy just gets weirder:
Such is the new outsourcing: A company in the United States pays an Indian vendor 7,000 miles away to supply it with Mexican engineers working 150 miles south of the United States border.
During the recent coverage of the UAW strike, the press has frequently mentioned that things are different than in the last nationwide strike some 30 years ago. This time, the Japanese automakers are now in position to be the dominant companies, and they're really no longer "imported" products as such; much of their product is manufactured in the US. In a similar evolution, not only are Indian companies moving operations to countries like Vietnam and the Philippines, they're going back to the US:
Wipro’s chairman, Azim Premji, told Wall Street analysts this year that he was considering hubs in Idaho and Virginia, in addition to Georgia, to take advantage of American “states which are less developed.”
My dad was visiting last weekend and we were marveling at how it can be cheaper to manufacture something in China, put that product on a ship to the US, and still have the product be cheaper than what it can be manufactured for in the US. Maybe that will change, the dollar's hitting record lows these days.