Re:An Experimental New Type Inference Scheme for Rust
by pcwalton on Wednesday July 09, 2014 @04:45PM
(#8012144)
My colleague zwarich aptly said that "this changes our type inference algorithm from a master's thesis to a blog post". As we approach 1.0, language simplifications like this are really valuable; the fact that it doesn't break existing code is even better.
Re:An Experimental New Type Inference Scheme for Rust
by phkahler on Thursday July 10, 2014 @09:37AM
(#8014889)
I would say the fact that is doesn't break existing code is more like the minimum requirement ;-) Even better would be to work in every case the existing system does. But yeah, simplicity is very desirable.
Re:An Experimental New Type Inference Scheme for Rust
by sp332 on Thursday July 10, 2014 @10:28AM
(#8015058)
The rust language is still unstable. Breaking changes are expected up until the 1.0 release, because they want to make sure they get things right and don't have to live with bad syntax or semantics decisions made in 0.0.1 forever. After 1.0 it will be more stable :)
Re:An Experimental New Type Inference Scheme for Rust
by rayiner on Wednesday July 09, 2014 @04:02PM
(#8011921)
I really appreciate Niko's efforts into blogging about this sort of thing. It's really neat to watch Rust evolve in a fairly public manner. I'm not sure if there is any other language where these sorts of relatively early design decisions have been played out publicly before.
Re:An Experimental New Type Inference Scheme for Rust
by redline6561 on Thursday July 10, 2014 @04:43PM
(#8017166)
I always felt Slava Pestov's (now abandoned) blog on Factor's development was a good view into language design: http://factor-language.blogspot.com/
He and Andy Wingo (http://wingolog.org) both write very well on language issues though they may skew towards implementation concerns over design concerns.
Re:An Experimental New Type Inference Scheme for Rust
by jmgrosen on Wednesday July 09, 2014 @07:46PM
(#8012849)
As someone currently working on a type inference scheme himself (although for a completely different purpose) and who is a Rust programmer, this sure was an interesting article! The inner type theorist in me says that losing any amount of expressiveness is a bad thing, but in this case my pragmatism seems to win out and say that this simpler but weaker scheme is probably good enough :)
Re:An Experimental New Type Inference Scheme for Rust
by pcwalton on Wednesday July 09, 2014 @11:26PM
(#8013438)
The article gives an example of a program that fails to typecheck, based on function variance.
Note that this algorithm is based on HM. You can't do plain old HM if you have subtyping; you have to do some algorithm based on it. This is just one of many possible algorithms.
Re:An Experimental New Type Inference Scheme for Rust
by freyrs3 on Thursday July 10, 2014 @01:11AM
(#8013720)
Unidirectional inference in the presence of subtyping is undecidable in the general case. Languages like Haskell and OCaml don't have this problem because they don't include subtyping precisely for this reason.
I also found this article really interesting: http://smallcultfollowing.com/babysteps/blog/2014/05/13/focu....
He and Andy Wingo (http://wingolog.org) both write very well on language issues though they may skew towards implementation concerns over design concerns.
Note that this algorithm is based on HM. You can't do plain old HM if you have subtyping; you have to do some algorithm based on it. This is just one of many possible algorithms.