[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lightness vs. Largeness
> You could argue that that someone should have read the docs about my
> function wanting Cats and should not be passing Dogs in. But isn't
> that what the type system should be checking for me?
So you have two options:
1. add an assertion that you want cats -- the type system will then catch
it.-- doing this stuff occasionally is a lot less work than explicit type
annotation on every function
2. have the type inferencer describe the function only in terms of the
classes that appear in your test cases. So if you have only tested with
cats, the function appears only to take cats.
If you use option #2 then the docs would read:
function appears to take all mammals but has only been tested with cats.
Your mileage may vary.
-Alex-
___________________________________________________________________
S. Alexander Jacobson i2x Media
1-917-783-0889 voice 1-212-697-1427 fax