Thoughts of Immutable and Partially Immutable Programming Languages

This post isn’t about language bashing. If you inherit a large body of code, say for a tax billing system, you realize you won’t be re-writing any of that code anytime soon, especially if you don’t know RECAP from January 1 Owners or Excise Service Warrants from Urgent Parking Notices.

Because it was here to stay, at least for a while, I learned to like Informix 4GL. I have pushed the language to its limits, including blowing the stack, evidenced by cursors never reaching the end of their working sets. I prefer other languages, like Clojure, Perl, and Python, but we’re making a cost-saving decision now to go back to well-worn and tested 4GL programs for generating water liens (for unpaid water bills) rather than re-writing everything in a language we deem “better”.

Instead, this is post is about the musings of Scala and Python, and how one achieves as close to pure functional programming with these languages. I have written a major project in Python, and know a reasonable amount about the language. I’ve had only a slight peak at the Scala for the Impatient (a very good read by the way), and am by no means an expert, let alone even knowledgeable.  With Haskell and Clojure, your variables are always immutable. In Clojure you could defeat immutability by using and modifying a  ref. 

Can you achieve enough immutability with tuples in Python for it to be considered functional, and whether or not you can achieve immutability enforcing the use of

 val 

in Scala programs? Over the years, I have worked for well-run development groups, and despite good management and team interaction, not everything could be enforced, especially with coding style, and definitely when defining objects when C++ first began to be a viable programming language.

I will continue to dabble in Clojure, write major new programs in Perl, and maintain the old 4GL software, and somewhere keep thinking about immutability.

Advertisements

Leave a comment

Filed under Programming

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s