4 ms·
Sounds like what Perl 6 does :) You can add optional type signatures, and you get compile-time checks disallowing impossible usages of these: > sub takes-str
by tadzik_ 8y ago
Sounds like what Perl 6 does :) You can add optional type signatures, and you get compile-time checks disallowing impossible usages of these:
> sub takes-string(Str $foo) { }
sub takes-string (Str $foo) { #`(Sub|94327719210888) ... }
> takes-string(5); say "Hi!"
===SORRY!=== Error while compiling:
Calling takes-string(Int) will never work with declared signature (Str $foo)
------> <BOL>⏏takes-string(5); say "Hi!"