On Wed, Oct 26, 2005 at 08:48:12PM -0400, Rob Kinyon wrote:
: If a role is an immutable class, that means that its internals cannot
: be changed. Hence, the compiler can trust that it will be the same at
: the end as at the beginning. Which means it's optimized. Which means
: my objects run faster if I create them from roles than if I create
: them from classes. And, given that this seems to be the sole
: difference between them (mutability vs. immutability), why would I use
: classes as my standard?

Because it might be a premature optimization to the extent that it
restricts flexibility before you know whether it's going to affect
performance.  Part of the power of Ruby on Rails reputedly comes from
the fact that Ruby leaves its classes open by default.

Larry

Reply via email to