3 ms·
More languages need to go the Leiningen/Clojure route and make the language version work in a way similar to import/require statements or be specifiable in a ma
by malandrew 13y ago
More languages need to go the Leiningen/Clojure route and make the language version work in a way similar to import/require statements or be specifiable in a manifest file. IIRC, with lein you specify the clojure language version you want in the project manifest file.
For interpreted languages, I don't know why we can't just do something like:
#!/usr/bin/env ruby-2.1.1
In the main() file of our application.
Languages in general would be better off designed around having an executable that bootstraps loading the version appropriate for the code you are trying to execute. i.e. the `ruby` executable shouldn't be versioned, but instead be designed to to determine the version of ruby you need and then execute your code using that version. The obvious way is to have user's specify the version they need, but there is nothing stopping someone from creating a tool from each language that does nothing more than trying to parse the AST for a language and searching for tokens and language features that identify that code as being executable with version X, Y or Z. Furthermore, the language could easily keep a key-value db on disk whose sole responsibility is keeping keys that are the absolute path of the file on disk and the values are the mtime and sha256 of the file and the version of the language with which to execute that file when not explicitly stated in the file or program manifest.