4 ms·
First of all, adding optional static typing is not "trying to stay current". You may be surprised (I certainly was), but at the last ECOOP it was very clear tha
by pron 11y ago
First of all, adding optional static typing is not "trying to stay current". You may be surprised (I certainly was), but at the last ECOOP it was very clear that the typed/untyped/optionally-typed debate is very much alive and well. Second, optional typing in itself is a hot topic (regardless of the merits of static typing), with some very interesting work. See, e.g. the extremely-powerful-but-not-yet-production-ready pluggable type systems supported by Java 8: http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html http://types.cs.washington.edu/checker-framework/current/che..., or Gilad Bracha's optional types in Dart.
- jerf 11y agoI'm generally underwhelmed with the whole idea of optional typing in general, because it seems like a solution to the problem of sucky static type systems. The solution is, static type systems that don't suck. If you have that, optional typing seems a lot less interesting. Programming in 2015 seems to be in this really weirdly reactionary mode to the problems of the 1990s in so many places. ("Event-based programming" as an escape from 1990s-styles threading is another one.) Umm, well, it's great that we learn from the 1990s as much as we learn from any other decade, but I'm not convinced optional typing solves the problems of 2015.
- pron 11y agoThe search for type-systems-that-don't-suck is very much ongoing and there's no solution in sight. You need to find one that is 1/ understandable and palatable to the human mind, 2/ powerful enough to specify properties of interest and 3/ can be inferred as much as possible to reduce effort. Even deciding what those "properties of interest" alone may be is very much an open question. Right now, some advanced type systems simply specify those properties that happen to be easy to infer rather than those properties that would be most valuable (i.e. cause the most expensive bugs). And, of course, you still have the halting problem fighting you at some of those most painful points. For an interesting (though very partial) discussion of the difficulties, see Lamport's Should Your Specification Language Be Typed?[1] It speaks about specification rather than programming language, but once you decide to introduce rich type systems to programming languages (which was not so much in fashion among PL researchers when that paper was written) the problems become similar (and when he says "statically typed programming languages" he means C or Java -- not Haskell). In the conclusion he even hints at optional types: But typed formalisms that permit automatic type checking are less flexible than set theory. The best way to catch errors may be to treat type declarations as annotations that do not affect the meaning of the specification. If the type system proved to be too inflexible, one could replace it by a different one or simply ignore certain type errors. [1]: http://research.microsoft.com/en-us/um/people/lamport/pubs/lamport-types.pdf http://research.microsoft.com/en-us/um/people/lamport/pubs/l...
- j_m_b 11y agoCould you expand on your definition of "properties of interest"? I think Haskell's type system satisfies your list of requirements.
- pron 11y ago> I think Haskell's type system satisfies your list of requirements. :) Haskell doesn't even come close. Haskell's type system is pretty much defined to be any property that happens to be inferrable by the (extended) HM algorithm. It's like: "we'll prove what we easily can" rather than "let's prove what's most useful". Sure, it may be useful in some (or perhaps many) circumstances, but it's far from the set of properties I think anyone would list when asked "what properties would you most like to verify about your program?" For example, the two most basic tests for any formal verification system is verifying a sorting algorithm (like, say, QuickSort) and verifying a distributed algorithm (like, say, Paxos). Haskell's type-system fails to do both. Again: it cannot verify the two most common examples that people want automatic verification for. In fact, it is even too weak to verify that the monads it so depends on are actually monads. Still, it places a non-negligible burden on the developer that many would deem substantial or even onerous. And because types place some burden on the developer, you can then ask whether the set of verifiable properties is worth it or not (BTW, that any form of formal verification requires effort is pretty much a given; if it didn't, that would be a violation of the halting theorem). OTOH, richer type systems (that include dependent types) can no longer infer everything, and they become (much) harder-yet to use. Here are some examples of properties of interest: 1. When a request arrives at my server, a response (either a result or an error), is always produced within a given time frame. There can never be deadlocks, livelocks or starvation. 2. X and Y are two columns in my data table that must always satisfy certain invariants, and must never be observed to violate those variants. 3. My O(n) selection algorithm is correct. 4. My (sorting) algorithm requires O(1) space. 5. When a user inputs "X" the system will (or will-never) output "Y" within 5 seconds. There are many, many more. I picked those because there are formal verification tools today that can verify all those properties (or at least many interesting instances of them). Of course, some proofs would require your computational model to be non-Turing complete, because the halting problem is real...
- thesnider 11y agoI don't think that optional typing is in general an attempt to solve sucky static type systems -- instead, many researchers and organizations view it as a way of converting programmers who have only seen Java into developers that willingly use the type checker. It's a great motivator when you experience a bug in production that the runtime helpfully reminds you could've been caught if only you'd turned on types in that code :).