In fact the "concept OP is looking for" is called dependent type theory. However, this isn't even remotely implementable in Perl. Possibly in Scala or Haskell, definitely in more advanced languages like Idris. Not sure about Perl6.
So in the absence of "you cannot do it in a way that breaks invariants" types, a mixture of runtime/unit tests that can be fine-tuned on accuracy<------>speed scale makes for a poor but workable substitute.
In my opinion, anyway, but I'm going to put it to the test the hard way.
In reply to Re^3: A proper name for is_sorted function that can check more than just sorting order?
by Dallaylaen
in thread A proper name for is_sorted function that can check more than just sorting order?
by Dallaylaen
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |