Aion
view release on metacpan or search on metacpan
2.0 2026-06-17T09:49:32Z
- variable in subtype as
- Maybe[A] as A | Undef
- Opened[num] limit in Range
- hash for elements in Enum. Was $_ ~~ [e...]
- added methods is_union, is_range, is_primitive, asen and etc.
- added simplify, subset, operators <, >, ==, eq, cmp, etc.
- coerce maked as prototype for type
- cached testers parents
1.9 2026-04-14T17:58:35Z
- added property example to Aion::Type
- where optional in parametrised subtype
- operator >> for corerce added to Aion::Type
1.8 2026-04-09T19:37:48Z
- $Aion::pleroma replace to Aion->pleroma for autoinitialization
ExIs->new(ro => 10)->wo(30)->has_wo # -> 1
ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!
ExIs->new(ro => 10)->rw(30)->rw # -> 30
```
ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:
```perl
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
# And by setter:
$node->parent($root = Node->new);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
```
## isa => $type
УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи.
ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:
* `Aion::Type` â Aion ÑÑÐ°Ð·Ñ Ð¸Ð¼Ð¿Ð¾ÑÑиÑÑÐµÑ Ð² Ð¿Ð°ÐºÐµÑ Ð²Ñе ÑÐ¸Ð¿Ñ Ð¸Ð· [Aion::Types](https://metacpan.org/pod/Aion::Types).
* СÑÑоки воÑпÑимаÑÑÑÑ ÐºÐ°Ðº пакеÑÑ Ð¸ обоÑаÑиваÑÑÑÑ Ð² `Object`.
i18n/Aion/Type.ru-en.po view on Meta::CPAN
msgid "УпÑоÑение вÑÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð² ÑÑой ÑÑнкÑии возможно поÑвиÑÑÑ Ð² бÑдÑÑем."
msgstr "Simplification of the expression in this function may appear in the future."
msgid "ÐонÑÑанÑа Ð´Ð»Ñ Ñипа вклÑÑаÑÑего вÑе знаÑениÑ."
msgstr "A constant for a type that includes all values."
msgid "ÐонÑÑанÑа Ð´Ð»Ñ Ð¿ÑÑÑого Ñипа, не вклÑÑаÑÑего ниÑего."
msgstr "Constant for an empty type that does not contain anything."
msgid "Ð¢Ð¸Ð¿Ñ ÑавнÑ, еÑли они имеÑÑ Ð¾Ð´Ð¸Ð½Ð°ÐºÐ¾Ð²Ñй пÑоÑоÑип (`coerce`), одинаковое колиÑеÑÑво аÑгÑменÑов, ÑодиÑелÑÑкий ÑлеменÑ, иÑ
аÑгÑменÑÑ Ð¸ M и N Ñав...
msgstr "Types are equal if they have the same prototype (`coerce`), the same number of arguments, parent element, their arguments, and M and N are equal."
msgid "ÐбÑаÑÐ½Ð°Ñ Ð¾Ð¿ÐµÑаÑÐ¸Ñ Ðº `identical`."
msgstr "Reverse operation to `identical`."
msgid "Тип не пеÑеÑекаеÑÑÑ Ñ Ð´ÑÑгим Ñипом."
msgstr "A type does not overlap with another type."
msgid "ÐпÑеделÑеÑ, ÑÑо он ÑвлÑеÑÑÑ Ð¿Ð¾Ð´Ð¼Ð½Ð¾Ð¶ÐµÑÑвом Ñказанного Ñипа."
msgstr "Specifies that it is a subset of the specified type."
lib/Aion.md view on Meta::CPAN
ExIs->new(ro => 10)->wo(30)->has_wo # -> 1
ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!
ExIs->new(ro => 10)->rw(30)->rw # -> 30
```
ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:
```perl
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
# And by setter:
$node->parent($root = Node->new);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
```
## isa => $type
УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи.
ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:
* `Aion::Type` â Aion ÑÑÐ°Ð·Ñ Ð¸Ð¼Ð¿Ð¾ÑÑиÑÑÐµÑ Ð² Ð¿Ð°ÐºÐµÑ Ð²Ñе ÑÐ¸Ð¿Ñ Ð¸Ð· [Aion::Types](https://metacpan.org/pod/Aion::Types).
* СÑÑоки воÑпÑимаÑÑÑÑ ÐºÐ°Ðº пакеÑÑ Ð¸ обоÑаÑиваÑÑÑÑ Ð² `Object`.
lib/Aion.pm view on Meta::CPAN
ExIs->new(ro => 10)->ro # -> 10
ExIs->new(ro => 10)->wo(30)->has_wo # -> 1
ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!
ExIs->new(ro => 10)->rw(30)->rw # -> 30
The function with C<*> does not hold the meaning:
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
# And by setter:
$node->parent($root = Node->new);
$node->parent->parent # -> undef
undef $root;
$node->parent # -> undef
=head2 isa => $type
Indicates the type, or rather - a validator, feature.
Can take:
=over
=item * C<Aion::Type> â Aion immediately imports all types from L<Aion::Types> into the package.
lib/Aion/Type.pm view on Meta::CPAN
Any <= Any # -> 1
None <= Any # -> 1
Any <= None # -> ""
=head2 None
Constant for an empty type that does not contain anything.
=head2 identical ($type)
Types are equal if they have the same prototype (C<coerce>), the same number of arguments, parent element, their arguments, and M and N are equal.
my $Int = Aion::Type->new(name => "Int");
my $PositiveInt = Aion::Type->new(name => "PositiveInt", as => $Int);
my $AnotherInt = Aion::Type->new(name => "Int", coerce => $Int->{coerce});
my $IntWithArgs = Aion::Type->new(name => "Int", args => [1, 2]);
my $AnotherIntWithArgs = Aion::Type->new(name => "Int", args => [1, 2], coerce => $IntWithArgs->{coerce});
my $IntWithDifferentArgs = Aion::Type->new(name => "Int", args => [3, 4]);
my $Str = Aion::Type->new(name => "Str");
$Int->identical($Int) # -> 1
local ($::_g0 = do {ExIs->new(ro => 10)->wo(30)->has_wo}, $::_e0 = do {1}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'ExIs->new(ro => 10)->wo(30)->has_wo # -> 1' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0...
eval {ExIs->new(ro => 10)->wo}; local ($::_g0 = $@, $::_e0 = 'Feature wo cannot be get!'); ok defined($::_g0) && $::_g0 =~ /^${\quotemeta $::_e0}/, 'ExIs->new(ro => 10)->wo # @-> Feature wo cannot be get!' or ::diag ::_string_diff($::_g0, $::_e0, 1);...
local ($::_g0 = do {ExIs->new(ro => 10)->rw(30)->rw}, $::_e0 = do {30}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, 'ExIs->new(ro => 10)->rw(30)->rw # -> 30' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:
#
package Node { use Aion;
has parent => (is => "rw*", isa => Maybe[Object["Node"]]);
}
my $root = Node->new;
my $node = Node->new(parent => $root);
local ($::_g0 = do {$node->parent->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
undef $root;
local ($::_g0 = do {$node->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
# And by setter:
$node->parent($root = Node->new);
local ($::_g0 = do {$node->parent->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
undef $root;
local ($::_g0 = do {$node->parent}, $::_e0 = do {undef}); ::ok defined($::_g0) == defined($::_e0) && $::_g0 eq $::_e0, '$node->parent # -> undef' or ::diag ::_struct_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## isa => $type
#
# УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи.
#
# ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:
#
# * `Aion::Type` â Aion ÑÑÐ°Ð·Ñ Ð¸Ð¼Ð¿Ð¾ÑÑиÑÑÐµÑ Ð² Ð¿Ð°ÐºÐµÑ Ð²Ñе ÑÐ¸Ð¿Ñ Ð¸Ð· [Aion::Types](https://metacpan.org/pod/Aion::Types).
# * СÑÑоки воÑпÑимаÑÑÑÑ ÐºÐ°Ðº пакеÑÑ Ð¸ обоÑаÑиваÑÑÑÑ Ð² `Object`.
( run in 1.165 second using v1.01-cache-2.11-cpan-2398b32b56e )