On Mon, 23 Feb 2009, Moritz Lenz wrote:

Timothy S. Nelson wrote:
        Another question for everyone - is there some way I can extend a class
in such a way that it implements another role?

class A does B does C { ... }

where B and C are roles.

For example, say I have a
class Class::A that implements role Role::A, and I want it to also implement
Role::B (and I provide an implementation), is there any way I can make it so
that *every* instance of Class::A implements Role::B, while doing this from a
module that doesn't contain Role::B?

Well, the Role::B must be visible in your scope where you do the

Or is your question much more complicated than that, and I am simply to
dumb to grasp it?

Maybe I'm too dumb to communicate it. Let me give an example. Say I do this:

$file = IO::File.new(...)

And I want all IO::File objects anywhere in my program (including ones returned from other libraries) to all be able to .bark(). Can I do something like this?

use     File::Barker;

$file = IO::File.new(...)

Is there something that will make that work, *without* me having to edit IO::File?

I think this might be Subject-oriented programming, but the Wikipedia page on that isn't very useful.


| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: wayl...@wayland.id.au    | I am                           |

Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V- PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-

Reply via email to