2 ms·
Making the computations type-level correct would be really neat! That'd be a huge improvement! I don't think the language needs to be statically-typed to do th
by wegs 6y ago
Making the computations type-level correct would be really neat! That'd be a huge improvement!
I don't think the language needs to be statically-typed to do that. I could easily extend Scheme or Python to support that. All you need to do is make sure that if you add 5 meters to 5 seconds, you raise an exception. There's no reason that exception has to happen at compile-time.
Going Scheme -> typed Scheme is a manageable step which I could envision taking a few weeks of hard work. Changing languages would be an incredible amount of work (especially with things like the JIT compiling MIT-Scheme does for SICM, where you can symbolically derive equations of motion, compile them, and run them as high-performance native code).
I've been using programming to teach kids math and physics, and the lack of units IS a serious pedagogical problem. I think that's doubly true here.
I think you're really onto something.
- lrc 6y agoI have done the translation from Scheme to Clojure which raises the possibility that some of the typing could be done gradually with spec; I haven't worked with typed scheme. There's a lot of code in the simplifier which is designed to work with S-expressions containing symbols. Changing them to work with an enriched type carrying unit information would be a big undertaking