On Mon, Jul 14, 2014 at 9:51 AM, David Jeske <[email protected]> wrote:
> On Mon, Jul 14, 2014 at 9:17 AM, Jonathan S. Shapiro <[email protected]> > wrote: >> >> Documentation is important, but readability is also important. Whether >> types help with readability is a matter of taste. I personally don't find >> that: >> >> arith 'a => >> fun add x : 'a y : 'a is x + y >> >> > >> is clearer than >> >> fun add x y = x + y >> >> > I'm dubious of these trivial examples. When this function is 400 lines > long and not trivial, the former is essential. > In some measure. Not sure I need every local variable typed explicitly even then. But my point was simply that real programs have lots of functions of lots of different complexity, and it doesn't seem like there is a good single answer for readability. > First for documentation, but also to guard forward compatibility of all > users of the function. Without a constraint like 'arith', the next > programmer extending the function thinks it's fine to start requiring lots > of other things of the input types because HIS/HER input types include them. > But the arith constraint is there either way, and it's part of the public signature of the procedure. If this procedure gets exposed at a module boundary, the type has to be there explicitly. shap
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
