Specio

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

- Types names are strings, but they're not global

    Unlike Moose and MooseX::Types, type names are always local to the current
    package. There is no possibility of name collision between different modules,
    so you can safely use short type names.

    Unlike MooseX::Types, types are strings, so there is no possibility of
    colliding with existing class or subroutine names.

- No type auto-creation

    Types are always retrieved using the `t()` subroutine. If you pass an unknown
    name to this subroutine it dies. This is different from Moose and
    MooseX::Types, which assume that unknown names are class names.

- Anon types are explicit

    With [Moose](https://metacpan.org/pod/Moose) and [MooseX::Types](https://metacpan.org/pod/MooseX%3A%3ATypes), you use the same subroutine, `subtype()`,
    to declare both named and anonymous types. With Specio, you use `declare()`
    for named types and `anon()` for anonymous types.

- Class and object types are separate

    Moose and MooseX::Types have `class_type` and `duck_type`. The former type
    requires an object, while the latter accepts a class name or object.

    With Specio, the distinction between accepting an object versus object or class
    is explicit. There are six declaration helpers, `object_can_type`,
    `object_does_type`, `object_isa_type`, `any_can_type`, `any_does_type`, and
    `any_isa_type`.

- Overloading support is baked in

    Perl's overloading is quite broken but ignoring it makes Moose's type system
    frustrating to use in many cases.

- Types can either have a constraint or inline generator, not both

    Moose and MooseX::Types types can be defined with a subroutine reference as the
    constraint, an inline generator subroutine, or both. This is purely for
    backwards compatibility, and it makes the internals more complicated than they
    need to be.

    With Specio, a constraint can have _either_ a subroutine reference or an
    inline generator, not both.

- Coercions can be inlined

    I simply never got around to implementing this in Moose.

- No crazy coercion features

    Moose has some bizarre (and mostly) undocumented features relating to coercions
    and parameterizable types. This is a misfeature.

# OPTIONAL PREREQS

There are several optional prereqs that if installed will make this
distribution better in some way.

- [Ref::Util](https://metacpan.org/pod/Ref%3A%3AUtil)

    Installing this will speed up a number of type checks for built-in types.

- [XString](https://metacpan.org/pod/XString)

    If this is installed it will be loaded instead of the [B](https://metacpan.org/pod/B) module if you have
    Perl 5.10 or greater. This module is much more memory efficient than loading
    all of [B](https://metacpan.org/pod/B).

- [Sub::Util](https://metacpan.org/pod/Sub%3A%3AUtil) or [Sub::Name](https://metacpan.org/pod/Sub%3A%3AName)

    If one of these is installed then stack traces that end up in Specio code will
    have much better subroutine names for any frames.

# WHY THE NAME?

This distro was originally called "Type", but that's an awfully generic top
level namespace. Specio is Latin for for "look at" and "spec" is the root for
the word "species". It's short, relatively easy to type, and not used by any
other distro.

# LONG-TERM PLANS

Eventually I'd like to see this distro replace Moose's internal type system,
which would also make MooseX::Types obsolete.

# SUPPORT

Bugs may be submitted at [https://github.com/houseabsolute/Specio/issues](https://github.com/houseabsolute/Specio/issues).

# SOURCE

The source code repository for Specio can be found at [https://github.com/houseabsolute/Specio](https://github.com/houseabsolute/Specio).

# DONATIONS

If you'd like to thank me for the work I've done on this module, please
consider making a "donation" to me via PayPal. I spend a lot of free time
creating free software, and would appreciate any support you'd care to offer.

Please note that **I am not suggesting that you must do this** in order for me
to continue working on this particular software. I will continue to do so,
inasmuch as I have in the past, for as long as it interests me.

Similarly, a donation made in this way will probably not make me work on this
software much more, unless I get so many donations that I can consider working
on free software full time (let's all have a chuckle at that together).

To donate, log into PayPal and send money to autarch@urth.org, or use the
button at [https://www.urth.org/fs-donation.html](https://www.urth.org/fs-donation.html).

# AUTHOR

Dave Rolsky <autarch@urth.org>

# CONTRIBUTORS

- Chris White <chrisw@leehayes.com>
- cpansprout <cpansprout@gmail.com>
- Graham Knop <haarg@haarg.org>

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.687 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )