Re:Moving from Ruby to Rust
by j88439h84 on Friday February 15, 2019 @03:04AM
(#19169266)
Not if you use pypy and mypy.
[ Parent
| on HN ]
My issue with mypy is that I would like it to verify that I'm passing the right types into functions from my dependencies. For example, I do a lot of scripting with Python and boto3 to interact with AWS, and my scripts often fail the first time because I misread the field name or structure of a JSON object that goes into or comes from the API. It makes me wish I was using Java or Go, because at least then the compiler would have told me it was wrong.
I'm not sure if a solution to this exists yet. It seems like it's up to the dependency to adopt mypy as well?
Yeah I think so.
There is monkeytype which can infer the types from test runs and insert them into source, so its quite easy to add annotations.
There's also things like numba - basically a Python decorator that lazily JIT-compiles Python functions to LLVM, and supports numpy. For scientific work, it's quite often hard to beat (and sometimes somehow beats a raw c/c++ implementation of the same thing).