Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 34039
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: stevan.little [...] gmail.com
Requestors: mschwern [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.38
Fixed in: (no value)



Subject: as should take a list
I'm sitting in a Moose tutorial and came across a bit of example code like this: subtype "HashArrayMonster" => as "HashRef|ArrayRef" ; My immediate thought was, "pipe delimited string? Really? Why not a list?" as should take an array ref.
"Foo|Bar" is *not* just a pipe delimited list of class names, it is a type specification, so taking an array ref would not make sense. With the type specifications you can create much more complex types such as "ArrayRef[ Int | HashRef[Str] | IO::Handle ] | Maybe[Foo]" (which is of course, quite ridiculous, but you get the point. Types like this would horrendously complex if we didn't do it with strings. If you care to discuss this further, please stop by #moose again or feel free to email the list at moose@perl.org. Thanks, - Stevan
"Foo|Bar" is *not* just a pipe delimited list of class names, it is a type specification, so taking an array ref would not make sense. With the type specifications you can create much more complex types such as "ArrayRef[ Int | HashRef[Str] | IO::Handle ] | Maybe[Foo]" (which is of course, quite ridiculous, but you get the point. Types like this would horrendously complex if we didn't do it with strings. If you care to discuss this further, please stop by #moose again or feel free to email the list at moose@perl.org. Thanks, - Stevan