On 1/9/06, Isaac Gouy <igouy / yahoo.com> wrote: > Eivind Eklund wrote: > > At this cost, the type and variable declarations had better give us a > > lot. In practice, I find that they give me very little, bug wise: > > Maybe 5% of my simplest bugs are detected by them. The advantages I > > get are in the speed of the compiled code, and as documentation. > > However, these benefits are too small to be worthwhile for the size > > projects I presently do (one and two person projects). > > Does a language with type-inference require as many type and variable > declarations as a language without type-inference? Does a reference to declaring types and variables make it clear to you that we're talking about a language where you have to declare types and variables, and *not* one based on type inference? > Is the C++ type system the same as the SML type system? Does the SML type system include declaring types and variables to the degree of taking up roughly half the code? > Will programmers who passively suffer compiler type-checking detect as > many bugs as programmers who actively use 'type-full' programming as a > checking-tool? Will people that use the annoying technique of asking bad rethorical questions get on your nerves too? ;) Really, and in all friendliness, the question isn't if they'll detect as many bugs. The question is if those that tries to use types as a checking tool find so many bugs and/or get so many other benefits that the costs introduced by the types are worth it. The answer will vary by language, by environment, by programmer, and by methodology used. I believe the static type system of SML or Haskell may well be worth it - I've just not worked enough with it to know. For me, in the environment I work in, with the ways I work with Ruby, I've found that very few of my bugs would be caught by extra type checking. I just don't end up with wrongly typed data much at all, and in the few cases where I do, the errors have come up immediately. Since I wrote my type checking library, I've not had a subtle bug that would be caught by more type checking. Before I wrote the type checking library, I thought that adding more type checking would catch a significant amount of bugs. When I added more type checking and found that it got in the way, I started looking for cases where it would have helped. I found very few, and they've so far shown up immediately (as methods missing). Eivind.