Moose icon indicating copy to clipboard operation
Moose copied to clipboard

Support | overload to work better with MooseX::Types

Open colinnewell opened this issue 7 years ago • 3 comments

Copied override from MooseX::Types::TypeDecorator to allow union from all types. In theory this should mean we can remove it from MooseX::Types.

Allow:

my $type2 = $type1 | class_type('Bar');

as well as:

my $type1 = HashRef | class_type('Foo');

For RT#98809

colinnewell avatar Nov 22 '17 20:11 colinnewell

I don't think I like this as an internal part of Moose.

haarg avatar Nov 23 '17 01:11 haarg

To clarify, it isn't obvious what value this provides by being built in to the type system. The examples given could be done within the MooseX::Types system without involving the Moose internals. And it isn't providing any new functionality, only syntax sugar.

haarg avatar Nov 23 '17 01:11 haarg

I'm undecided. I'm not sure what actual value this would bring; maybe seeing some proposed documentation for this might help clarify things.

On Wed, Nov 22, 2017 at 5:34 PM, Graham Knop [email protected] wrote:

To clarify, it isn't obvious what value this provides by being built in to the type system. The examples given could be done within the MooseX::Types system without involving the Moose internals. And it isn't providing any new functionality, only syntax sugar.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/moose/Moose/pull/156#issuecomment-346514968, or mute the thread https://github.com/notifications/unsubscribe-auth/AASfy3MDcWynvsGVO60_UosxusMVfLx3ks5s5Mu9gaJpZM4Qn9u5 .

karenetheridge avatar Nov 23 '17 01:11 karenetheridge