A lot of the talk about concurrency in Perl 6 so far has focused on primarily functional constructs: promises, which represent a piece of computation that will produce a value at some point in the future, and supplies, which represent computations that asynchronously produce many values over time. These are both desirable models. The latter is especially powerful, since every mutable object you write can be re-designed in terms of a stream of immutable events.

While functional approaches emphasizing immutability are a very natural fit for concurrent situations, sometimes an OO approach will simply capture the problem a lot more elegantly than a stream of events can. The OO approach to concurrency is not to eliminate mutation, but rather to keep it within a boundary. Good OO design, with appropriate use of data-hiding and following principles such as "tell, don't ask", allow us to reason about state, and in turn employ a strategy that keeps it safe under concurrent operations.

In this session I'll quickly recap OO, data hiding, and the notions of thread safety and transactionality. I'll then look through some different ways OO and concurrency can be put together. Finally, I'll look at a design that brings the object and event worlds together.