The TC objects use C::MOP level attributes though, so no types.

Yes, I think it could be totally pushed outside of Moose, however a few things would need fixing, such as the type registry. If you were potentially using the TC system for something non-Moose related and didn't want Moose types you would want your own registry. If you were using it along with Moose then you might want it use the Moose registry as well. The registry object itself is hierarchal, but nothing has really taken advantage of that feature (it was originally added so that we could make package level registries that would "inherit" from the global registry).

- Stevan

On Sep 8, 2009, at 12:05 PM, Jesse Luehrs wrote:

On Tue, Sep 08, 2009 at 08:55:14AM -0700, John Napiorkowski wrote:
I've spent a lot of time thinking about the intersections of Moose and
Type Constraints.  My general conclusion is that I think it's correct
that TC and Moose general be detached (and I'd love to see more
detachment) since people have uses for type constraints beyond Moose.
That said, I think there is a bigger connection between TC and
Class::MOP, since my imagination is telling me that Moose will
eventually be more and more about suger and use, and functionality
will migrate toward CMOP.  For example, I know we keep kicking around
the idea that Roles should be in CMOP.  I also personally think some
of the bits in MooseX::Declare related to method signatures should
either be in CMOP or at least coordinated with a more rigorous
interface defined by CMOP. So again, my imagination is saying type
constraints are build on top of CMOP, and consumed by Moose or others.

In a more radical line of thought - could the type constraint system be
an entirely standalone module? Are there any parts of it that rely on
either Moose or Class::MOP? I guess the main issue would be circular
dependencies, since the tc objects use attributes, and attributes have
type constraints, but I wonder if there isn't a way to get around that. Conceptually, the type constraint system seems pretty separate already.

-doy

Reply via email to