Skip to content

Commit

Permalink
v1.011000
Browse files Browse the repository at this point in the history
  - Add 'hash_of' (List::Objects::WithUtils::Hash::Typed)
     (Toby Inkster - github PR #3)
    These hashes perform type-checking on their values via Type::Tie.

  - List::Objects::WithUtils/Lowu now accept ':functions' import tag
    (':all' without autobox)

  - Array::Type now uses a Type::Tie tied array
     (Toby Inkster - github PR #2)
    This is faster (no more overload or method overrides), and allows for
    'push @$typedarr, $foo' with type coercion/checking.
  • Loading branch information
avenj committed Sep 5, 2013
1 parent 243d625 commit 5edadee
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Changes
@@ -1,5 +1,19 @@
Revision history for Perl module List::Objects::WithUtils

1.011000 2013-09-05

- Add 'hash_of' (List::Objects::WithUtils::Hash::Typed)
(Toby Inkster - github PR #3)
These hashes perform type-checking on their values via Type::Tie.

- List::Objects::WithUtils/Lowu now accept ':functions' import tag
(':all' without autobox)

- Array::Type now uses a Type::Tie tied array
(Toby Inkster - github PR #2)
This is faster (no more overload or method overrides), and allows for
'push @$typedarr, $foo' with type coercion/checking.

1.010002 2013-09-04

- Fix array->tuples() to skip adding unnecessary undefs
Expand Down
21 changes: 20 additions & 1 deletion README.mkdn
Expand Up @@ -13,6 +13,9 @@ List::Objects::WithUtils - List objects with useful methods
# Import 'array()', 'immarray()', 'hash()' object constructors:
use List::Objects::WithUtils;

# Import all functions:
use List::Objects::WithUtils ':functions';

# Import all of the above plus autoboxing:
use List::Objects::WithUtils ':all';
# Same, but via convenience shortcut:
Expand Down Expand Up @@ -111,7 +114,12 @@ List::Objects::WithUtils - List objects with useful methods
# Type-checking arrays:
use List::Objects::WithUtils 'array_of';
use Types::Standard -all;
my $ints = array_of( Int, 1 .. 10 );
my $int_arr = array_of( Int, 1 .. 10 );

# Type-checking hashes:
use List::Objects::WithUtils 'hash_of';
use Types::Standard -all;
my $int_hash = hash_of( Int, foo => 1, bar => 2 );

# Hashes can be inflated to objects:
my $obj = $hash->inflate;
Expand Down Expand Up @@ -159,6 +167,11 @@ A bare import list (`use List::Objects::WithUtils;`) will import the
Importing __array\_of__ gives you [Type::Tiny](http://search.cpan.org/perldoc?Type::Tiny)\-compatible type-checking array
objects; see [List::Objects::WithUtils::Array::Typed](http://search.cpan.org/perldoc?List::Objects::WithUtils::Array::Typed).

Importing __hash\_of__ gives you [Type::Tiny](http://search.cpan.org/perldoc?Type::Tiny)\-compatible type-checking hash
objects; see [List::Objects::WithUtils::Hash::Typed](http://search.cpan.org/perldoc?List::Objects::WithUtils::Hash::Typed).

Importing __functions__ or __:functions__ will import all of the above.

Importing __all__ or __:all__ will import all of the above and additionally turn
__autobox__ on, as will the shortcut `use Lowu;` (as of 1.003).

Expand Down Expand Up @@ -192,6 +205,9 @@ immutable arrays.
[List::Objects::WithUtils::Array::Typed](http://search.cpan.org/perldoc?List::Objects::WithUtils::Array::Typed) for more on `array_of()`
type-checking arrays.

[List::Objects::WithUtils::Hash::Typed](http://search.cpan.org/perldoc?List::Objects::WithUtils::Hash::Typed) for more on `hash_of()`
type-checking hashes.

[List::Objects::WithUtils::Autobox](http://search.cpan.org/perldoc?List::Objects::WithUtils::Autobox) for details on autoboxing.

The [Lowu](http://search.cpan.org/perldoc?Lowu) module for a convenient importer shortcut.
Expand Down Expand Up @@ -262,6 +278,9 @@ Immutable array objects were inspired by [Const::Fast](http://search.cpan.org/pe

Junctions are adapted from [Perl6::Junction](http://search.cpan.org/perldoc?Perl6::Junction) by Carl Franks.

Many of the useful type-checking bits were contributed by Toby Inkster (CPAN:
TOBYINK).

Much of this code simply wraps other widely-used modules, including:

[List::Util](http://search.cpan.org/perldoc?List::Util)
Expand Down
3 changes: 2 additions & 1 deletion dist.ini
Expand Up @@ -4,7 +4,7 @@ license = Perl_5
copyright_holder = Jon Portnoy
copyright_year = 2013

version = 1.010002
version = 1.011000

[@Basic]
[MetaJSON]
Expand Down Expand Up @@ -49,6 +49,7 @@ repository.type = git
perl = 5.006

autobox = 0
overload = 0
parent = 0
strictures = 1

Expand Down

0 comments on commit 5edadee

Please sign in to comment.