Sponsored Link •
|
Summary
The myth of functional language "purity" and marking side-effects in a programming language.
Advertisement
|
Many people talk about "pure" functional languages, where "pure" seems to be a synonym for "good". There are two traits commonly associated with the definition of a pure functional language:
The need of monads illustrates the simple fact that in order to have substantitve practical applications, a programming language must allow a program to interact with the environment during its execution (e.g. file-system, devices, clock, etc.). This implies that any non-trivial programming language must allow side-effects.
All of that said, it is much easier to reason about and manipulate (read: optimize) programs and sub-programs which don't have side-effects.
So the purity of a language is an impractical notion from a software development standpoint, however the idea of understanding and localizing side-effects (e.g. using monads) is nonetheless a very important and useful idea.
Where am I going with this? Well I believe that language designers can take a lesson from Haskell by isolating and labelling side-effects. Taking a far more simplistic approach than using monads, the approach I am exploring using later versions of Cat, is to label functions as "clean" and "dirty" depending on whether they have side-effects or not. This makes optimization much easier.
Any thoughts on the subject?
Have an opinion? Readers have already posted 46 comments about this weblog entry. Why not add yours?
If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.
Christopher Diggins is a software developer and freelance writer. Christopher loves programming, but is eternally frustrated by the shortcomings of modern programming languages. As would any reasonable person in his shoes, he decided to quit his day job to write his own ( www.heron-language.com ). Christopher is the co-author of the C++ Cookbook from O'Reilly. Christopher can be reached through his home page at www.cdiggins.com. |
Sponsored Links
|