News for hackers. Stuff that matters.
Re:Lily: An interpreted language with a focus on expressiven... by the_duke on Thursday July 19, 2018 @01:37PM (#17568645)
It was weird for me at first, but actually Rust provides a great solution here.

With https://github.com/DanielKeep/cargo-script you can have single file Rust "scripts" with ecosystem dependencies.

When executing the file (via the cargo-script wrapper), dependencies are fetched and a binary is compiled on demand (and cached for re-runs).

It's pretty awesome for scripts where type safety is important.

    #!/usr/bin/env run-cargo-script
    //! This is a regular crate doc comment, but it also contains a partial
    //! Cargo manifest.  Note the use of a *fenced* code block, and the
    //! `cargo` "language".
    //!
    //! ```cargo
    //! [dependencies]
    //! time = "0.1.25"
    //! ```
    extern crate time;
    fn main() {
        println!("{}", time::now().rfc822z());
    }
Then you can just execute it with ./my-script, which will download dependencies, compile and execute.
Re:Lily: An interpreted language with a focus on expressiven... by dmux on Thursday July 19, 2018 @03:41PM (#17569611)
Likewise with Apache Groovy, which has optional typing:

    #!/usr/bin/env groovy
    // @Grab annotation won't work in scripts
    import static groovy.grape.Grape.grab
    grab(group: 'org.apache.commons', module: 'commons-csv', version: '1.5')
    
    println "Starting to parse CSV"
Re:Lily: An interpreted language with a focus on expressiven... by blattimwind on Friday July 20, 2018 @05:34AM (#17573621)
Re:Lily: An interpreted language with a focus on expressiven... by arcticbull on Thursday July 19, 2018 @09:42PM (#17571830)
Thanks for sharing that, I had no idea. You just improved my day.