You, Too, Can Be on the Cutting Edge of Functional Programming Research
Programming in the 21st Century - James Hague - May 08, 2012In 1999 I earned $200 writing an essay titled Toward Programmer Interactivity: Writing Games in Modern Programming Languages. It was an early, optimistic exploration of writing commercial games in Haskell, ML, and Lisp.
It was not a good article.
It’s empty in the way that so many other “Hey everyone! Functional programming! Yeah!” essays are. I demonstrated the beauty of Haskell in the small, but I didn’t offer any solutions for how to write state-heavy games in it. There are a few silly errors in the sample code, too.
Occasionally during the following years, I searched for information about writing games in functional languages, and that article kept coming up. Other interesting references turned up too, like papers on Functional Reactive Programming, but apparently I had accidentally become an authority. An authority who knew almost nothing about the subject.
I still didn’t know if a mostly-functional style would scale-up past the usual toy examples. I didn’t know how to build even a simple game without destructive assignment. I wasn’t sure if there were even any legitimate benefits. Was this a better way of implementing game ideas than the usual tangled web of imperative code—or madness?
As an experiment, I decided to port an action game that I wrote in 1997 to mostly-pure Erlang. It wasn’t a toy, but a full-featured game chock full of detail and special cases. I never finished the port, but I had the bulk of the game playable and running smoothly, and except for a list of special cases that I could write on a “Hello! My Name is” label, it was purely functional. I wrote about what I learned in Purely Functional Retrogames.
Now when I search for info about writing games in a functional style, that’s what I find.
Sure, there are some other sources out there. Several times a year a new, exuberant “Haskell / ML / Erlang is a perfect match for games!” blog entry appears. Functional Reactive Programming keeps evolving. A couple of people have slogged through similar territory and managed to bang-out real games in Haskell (Raincat is a good example).
If you want to be on the cutting edge of functional programming research, it’s easy. Pick something that looks like a poor match for state-free code, like a video game, and start working on it. Try to avoid going for the imperative pressure release valves too quickly. At some point you’re going to need them, but make sure you’re not simply falling back on old habits. Keep at it, and it won’t be long before you’re inventing solutions to problems no one else has had to deal with.
If you come up with something interesting, I’d like to hear about it.
(If you liked this, you might enjoy Back to the Basics of Functional Programming.)
Categories: Blogs Programming in the 21st Century
Erlang on Twitter
» Erlang_07 (Erlang ): @dwiafrianii d ngertiin dong
» nsolop (El Socio): Erlang, ¿entienden eso?, Erlang!
» Erlang_07 (Erlang ): @rhy_cherry acikk
» casio_juarez (Casio Juarez III): RT @coreyhaines: In Chicago on Monday? Want to see me give a book report on neural networks and erlang? http://t.co/ZvJUfuTfpH
» NotDoctorOk (Not Richard O'Keefe): Yes, the debt to the Smalltalk 4-pane browser and its “method categories” *is* pretty obvious, isn’t it? http://t.co/KKKgf7qK7W
» PetrMyazin (Petr Myazin): Funniest programming language promotion video I’ve ever seen http://t.co/Sh2DwB5G86 #erlang #otp
» jimmyhwang (James Hwang): Erlang is more interesting than I thought. Many concepts in Golang influenced from Erlang. Also, first time playing with “real” FP
» SNTalentHiring (SNTALENT Empleo): Lead Server Core Developer (Java/Erlang) http://t.co/IFaqmh3y9O #empleo #Barcelona #Internet #tecnología #TIC
» TrainByTweet_VO (TrainByTweet_VO): VOIP: Blocking probability can be calculated from erlang-B formula
» agisanast (Agis Anastasopoulos): ok, it’s actually an IRC bot I’ve been writing in #erlang.. https://t.co/Yo5Dbc18PV
Statistics
Number of aggregated posts: 10648
Most recent article: May 14, 2013
Latest comments
» Moraru on This is Why You Spent All that Time Learning to Program: It is true that computer science was a pain in the back at time that i’ve had to learn it…
» Commercial hand dryers on Couchbase Meetup at new HQ: Buy online from here where you will get so much of variety in Commercial hand dryers for people. If you…
» Fort McMurray Homes on Motivated Reasoning and Erlang vs Python vs Node: I don’t really understand why this post is motivational? I don’t even see a post, just a title. Fort McMurray…