Home > Uncategorized > What Role do Traits Play?

What Role do Traits Play?

August 31st, 2006

Over at ONLamp, chromatic has a great review of Roles in Perl 6. I’m very excited to see more languages take up Traits or Roles, as it truly does speak towards how many of us write software today. Or at least how we’re trying to write software despite language constraints. While dynamically typed languages serve their purposes well, I always have to look away when I write my own class-based dispatch in a method (particularly operators), or do a respond_to? check in the code when I’d be more than happy for the compiler to do this for me.

Of course, the limitations of inheritance-based polymorphism are all around us (as discussed in the above article), and attempts at making life better have had mixed results (interfaces). It seems as though some type of soft typing in combination with type inferencing will be what we’re all using in a few years (if you’re not already). The next question, then, is will programmers actually include optional type specifications, or will everyone just leave everything as the most generic type possible? I’d hate to think the future will be C#/Java/WhateverStaticallyTypedLanguage where everything is of type object.

Share
Categories: Uncategorized Tags:
Comments are closed.