User loginNavigation 
Type inference for free?Hello everybody, this is my first post, so please be gentle... (actually i was passive around here for years, and find LtU a great source of inspiration and wisdom). I'm not at all into dynamic typing, i find static typechecking superior in any way. However, recently i just had the thourght: "If all I want to write is a single sideeffectfree, IOfree, terminating function F(x), with well defined argument and returntypes. And further, if I am able to come up with an x which trigger all branches (selections and pattern matches) of F, then i can get static (compile time) typing of F in a dynamically strong typed language." Suppose i write F in the dynamically strong typed language, which does the following: Immediatly after each compile of F, evaluate F(x), (yes, please). If it does not crash (or loop forever) F is typesafe, else report an error. The idea is that typechecking F is no harder than evaluating it on a sufficiently large test set argument. Is this sound? If yes, what about the next step: If it shows be the evaluation that F(x) has a strong typing, would it be possible to record all types of all expressions and create G, equivalent to F decorated with type annotations? I do realize i'm asking for (usually turingcomplete) typeinfernce for free... By OleKristensen at 20070712 21:51  LtU Forum  previous forum topic  next forum topic  other blogs  6457 reads

Browse archivesActive forum topics 
Recent comments
1 hour 54 sec ago
1 hour 35 min ago
3 hours 47 min ago
4 hours 9 min ago
7 hours 29 min ago
8 hours 34 min ago
12 hours 8 min ago
12 hours 46 min ago
1 day 39 min ago
1 day 1 hour ago