User loginNavigation |
archivesCompositional type systems for stack-based low-level languagesCompositional type systems for stack-based low-level languages
I encountered the article while researching compositional type systems. I would like to hear people's thoughts about this article and compositional type-systems in general (are they interesting, esoteric, mundane?). Extending HM type inference -- would this be possible? Or even desirable?I wonder whether the following extension to the type inference mechanisms of languages like Haskell, ML, etc. would be possible, and, if so, desirable. Today we write functions like head (a:_) = a and get warning messages concerning patterns not covering all possibilities. This is fine. However, I am not being warned when the compiler sees code like head [] (even when head were defined like above, without a default clause that raises a runtime error.) In principle, though, the type inference could collect for each value of algebraic datatype by which constructor this value could possibly have been created. For example, the type of The consequence would be that it would be no longer worth a warning when writing functions with incomplete patterns. Rather, at the place where the function is used the compiler would be able to diagnose one of three outcomes: Case 1 could be treated like just another type error. Case 2 could provoke a warning. Case 3 is ok, of course. To be sure, that would also encourage a different style. Instead of writing dozens of meanigless default cases like (I hope I could express my thoughts clear enough despite english not being my native language.) Minimal FORTH compiler and tutorialRich Jones writes: I wanted to understand how FORTH is implemented, so I implemented it and wrote a step-by-step tutorial on what every bit does. The tutorial is inside a (literate) code file you can download and run. I've been told recently by people I trust that it is about time I learned Forth. This may be just what I was waiting for... |
Browse archivesActive forum topics |
Recent comments
22 weeks 1 day ago
22 weeks 1 day ago
22 weeks 1 day ago
44 weeks 2 days ago
48 weeks 4 days ago
50 weeks 1 day ago
50 weeks 1 day ago
1 year 5 days ago
1 year 5 weeks ago
1 year 5 weeks ago