After the discussion, some pondering and hearing from Goro, I've decided that
TB2::Mouse will be marked for internal use only.

1. People are uncomfortable that I'm shipping a copy of Mouse::Tiny,
   let alone making it public.

2. If it's private now, it can be made public later.  Can't do it the
   other way around.

3. We don't need it for stable.

4. Mouse is a very easy dependency.  It has no dependencies and can
   work without a compiler.  There's not much value in providing a
   bundled copy.  They can just depend on Mouse.

5. Goro wants it that way.

Except there's a problem.

In order to properly subclass a TB2 module your subclass must use TB2::Mouse.
 You can't use Mouse.  For example.

    package My::TAP::Formatter;
    use Mouse;
    extends 'TB2::Formatter::TAP::v13';

    has '+show_tap_version' =>
        default => 0;

This doesn't work.  Mouse doesn't see the superclass's attributes because they
were declared by a different namespace, TB2::Mouse.  The subclass must use
TB2::Mouse if it wants to override attributes.  I hadn't realized that.  It
also must use TB2::Mouse if it wants to consume TB2 roles.

This offers two choices:

#1 Subclass authors will just have to deal.

#2 TB2::Mouse is available IF AND ONLY IF you are subclassing
   or using a role.

#1 isn't much different from the status quo of subclassing a non-Mo[ou]se Perl
5 OO module... except for the problem of roles.

#2 is effectively publishing it.

This is not academic.  TB2::Event and TB2::EventHandler are roles.  Writing
new Events and EventHandlers are the primary way to extend how TB2 works.
They could be turned into classes, but that would make things more difficult
to extend.

There is a 3rd choice, which brings us full circle to where this discussion
started.  We write TB2::Object [1] to select load Mouse if its available,
TB2::Mouse otherwise.  That way TB2 classes are compatible with Mouse just in
time.  They also get a performance kick.

The core gets the "for internal use only" marked TB2::Mouse as previously
discussed.

The examples in the TB2 documentation can be changed to always show them using
Mouse, further distancing TB2::Mouse from user eyeballs who might want to
abuse it.

The end result is...

1. The core gets a shrouded copy of Mouse::Tiny, with different
   namespaces, as discussed at the beginning.

2. TB2 gets a performance kick once Mouse is installed.

3. Extension authors can use Mouse to subclass TB2 and consume
   TB2 roles as normal.

4. TB2 continues to be able to take full advantage of Mouse.

Nobody needs to ever know there's a copy of Mouse::Tiny in there.

Thoughts?


[1] I'd probably reverse it so that TB2::Mouse is the selector and TB2::Object
is the Mouse::Tiny copy, but I don't want to make the discussion more
confusing than it is.


-- 
s7ank: i want to be one of those guys that types "s/j&jd//.^$ueu*///djsls/sm."
       and it's a perl script that turns dog crap into gold.

Reply via email to