From Brazil to Wikipedia

The Surprising Journey of a Programming Language from Rio

(Alex Dixon / Flickr)

Last month, the San Francisco–based Wikimedia Foundation, which maintains Wikipedia, announced that it was changing the way some of the site’s more complex pages are configured. Prior to this, these pages were built using Wikipedia’s own homegrown template language. Over time, however, the system proved too limiting -- for example, editors had to come up with nearly a page of code just to determine the length of a piece of text. By 2011, the foundation’s engineers had started looking for a better solution. One of the options was embedding the popular JavaScript language, used in most web browsers. The engineers looked especially closely at the version of JavaScript developed by Google, the Internet behemoth based in nearby Mountain View, in the heart of Silicon Valley. But they eventually looked farther afield, settling on Lua, a programming language developed by a trio of researchers in Rio de Janeiro, Brazil.

How did a programming language from the global South manage to make it into one of the world’s most popular web sites? Lua’s story, as it turns out, tells a lot about the globalization of software development and the difficulties faced by innovators in developing countries.

I first heard of Lua eight years ago, when I traveled to Rio de Janeiro to interview software engineers for a research project that was recently published as a book, Coding Places. While in Rio, I met “Rodrigo” (who has asked to remain anonymous), who worked on a free and open-source web platform. He surprised me by telling me that the project was based on a new programming language, Lua, developed by a small team at Pontifícia Universidade Católica do Rio de Janeiro (PUC-Rio), where Rodrigo had been a student.

I knew that PUC-Rio’s computer science program was considered one of Brazil’s best, and I was intrigued by the engineer’s reliance on local innovation. Even so, the project sounded futile. The world of software is dominated by network effects: The more people use a piece of software, the more valuable it becomes. This is particularly true for programming languages. For engineers, going with widely used languages means access to more jobs that require knowledge of those languages and more ready-built modules in that language to repurpose. For employers, using a popular language makes it possible to hire from a larger pool of engineers. Consequently, although countless programming languages have been developed, only a handful have been widely adopted. And nearly all of those originate from major U.S.-based corporations or research centers. None that I knew at the time came from a developing country.

Against this background, Lua’s chances seemed slim. So I decided to spend my time studying how local engineers applied technologies developed abroad -- a situation that seemed more common in Brazil and in the developing world at large. Just to be sure, of course, I did ask a few of my Brazilian interviewees what they thought of Lua. Most had never heard of it. Those who had, knew it was something that “the guys” at PUC-Rio were working on, but conveyed little confidence that it would succeed.

My opinion of Lua changed a year later, when, back in California, I read an article about the language on a popular site for technical news. Lua, it appeared, had a small but dedicated following outside Brazil. It was being used in numerous products, most notably in the World of Warcraft, a wildly popular online game in which players could employ Lua to customize the game’s user interface. I started thinking that I had perhaps missed something on my previous visit to Brazil.

I decided that I would devote a return trip to Brazil to exploring the Lua ecosystem by spending a few months working with Rodrigo on his project inside a small company in Rio. I planned to interview Lua’s authors and contributors, attend Lua programmer meet-ups and other events, and find other companies using the language. The first task was relatively easy. The second two, surprisingly, were not. There just weren’t any Lua events to attend, and I could find only one other company in Rio using the language. To observe Lua being used, I probably should have stayed in San Francisco. As it turned out, the language’s success abroad and its relative lack thereof at home were closely related.

Software projects do not exist in a vacuum. They are usually embedded in a web of relationships, tied to other projects, people, and organizations. A project born in the right place -- say, on the campus of a major corporation in the heart of Silicon Valley -- can rely on such ties to rise to global prominence. JavaScript, for example, was developed in the 1990s for use in Netscape Navigator, then the world’s most popular web browser. This early start made JavaScript into one of the world’s most popular programming languages, despite many engineers’ concerns about its poor design.

A project born in a place like Rio de Janeiro must approach its early ties more cautiously. To have a chance of success elsewhere, it must first become mobile by dislodging itself from its original context. The history of Lua was a story of such dislodging. The language was originally developed in the early 1990s as part of its authors’ work at Tecgraf, a PUC-Rio consulting venture that offered services to Petrobras, Brazil’s biggest oil producer. Being embedded in software destined for Petrobras was perhaps the best local starting point for Lua, as the oil company is known for its commitment to innovation. But to have a shot at global success, Lua had to disentangle itself from its early national alliances and look for friends elsewhere.

Take the decision of the language’s creators to write Lua’s documentation (the instructions on how to use Lua) in English. Wikimedia Foundation’s engineers note Lua’s excellent documentation as one of the reasons for choosing it over Google’s version of JavaScript. Yet the situation is quite different for potential users of Lua in Brazil. The most popular book on Lua programming, written by one of Lua’s authors, a professor at PUC-Rio, is not available in Portuguese. In fact, prior to 2007, the language had no Portuguese documentation at all, requiring Brazilian users to have strong English skills. Prioritizing Portuguese documentation would have made life a lot easier for them. It would also have greatly reduced Lua’s chances of being adopted by projects such as Wikipedia.

Lua’s international success was facilitated by Lua’s increasing ability to fill a particular niche. Lua is especially useful for providing end users with an easy way to program the behavior of a software product without getting too far into its innards. The number of projects around the world needing such functionality is quite significant. Their number, however, is quite small in Rio, where most software projects involve building web applications, a task for which Lua was poorly suited. Rodrigo’s company was seeking to mend this -- his project ultimately aimed to extend Lua to web development. Until he succeeded, though, Lua was a better fit for foreign projects.

Cutting local ties is not enough, however. Global ties must be formed and exercised. For Lua, its team’s integration into the international world of academic computer science provided an early start. In 1996, the team published a paper about Lua in a U.S. journal read widely by American software developers, including videogame engineers at LucasArts, who decided to integrate Lua into one their games. Thanks to LucasArts programmers, Lua soon had friends in the right places. In 1998, LucasArts engineers advocated for Lua at the Games Developer’s Conference, the world’s largest game development event, in San Jose, California. Quite soon, other companies were decided to incorporate the language into their products as well.

Lua’s relative isolation in its early life turned into an unexpected strength. JavaScript, although widely used, is often condemned as an “ugly” language. Such ugliness is the flip side of its popularity: The language bears battle scars of the so-called browser wars of the late 1990s, when Netscape and Microsoft fought for browser market share. Yet fixing JavaScript’s problems would be nearly impossible due to its ubiquity and would have required somehow correcting the myriad web browsers and websites that rely on older versions of JavaScript. Lua, in contrast, could turn its back on its past several times. In fact, seeing no commercial prospects for Lua early on, the team had decided to make the language free. It has since focused on elegance and usability.

Lua’s strategy helped the language attain global success. This success, however, has brought few direct benefits to Rio de Janeiro and Brazil. Rodrigo’s project for adapting Lua to web development has, for the most part, become dormant. Rodrigo himself has moved back to working with JavaScript. Still, the phrase “developed in Brazil” is now heard quite a bit more often software circles in California. Who knows what opportunities the future will bring?

Could Lua’s team have made the language more useful for Brazil by focusing on local applications and embedding it tightly into a local innovation system? There are many reasons to think that this strategy would not have been successful. Although talk of local innovation is a staple of technology policy, few engineers in Rio express any interest in locally grown solutions. Whether this is a matter of prejudice or pragmatism, Brazilian engineers tend to look outward, seeking to solve their problems using the same technology used by their peers around the world. They will look at Lua when it becomes globally established. As a longtime supporter of Lua told me, “Lua had to succeed abroad to gain acceptance at home.”

Lua’s story offers no silver bullet for the technologists in the global South. For them, global success requires shedding local ties and, should all go well, returning home triumphant. It is a treacherous road. The global deck is stacked against them: They live in the wrong places, speak the wrong languages, and are saddled with the wrong institutions. But the alternative strategy of focusing on innovation highly tailored to local contexts is no solution either. In a world dominated by network effects, local users will choose global solutions. This means innovation at the periphery remains difficult. With enough people trying, there will hopefully be more Luas in the years to come, arriving from places like Brazil, China, and Russia. The largest share of benefits of such projects, however, might still accrue in places like San Francisco.

Browse Related Articles on {{search_model.selectedTerm.name}}

{{indexVM.results.hits.total | number}} Articles Found

  • {{bucket.key_as_string}}