tobyink/p5-type-tiny

Call to `tie` does not initialize variable as documented

m-dango opened this issue · 1 comments

There are places in the documentation where Perl's tie is used to initialize a variable. However, the args given after the type look to be dropped. I'm not sure if this is a documentation error or a bug.

https://replit.com/@m-dango/TypeTiny-tie#main.pl

tie my $count, Int->plus_coercions(Num, 'int $_'), 0;

This is a bug. It works when you use Type::Tie's ttie wrapper, but not when you directly tie a variable to a type. Should be fixed in the next release.

Further, from the next release, this should work:

tie my $x, Int;
say $x;   # 0, not undef, because undef isn't an integer!