3 ms·
Why are all "learning to program" languages these days duck typed / dynamically typed? Has it always been this way? Has SML, for example, been a first language
by vijucat 12y ago
Why are all "learning to program" languages these days duck typed / dynamically typed? Has it always been this way? Has SML, for example, been a first language of choice in Programming 101 in earlier decades?
Personal bias : I think there is a definite loss in not teaching about the power of static typing in a first language.
- noelwelsh 12y agoBeginners have very incomplete mental models of programming languages (if they didn't, they wouldn't be beginners...) I believe the experience of the PLT group, who have been teaching introductory programming for some 20 years and definitely understand type systems, is that static types can get in the way of learning. There are two reasons: - Type errors for most type systems are very difficult to diagnose for beginners. They often aren't, for example, located on the actual error location in Hindley-Milner style type inference. - Allowing students to run their code helps build a correct mental model. In particular it allows them to locate the errors in their code. Note that Pyret does have a facility for dynamic checks that serves a similar purpose to static types.
- vijucat 12y ago> located on the actual error location in Hindley-Milner style type inference Very interesting, thanks for the insight + reference to the PLT group.
- shriramkmurthi 12y agoIn addition to @noelwelsh's reply, I want to add that we are very much working on a type system (we have a working internal prototype). We are also working on a very different kind of type inference, unlike Hindley-Milner. For us, it's important that the error story be as good as the "proper functioning" story, which is why we haven't released these. But it does mean that in the near future, people will be able to program in the typed language starting whenever they want, including from the very beginning. (And then we can do some experiments, too!)