Aion
view release on metacpan or search on metacpan
i18n/Aion/Meta/Feature.ru-en.po view on Meta::CPAN
"The serial number of the feature in the class."
msgid "## required (;$bool)\n"
"Флаг обÑзаÑелÑноÑÑи ÑиÑи в конÑÑÑÑкÑоÑе (`new`)."
msgstr "## required (;$bool)\n"
"Flag for requiring a feature in the constructor (`new`)."
msgid "## excessive (;$bool)\n"
"Флаг избÑÑоÑноÑÑи ÑиÑи в конÑÑÑÑкÑоÑе (`new`). ÐÑли она Ñам еÑÑÑ Ð´Ð¾Ð»Ð¶Ð½Ð¾ вÑбÑаÑÑваÑÑÑÑ Ð¸ÑклÑÑение."
msgstr "## excessive (;$bool)\n"
"Feature redundancy flag in the constructor (`new`). If it is there, an exception should be thrown."
msgid "## isa (;Object[Aion::Type])\n"
"ÐгÑаниÑение Ñипа Ð´Ð»Ñ Ð·Ð½Ð°ÑÐµÐ½Ð¸Ñ ÑиÑи."
msgstr "## isa (;Object[Aion::Type])\n"
"Type constraint on feature value."
msgid "## lazy (;$bool)\n"
"Флаг ленивой иниÑиализаÑии."
msgstr "## lazy (;$bool)\n"
"Lazy initialization flag."
i18n/Aion/Meta/Subroutine.ru-en.po view on Meta::CPAN
msgid "Ð Ñак же ÑоздаÑÑ ÑÑнкÑиÑ-обÑÑÑÐºÑ Ð¿ÑовеÑÑÑÑÑÑ ÑигнаÑÑÑÑ."
msgstr "It also creates a wrapper function that checks the signature."
msgid "ÐонÑÑÑÑкÑоÑ."
msgstr "Constructor."
msgid "СоздаÑÑ ÑÑнкÑиÑ-обÑÑÑÐºÑ Ð¿ÑовеÑÑÑÑÑÑ ÑигнаÑÑÑÑ."
msgstr "Creates a wrapper function that checks the signature."
msgid "СвеÑÑÐµÑ ÑÐ²Ð¾Ñ (ожидаемÑÑ) ÑигнаÑÑÑÑ Ñ Ð¾Ð±ÑÑвленной Ñ ÑÑнкÑии в модÑле и вÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑение, еÑли ÑигнаÑÑÑÑ Ð½Ðµ ÑовпадаÑÑ."
msgstr "Checks its (expected) signature against the one declared by the function in the module and throws an exception if the signatures do not match."
msgid "СÑÑоковое опиÑание ÑÑнкÑии."
msgstr "String description of the function."
msgid "ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ð¿Ð°ÐºÐµÑа, в коÑоÑом обÑÑвлена ÑÑнкÑиÑ."
msgstr "Returns the name of the package in which the function is declared."
msgid "ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ ÑÑнкÑии."
msgstr "Returns the name of the function."
i18n/Aion/Type.ru-en.po view on Meta::CPAN
msgid "ÐÑовеÑÑеÑ, ÑÑо аÑгÑÐ¼ÐµÐ½Ñ Ð½Ðµ пÑÐ¸Ð½Ð°Ð´Ð»ÐµÐ¶Ð¸Ñ ÐºÐ»Ð°ÑÑÑ."
msgstr "Checks that the argument does not belong to the class."
msgid "ÐÑивеÑÑи `$value` к ÑипÑ, еÑли пÑиведение из Ñипа и ÑÑнкÑии наÑ
одиÑÑÑ Ð² `$self->{coerce}`."
msgstr "Cast `$value` to type if the cast from type and function is in `$self->{coerce}`."
msgid "ФоÑмиÑÑÐµÑ ÑообÑение оÑибки."
msgstr "Generates an error message."
msgid "ÐÑовеÑÑÐµÑ `$element` и вÑбÑаÑÑÐ²Ð°ÐµÑ ÑообÑение `detail`, еÑли ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð½Ðµ пÑÐ¸Ð½Ð°Ð´Ð»ÐµÐ¶Ð¸Ñ ÐºÐ»Ð°ÑÑÑ."
msgstr "Checks `$element` and throws a `detail` message if the element does not belong to the class."
msgid "ÐеÑÐµÐ²Ð¾Ð´Ð¸Ñ `$val` в ÑÑÑокÑ."
msgstr "Converts `$val` to a string."
msgid "ÐпÑеделÑеÑ, ÑÑо Ñип ÑвлÑеÑÑÑ Ð¿Ð¾Ð´Ñипом дÑÑгого `$type`."
msgstr "Specifies that a type is a subtype of another `$type`."
msgid "СоздаÑÑ Ð¿Ð¾Ð´Ð¿ÑогÑÐ°Ð¼Ð¼Ñ Ð±ÐµÐ· аÑгÑменÑов, коÑоÑÐ°Ñ Ð²Ð¾Ð·Ð²ÑаÑÐ°ÐµÑ Ñип."
msgstr "Creates a subroutine with no arguments that returns a type."
msgid "СвойÑÑво `init` не Ð¼Ð¾Ð¶ÐµÑ Ð¸ÑполÑзоваÑÑÑÑ Ñ `make`."
msgstr "The `init` property cannot be used with `make`."
msgid "Ð¡Ð¾Ð·Ð´Ð°ÐµÑ Ð¿Ð¾Ð´Ð¿ÑогÑÐ°Ð¼Ð¼Ñ Ñ Ð°ÑгÑменÑами, коÑоÑÐ°Ñ Ð²Ð¾Ð·Ð²ÑаÑÐ°ÐµÑ Ñип."
msgstr "Creates a subroutine with arguments that returns a type."
msgid "ÐÑли подпÑогÑамма не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ñоздана, Ñо вÑбÑаÑÑваеÑÑÑ Ð¸ÑклÑÑение."
msgstr "If the routine cannot be created, an exception is thrown."
msgid "Ð¢Ð¸Ð¿Ñ ÑавнÑ, еÑли они имеÑÑ Ð¾Ð´Ð¸Ð½Ð°ÐºÐ¾Ð²Ð¾Ðµ имÑ, одинаковое колиÑеÑÑво аÑгÑменÑов, ÑодиÑелÑÑкий ÑÐ»ÐµÐ¼ÐµÐ½Ñ Ð¸ аÑгÑменÑÑ ÑавнÑ."
msgstr "Types are equal if they have the same name, the same number of arguments, the parent element, and the arguments are equal."
msgid "ÐбÑаÑÐ½Ð°Ñ Ð¾Ð¿ÐµÑаÑÐ¸Ñ Ðº `equal`."
msgstr "The reverse operation of `equal`."
msgid "СпиÑок аÑгÑменÑов."
msgstr "List of arguments."
i18n/Aion/Types.ru-en.po view on Meta::CPAN
msgid "ÐÑполÑзÑеÑÑÑ Ñ `subtype` Ð´Ð»Ñ Ð²Ñвода ÑообÑÐµÐ½Ð¸Ñ Ð¾Ð± оÑибке, еÑли знаÑение иÑклÑÑÐ°ÐµÑ Ñип. Ð `$code` иÑполÑзÑеÑÑÑ: `SELF` - ÑекÑÑий Ñип, `ARGS`, `A`, `B`, `C`, `D...
msgstr "Used with `subtype` to print an error message if the value excludes the type. `$code` uses: `SELF` - the current type, `ARGS`, `A`, `B`, `C`, `D` - type arguments (if any) and a test value in `$_`. It can be converted to a string using `SELF-...
msgid "ÐобавлÑÐµÑ Ð½Ð¾Ð²Ð¾Ðµ пÑиведение (`$via`) к `$type` из `$from` Ñипа."
msgstr "Adds a new cast (`$via`) to `$type` from `$from` type."
msgid "ÐÐ¾Ð¶ÐµÑ Ð¸ÑполÑзоваÑÑ Ð¿Ð°ÑамеÑÑÑ Ñипа:"
msgstr "Can use parameters like:"
msgid "`coerce` вÑбÑаÑÑÐ²Ð°ÐµÑ Ð¸ÑклÑÑениÑ:"
msgstr "`coerce` throws exceptions:"
msgid "СÑандаÑÑнÑе пÑиведениÑ:"
msgstr "Standard casts:"
msgid "СинÑакÑиÑеÑкий ÑаÑ
Ð°Ñ Ð´Ð»Ñ `coerce`."
msgstr "Syntactic sugar for `coerce`."
msgid "ÐÑовеÑÑÐµÑ ÑигнаÑÑÑÑ Ð¿Ð¾Ð´Ð¿ÑогÑаммÑ: аÑгÑменÑÑ Ð¸ ÑезÑлÑÑаÑÑ."
msgstr "Checks the signature of a subroutine: arguments and results."
lib/Aion/Meta/Feature.pm view on Meta::CPAN
=head2 required (;$bool)
Flag for requiring a feature in the constructor (C<new>).
$::feature->required(1);
$::feature->required # -> 1
=head2 excessive (;$bool)
Feature redundancy flag in the constructor (C<new>). If it is there, an exception should be thrown.
$::feature->excessive(1);
$::feature->excessive # -> 1
=head2 isa (;Object[Aion::Type])
Type constraint on feature value.
use Aion::Type;
lib/Aion/Meta/Subroutine.pm view on Meta::CPAN
=head2 new (%args)
Constructor.
=head2 wrap_sub ()
Creates a wrapper function that checks the signature.
=head2 compare ($subroutine)
Checks its (expected) signature against the one declared by the function in the module and throws an exception if the signatures do not match.
=head2 stringify ()
String description of the function.
=head2 pkg ()
Returns the name of the package in which the function is declared.
=head2 subname ()
lib/Aion/Type.pm view on Meta::CPAN
my $Num = Aion::Type->new(name => "Num", message => sub {
"Error: $_ is'nt $Aion::Type::SELF->{N}!"
});
$Num->detail("x", "car") # => Error: x is'nt car!
C<< $Aion::Type::SELF-E<gt>{N} >> equivalent to C<N> in context of C<Aion::Types>.
=head2 validate ($element, $feature)
Checks C<$element> and throws a C<detail> message if the element does not belong to the class.
my $PositiveInt = Aion::Type->new(
name => "PositiveInt",
test => sub { /^\d+$/ },
);
eval {
$PositiveInt->validate(-1, "Neg")
};
$@ # ~> Neg must have the type PositiveInt. The it is -1
lib/Aion/Type.pm view on Meta::CPAN
BEGIN {
Aion::Type->new(name=>"Rim", test => sub { /^[IVXLCDM]+$/i })->make(__PACKAGE__);
}
"IX" ~~ Rim # => 1
The C<init> property cannot be used with C<make>.
eval { Aion::Type->new(name=>"Rim", init => sub {...})->make(__PACKAGE__) }; $@ # ~> init_where won't work in Rim
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make }; $@ # ~> syntax error
=head2 make_arg ($pkg)
Creates a subroutine with arguments that returns a type.
BEGIN {
Aion::Type->new(name=>"Len", test => sub {
$Aion::Type::SELF->{args}[0] <= length($_) && length($_) <= $Aion::Type::SELF->{args}[1]
})->make_arg(__PACKAGE__);
}
"IX" ~~ Len[2,2] # => 1
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make_arg }; $@ # ~> syntax error
=head2 make_maybe_arg ($pkg)
Creates a subroutine with arguments that returns a type.
BEGIN {
Aion::Type->new(
name => "Enum123",
test => sub { $_ ~~ [1,2,3] },
a_test => sub { $_ ~~ $Aion::Type::SELF->{args} },
)->make_maybe_arg(__PACKAGE__);
}
3 ~~ Enum123 # -> 1
3 ~~ Enum123[4,5,6] # -> ""
5 ~~ Enum123[4,5,6] # -> 1
If the routine cannot be created, an exception is thrown.
eval { Aion::Type->new(name=>"Rim")->make_maybe_arg }; $@ # ~> syntax error
=head2 equal ($type)
Types are equal if they have the same name, the same number of arguments, the parent element, and the arguments 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");
lib/Aion/Types.pm view on Meta::CPAN
BEGIN {
subtype 'Plus[acc]', as Num;
}
coerce &Plus, from Num, via { $_ + A };
Plus([5])->coerce(4) # -> 9
Plus([5]) >> 5 # -> 10
1 >> Plus[5] # -> 6
C<coerce> throws exceptions:
eval {coerce Int, via1 => 1}; $@ # ~> coerce Int unused keys left: via1
eval {coerce "x"}; $@ # ~> coerce x not Aion::Type!
eval {coerce Int}; $@ # ~> coerce Int: from is'nt Aion::Type!
eval {coerce Int, from "x"}; $@ # ~> coerce Int: from is'nt Aion::Type!
eval {coerce Int, from Num}; $@ # ~> coerce Int: via is not subroutine!
eval {coerce Int, (from=>Num, via=>"x")}; $@ # ~> coerce Int: via is not subroutine!
Standard casts:
( run in 2.189 seconds using v1.01-cache-2.11-cpan-f56aa216473 )