tag:blogger.com,1999:blog-4614454413380107813.post2570647261492797981..comments2014-02-18T21:28:44.428-03:00Comments on One Mistake After Another: The Essence of Dynamic TypingDanielhttp://www.blogger.com/profile/05150497263726512307noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-4614454413380107813.post-62921466629509508452013-01-13T09:47:45.099-02:002013-01-13T09:47:45.099-02:00&quot;program to have static guarantees over some ...&quot;program to have static guarantees over some areas and not over others&quot; <br /><br />- Shen (http://shenlanguage.org/) has this ability. For a concrete example see https://groups.google.com/d/msg/qilang/PPT-j2gptIM/wbDHxmD7AyEJArtella Codinghttps://www.blogger.com/profile/07484438843480760855noreply@blogger.comtag:blogger.com,1999:blog-4614454413380107813.post-61619590722263257492012-05-03T14:17:22.809-03:002012-05-03T14:17:22.809-03:00&gt; In this point of view trying to avoid the exe...&gt; In this point of view trying to avoid the execution of paths that a program don&#39;t execute is a wasteful tautology: &quot;avoid doing what you won&#39;t do&quot; is a meaningless advice.<br /><br />I keep hearing arguments like this. But out in the real world, the value of static typing, as experienced by a programmer, stems more from the help in avoiding mistakes that would otherwise cost a lot of time debugging at runtime - like typos, passing in wrong objects, missing implementations etc - and, productivity frameworks like better intellisense, refactoring tools etc. made possible by the type system.Sanjayhttps://openid.aol.com/opaque/c159ecfa-9543-11e1-b4e3-000bcdca4d7anoreply@blogger.comtag:blogger.com,1999:blog-4614454413380107813.post-42857370028471710462012-05-03T13:14:07.987-03:002012-05-03T13:14:07.987-03:00If we think of a &quot;type&quot; as the set of va...If we think of a &quot;type&quot; as the set of values which can be represented at a point in an expression, and if we back off from classifying languages as statically or dynamically typed, the task of integrating statically typed code and dynamically typed code becomes more tractable.<br /><br />And, as you point out, &quot;statically typed languages&quot; do need to deal with the same kinds of issues that we need to deal with in &quot;dynamically typed languages&quot;. Quite often the set of values which can be treated before some function would be referenced is larger than the domain of that function.<br /><br />Put differently, an &quot;assertion&quot; or an &quot;error&quot; can be treated as a &quot;run-time error&quot; or it can be treated as a &quot;type declaration&quot;. If it is treated as a &quot;type declaration&quot; its constraints might propagate backwards in the code, or even as a compile time error.<br /><br />The problem, here, is one of simplicity. Statically typed languages punt on some typing issues because those issues were deemed, by the language designer(s), to be too complex for static analysis to be a productive approach. In complex cases, full static analysis can approach the difficulty of the halting problem (or, in cases which are not that bad, can approach the difficulty of the knapsack problem).<br /><br />Anyways, in my experience, using static typing in an otherwise dynamic language can be a great technique for eliminating overhead which would otherwise be necessary for proper treatment of irrelevant cases.rdmhttps://www.blogger.com/profile/13809495052049903484noreply@blogger.comtag:blogger.com,1999:blog-4614454413380107813.post-15634785213938818782012-05-03T13:06:43.535-03:002012-05-03T13:06:43.535-03:00@gasche That point is older than Bob Harper&#39;s ...@gasche That point is older than Bob Harper&#39;s post, I first saw it in LtU discussions, by Frank Atanassow. I didn&#39;t link to Harper&#39;s post because I find it a bit too pro static typing which I find contrary to the goal of understanding the actual essence of dynamic typing.Daniel Yokomizohttps://www.blogger.com/profile/12528969103424062002noreply@blogger.comtag:blogger.com,1999:blog-4614454413380107813.post-9600531331653215302012-05-03T13:03:00.900-03:002012-05-03T13:03:00.900-03:00@James undefined definitely is trapped by most lan...@James undefined definitely is trapped by most languages in the form of exceptions, but I don&#39;t think it&#39;s essential to this issue. Perhaps I should&#39;ve used a different word, but nothing comes to mind. Otherwise agree 100%.Daniel Yokomizohttps://www.blogger.com/profile/12528969103424062002noreply@blogger.comtag:blogger.com,1999:blog-4614454413380107813.post-15826275085232462122012-05-03T12:56:48.718-03:002012-05-03T12:56:48.718-03:00Slight issue with the use of &quot;undefined&quot;...Slight issue with the use of &quot;undefined&quot; for what most languages do when bad things happen: they throw an exceptions (or conditions or whatever). It&#39;s possible to put formal semantics on exceptions and it has been done. More pragmatically, as a programmer I can count on the behavior of exceptions when writing my program.<br /><br />When I read &quot;undefined&quot; I expect unsafe behavior that absolutely cannot be reasoned about, e.g. writing to a null pointer in C or having data races in shared mutable memory.James Iryhttps://www.blogger.com/profile/02835376424060382389noreply@blogger.comtag:blogger.com,1999:blog-4614454413380107813.post-48103366589146621332012-05-03T10:29:10.556-03:002012-05-03T10:29:10.556-03:00The point that dynamic languages can be seen as st...The point that dynamic languages can be seen as static languages with only one type has been made by Robert Harper :<br /><br /> http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/<br /><br />For an example of rather successful mix of typed and untyped languages, see Typed Racket. It has a type system that is expressive and complex enough to typecheck idiomatic Lisp programs (which are harder to type-check that idiomatic ML programs, because they replace type-informing pattern matching by boolean conditions)<br /><br /> http://docs.racket-lang.org/ts-guide/<br /><br />For serious attempts at integrating dynamic-minded capabilities in a static language, see Alice ML (inspired from Oz), and more recently Scala (in particular reflection).<br /><br /> http://www.ps.uni-saarland.de/alice/<br /> http://www.mozart-oz.org/gaschehttps://www.blogger.com/profile/06100241581708586136noreply@blogger.com