Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There isn't some unified continuum of power in languages, though. There are some problems for which a H-M-ish type system is a tremendous advantage, and there are others for which it gets in the way. Same with lazy evaluation - it can make a problem much simpler or much harder to reason about. Sometimes using a language built from the ground up to support distributed and concurrent programming (e.g. Erlang), unification and backtracking (Prolog), or constraint programming is the right tool for the job. Sometimes being able to work close to the Unix kernel or run on an embedded system without an OS is more important.

Languages are a means to an end -- they help manage complexity while solving a problem. There's value in being able to extend a language's semantics to support a superset of several major language families, but unless handled very carefully, it can turn the host language into a sprawling mess in the process.



That's why we need a language with a scalable type system that supports both static and dynamic typing. (Actually VB had that years ago with Variant data types, but the rest of the type system was horrible.)


I suspect it might be fruitful to do static analysis for constraints, with type identity as just one attribute. While inferring that X is an int is useful, inferring that it's an int which is always positive and less than 256 would allow a lot of other optimizations. Even if an inference engine can't completely prove something is always a (string * int list) pair, it would still be useful to know that it's (string * (either int or double) list), and the list cannot be empty. Etc. Type declarations or inference are a bit all-or-nothing, and I think being able to read through the properties that the compiler could infer (or at least confirm) would help find bugs, suggest optimizations, etc.

If I ever get past the first dozen projects on my list, I'd like to write a compiler for a dialect of Prolog designed with constraint analysis in mind. (I also need to read more about what's already been tried, first - this is just me being curious about how far constraint analysis could go and wondering out loud.) It would be tricky, but more feasible with Prolog-like semantics than in, say, C.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: