2018-06-08 16:35 GMT+02:00 Nicolas Cellier <nicolas.cellier.aka.n...@gmail.com>: > > > 2018-06-08 14:50 GMT+02:00 Thierry Goubier <thierry.goub...@gmail.com>: >> >> Hi Ben, >> >> Interesting find. >> >> ... snip ... >> >> > Table 7 makes and interesting assertion that static types are more >> > important >> > for readability than preventing bugs. >> >> This one is in line with Dan Luu meta-study that static typing catches >> at best a small proportion of bugs. >> >> Note that this is used in Smalltalk, when you write anInteger, aString >> : you're using a form of typing for documentation. >> >> > Exactly! > > And if you transpose this style to static typing you get things like > Cat *theCat = new Cat; > Being tainted, I always thought that is was noise... > You'd better rename your variable felix;)
This is a good example of noise :) What my concern would be is that advances in AI, like the Bayou completion system, clearly shows that this is noise and that it can be inferred. > Static typing may help the IDE (refactoring and navigating). > My POV is thus that you enter this information for the tools, not for the > humans (compiler, navigator, refactoring engine, ...). I used to believe that, and then I switched to a slightly different view, thanks to some use of the OCaml type inference. In some cases, when you design systems for reuse (for example libraries), you understand that you're building code generic enough to accept a lot more than the types you intent to allow (and even static type inference manages to infer that fact for you). So, to ease reuse and maintenance of your code, typing the API (either by naming convention or by restricting types in OCaml) can be a good solution. Now, the real need for types is when you want to do high performance compilation, because compilers are pretty bad at type inference (and need very precise and limited types to produce efficient code). > I have differently tainted colleagues still thinking that the type help them > reading code... > So, IMO, this assertion reflects the dominant culture rather than intrinsic > merits. I still think that whatever name you use for your variables, you often convey an idea of a type with your naming choices (i.e. felix is probably a cat, probably not a dialog box....) > IOW, if you want to create a successfull language, just clone an existing > one :( Thierry > Nicolas > >> By the way, I wrote for fun a small metalink-based run-time >> type-checker using method argument names. To be used when running unit >> tests :) >> >> Regards, >> >> Thierry