We had another great meeting last night. As usual, when interesting
people get together, even without an agenda, an interesting
conversation gets going.
Below are notes about some of the things we discussed. Feel free to
post comments, improvements and corrections:
* ACTORS
Lyle Kopnicky talked about actors and using them in the Oz programming
language. My best attempt to explain actors in a single sentence is
that they're concurrently executing units of logic similar to threads
(and are often built on threads), but have no shared state and instead
communicate through messages.
Actors seem appropriate for those situations where you'd typically use
threads: low-overhead concurrent in-process computation. Because
actors isolate state within themselves and the rest of the world can
only interact with them through well-formed messages, this eliminates
many problems associated with coordinating multiple threads that are
collectively manipulate shared state.
Oz made using actors easy and succinct because it offers easy access
to threads and blocks execution on unbound variables, e.g. pass a
message to an actor with an unbound variable as a kind of placeholder
and assign it later, so the actor can continue to run until it tries
to use the variable and blocks until its set to something.
However, the downside of actors is that they're less well supported or
understood by most programmers than threads, which are already
considered tricky, and add more indirection to the code. A bigger
issue is whether actors or threads are an appropriate solution for a
given task, because many of the examples discussed later seemed like a
better fit for message-oriented middleware (MOM) where a one process
enqueues a job with the middleware process, and then another process
gets a job from the middleware and works on it. Unlike most
implementations of actors or threads, middleware typically provides
natural ways to scale the worker pool, limit the numbers of workers
running at once, can be easily made durable enough to preserve
messages through crashes, and often allows workers to be written in
different programming languages. Lastly Oz's clever features and
specialized syntax for dealing with concurrency made code so succinct
that it surprised and confused many us unfamiliar with the language.
If someone or a group would be interested in presenting more about
concurrency and dealing with state in functional way, we'd love to
hear it.
Learn more about:
- Actors and libraries for many programming languages:
http://en.wikipedia.org/wiki/Actor_model
- Actors and their ilk from a Ruby perspective:
http://www.slideshare.net/mperham/actors-and-threads
- Scala offers threaded and event-based actors:
http://www.scala-lang.org/node/242
- Oz programming language:
http://www.mozart-oz.org
* LEGACY HASKELL CODE, TESTING AND CODE COVERAGE
Someone asked how to cope with inheriting a large legacy Haskell
codebase that needed new features added, lots of unused code removed,
and much code that needed refactoring.
Suggestions were to add tests and code coverage ASAP. Tests make it
easier and safer to add functionality, remove unused code, and
refactor. Code coverage identifies what code is used, which is helpful
in figuring out what code is useful but needs tests or is irrelevant
and should be removed. Learn about various Haskell tools, techniques
and issues at <
http://stackoverflow.com/questions/3120796/haskell-testing-workflow>.
* STATIC ANALYSIS OF HASKELL
Someone asked how to perform static analysis on Haskell code.
Suggestions included using Haskell Source
<
http://hackage.haskell.org/package/haskell-src> and Source Extensions
<
http://hackage.haskell.org/package/haskell-src-exts>. Also suggested
was compiling to Core and analyzing the output
<
http://stackoverflow.com/questions/6121146/reading-ghc-core>.
* KOTLIN
Kotlin is a new JVM language written by the clever people at
JetBrains. It can use Java libraries, compiles as quickly as Java, is
safer and more concise than Java, and avoids various pitfalls in
Scala. Apparently some feel it's stable enough now that it's worth
using for new projects instead of Scala. Although Kotlin has many
features we'd expect in a functional language, it's primarily intended
for OOP. Learn more about Kotlin at <
www.jetbrains.com/kotlin/>.
* PRONUNCIATION
A brief debate broke out over the correct pronunciation of "Haskell".
Opinions seemed to range from "feh" to "Those pronouncing 'Haskell'
like 'Pascal' will be the first against the wall when the revolution
comes." You may be interested in hearing some guy named Simon
pronounce "Hasekll" at
<
http://www.youtube.com/watch?v=iSmkqocn0oQ#t=197s> and amused by this
somewhat helpful 4chan thread which contains naughty words
<
http://dis.4chan.org/read/prog/1212717072>. Meanwhile, no consensus
was reached on the correct way to pronounce "tuple".
* NEXT MEETING
We'll hopefully have presentations next month on:
* Parser combinators in Haskell, what are and why may want to implement your own
* Writing a JSON validator DSL in functional-style Ruby
-igal