Revision history for Function-Parameters
2.002004 2023-07-15
- Remove 'perl -T' from tests. This way we can run on perls compiled
without support for taint mode. The test didn't actually care about
taint anyway.
2.002003 2023-04-19
- Fix line numbers after inlined type checks (gh #42).
Previously, the code for type checks was inlined literally, so if a
particular check took 5 lines of code, all the following line
numbers in the source file would be off by 5 (they would be "pushed
down" by the interpolated code). These bad line numbers would show
up in error messages from Perl (including warn and die) as well as
__LINE__ and caller (and thus stack traces).
2.002002 2023-04-01
- Work around old versions of ExtUtils::MakeMaker not providing
is_make_type(), whose version dependency is undocumented (sigh).
- Restrict GNU syntax for exporting variables to type 'gmake'; should
fix building on BSD, Solaris, etc.
- Declare dependency on ExtUtils::MakeMaker 7+ and remove
compatibility code for older versions.
2.002001 2023-04-01
- Fix (hopefully) Windows builds using nmake.exe.
2.002 2023-04-01
- Provide //= for default arguments that are also used when the
caller passes in undef.
- Provide more type combinators in parameter declarations: In
addition to | (union types), now ~ & / are also supported (for
complement types, intersection types, and alternative types,
respectively).
- Enable type coercions. If a parameter has a declared type and that
type supports coercions ($type->has_coercion returns true), call
its ->coerce($value) method to transform arguments before type
checking.
- Enable inline type checks. If a parameter has a declared type and
that type supports inlining ($type->can_be_inlined returns true),
its inline code (as provided by ->inline_check('$value')) is baked
into the function definition instead of a call to ->check($value).
This may speed up type checks.
- Move a big chunk of tests to xt/ (author testing only).
- Remove xt/ from the distribution.
- Enable parallel testing by default (with -j4).
2.001006 2023-03-27
- Work around perl core issue GH#20950 (use re "eval" doesn't capture
lexical %^H environment like eval() does and stringifies it
instead) by downgrading the previous hard error to a warning (in
the new category 'Function::Parameters') and switching
Function::Parameters off in the affected scope.
2.001005 2023-01-27
- Fix failures with perl 5.37.5 .. 5.37.6 caused by new internal
opcode structure for anonymous subs.
2.001004 2023-01-20
- Drop Dir::Self test dependency (use FindBin instead).
2.001003 2017-11-11
- Fix threaded initialization issue better. This is the same issue
that was fixed in 2.001002, but now we use PL_op_mutex instead of
PL_check_mutex. This has the advantage of also being thread-safe on
v5.14.
2.001002 2017-11-09
- Fix crash when Function::Parameters is loaded at runtime by
multiple threads (a stack overflow due to infinite recursion).
This is arguably a core bug (RT#132413). The current workaround
employed by Function::Parameters slightly abuses an internal perl
mutex meant for something else (protecting op checkers), but it
fixes the issue on perls v5.16 .. v5.26.
v5.14 doesn't have this API yet, so the workaround is not thread
safe there. It is technically possible to still run into this issue
if two threads initialize Function::Parameters at the exact same
moment (I haven't managed to reproduce this yet, so hopefully it's
unlikely in practice).
It is possible to completely avoid the problem on all versions of
perl and Function::Parameters by making sure the module is loaded
before the first thread is created.
2.001001 2017-07-12
- fix duplicate type check on invocant:
method foo(T $self: $x) { ... }
# every call to foo() performs T->check($self) twice
- clean up how type errors refer to parameters (now it's
"parameter $N" for non-invocant parameters and "invocant $N" for
invocants (or just "invocant" if there is exactly one))
- rewrite pragma implementation and the way %^H is used
- remove several internal package variables
2.000007 2017-05-15
- no real code changes
- extend bug RT#129090 workaround to perl 5.25.5
- try to detect broken Moose installs earlier
- fix declaration of developer dependencies
2.000006 2017-04-16
- work around core bug RT#129090 / RT#131146 in perl 5.22 and 5.24:
perl -e 'use Function::Parameters; \&f; fun f() { eval "" }' hangs
in the compiler (also happens with perl -d or Devel::Cover instead
of eval) (gh #29)
2.000003 2017-03-31
- fix a bug where method modifiers would inadvertently declare subs
(e.g. 'before foo() {}' acting like 'sub foo;
BEGIN { &before('foo', sub {}) }'), breaking Pkg->can($method) and
thus Class::Method::Modifiers (RT #120804)
- make method modifiers take effect at runtime because otherwise
you'd have to wrap every with()/extends() in a BEGIN block to make
consumed/inherited methods visible to modifiers (RT #120804)
- make method modifiers require a name (what would an anonymous
modifier modify?)
- (hopefully) improve the error message you get for trying to add any
parameters after a slurpy
2.000002 2017-03-27
- default to strict mode
- allow types with multiple arguments (e.g. 'Tuple[Int, String]')
- implement new 'auto' type reifier and use it by default
- allow multiple invocants
- support custom installers
- implement Moo/Moose-style method modifiers
- rework and extend import syntax
- make implicit $self available in default arguments
- call type reifiers from correct package and remove 2nd arg
workaround
- remove :(...) prototype syntax
- remove undocumented 'attrs' option
- drop internal Moo dependency
1.0706 2017-03-17
- don't require . in @INC during install
- improve internal code generation functions used on perls before
5.22
1.0705 2016-06-11
- simplify internals
1.0704 2016-02-13
- guard against broken Mooses in Makefile.PL
- remove last internal use of glob()
1.0703 2016-01-05
- fix line numbers in runtime errors caused by calls with bad
arguments
(Carp trying to be smart and skipping over "internal" callers)
1.0702 2015-12-21
- fix parsing of _ in prototypes
(caused bogus "Illegal character after '_' in prototype" warnings)
1.0701 2015-12-04
- remove old "bare" import syntax:
use Function::Parameters 'foo', 'bar';
# equivalent to
# use Function::Parameters { foo => 'function', bar => 'method' };
(marked as deprecated in 0.06, no longer documented since 1.00)
1.0605 2015-04-26
- update metacpan links
- remove wonky test
1.0604 2015-04-22
- new explicit "lax" mode
- fix info() with taint mode on (gh pr #12)
- don't hide syntax errors that are followed by a parameter list with
types (gh #15)
- compatibility with perl v5.21.11 (#103843)
1.0603 2014-11-25
- some documentation changes
- compatibility with perl development versions
1.0602 2014-10-21
- fix warnings under perl5.21 (causes harmless test failure)
1.0601 2014-10-20
- allow nameless parameters for arguments that should be ignored
- fix string comparison bug (":lvaluefoobar" treated as ":lvalue",
etc)
- explicitly disallow $_/@_/%_ as parameters
- change "Not enough" to "Too few" in error message to match perl
- don't parse $#foo as a sigil plus comment
- remove implicitly optional parameters ("fun foo($x = 42, $y)" used
to be equivalent to "fun foo($x = 42, $y = undef)")
1.0503 2014-10-17
- skip initializing parameters if the default argument is undef
(don't generate '$x = undef if @_ < 1' for 'fun ($x = undef)')
1.0502 2014-10-16
- fix bug that prevents building with threaded perls
1.0501 2014-10-13
- support :prototype(...) for setting the prototype
- allow fun foo($x =, $y =) (empty default arg equivalent to
specifying undef)
1.0404 2014-10-13
- fix segfault on 'fun foo(A[[' (malformed type)
1.0403 2014-10-12
- general overhaul for 5.18 and 5.20 support
- be more flexible about strict 'vars' error message in tests
(#99100)
1.0402 2014-09-01
- fix #92871: don't access dead stack frames on error
- fix #95803: don't dereference NULL
1.0401 2013-10-09
- enable type checks by default
1.0301 2013-09-16
- support 'defaults' to base keywords on existing keyword types
- 'check_argument_count' no longer controls type checks
- new 'check_argument_types' property controls type checks
- new 'strict' property does what 'check_argument_count' used to
- new 'runtime' property lets you define functions at runtime
- some more tests
1.0202 2013-08-28
- make t/foreign/Fun/name.t less fragile to support newer Carp
- support older Moo without ->meta support
1.0201 2013-08-13
- custom (per-keyword) type reification
- actually use documented defaults for custom keywords
1.0104 2013-06-16
- support unicode in custom keywords
- actually validate default attributes
1.0103 2013-06-09
- properly allow non-moose-based custom type constraints (#85851)
1.0102 2013-03-08
- prepare for internals changes in the upcoming 5.18 release
(https://rt.cpan.org/Ticket/Display.html?id=83439)
- only allocate memory after recognizing a keyword like 'fun'
(might speed up parsing a little)
1.0101 2013-02-05
- new reflection API to inspect parameter information of functions
- Moose types in parameter lists
- more tests
1.0004 2012-11-26
- fix test relying on hash ordering
1.0003 2012-11-19
- clean up internals
- fix build errors on some platforms
- fix module metadata
- some more tests
1.00 2012-11-01
- add named parameters with ':$foo, :$bar' syntax
- rewrite documentation
- more tests (some of them copied from similar modules on CPAN)
0.10 2012-10-21
- add ':strict' import target
- support $invocant: parameter syntax
0.09 2012-10-14
- fix wrong line number for statement immediately following a
function
0.08 2012-07-19
- support UTF-8 in function/parameter names
- better detection of invalid prototypes
0.07 2012-06-25
- completely rework internals to generate optrees directly
(no more generating/reparsing source)
- simplify / fewer dependencies
- new feature: default arguments (on by default)
- new feature: strict argument count checks (off by default)
enabled by "*_strict" variants of symbolic types
0.06 2012-06-19
- complete rewrite in XS
- require perl 5.14+
- hopefully fix bug where it would get the line numbers wrong
- we're a lexical pragma now; remove import_into()
- more fine-grained control over behavior of generated keywords:
* function name can be optional/required/prohibited
* invocant name can be any variable, not just $self
* default attributes (and method now defaults to ':method')
0.05 2011-08-02
- complete rewrite
- hopefully fix bug where it would swallow compilation errors or get
the line numbers wrong
- method keyword!
- more flexible keyword customization
0.04 2010-03-03
- allow renaming the function keyword
- provide import_into so you can mess with other packages
0.03 2009-12-14
First version, released on an unsuspecting world.