4 ms·
Well, Perl actually would return 2 in that case because the + turns it’s arguments into numbers… ;-) Yeah, I’m all for strong typing too. Most specs aren’t as
by ashton314 4y ago
Well, Perl actually would return 2 in that case because the + turns it’s arguments into numbers… ;-)
Yeah, I’m all for strong typing too.
Most specs aren’t as complex as the one I just threw up there. What I really like specs for is to tell me whether or not the function is meant to return a maybe tuple ({:ok, val} | {:error, “err”}) or if it will throw an error. Sometimes that’s not obvious from bigger functions, and it makes refactoring harder.
My ideal would be something like Typed Racket’s gradual typing, which would let you get static types around eg core modules that see a lot of use and where you use the types to check your assumptions but non-core modules can be untyped.