Live data from Hacker News

Lily: An interpreted language with a focus on expressiveness and type safety

lily-lang.org

1–10 of 55 posts

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#2
Prior art like Wirth's or Modula-3 language added a minimal amount of features like exceptions or some OOP on top of simple, efficient, systems languages. Usually have a GC but many prefer ref counting for efficiency. This seems like that kind of thinking in an interpreted language.

Just going by what's on the front page: didn't dig deep into it or anything. Interesting project.

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#3
Maybe off topic, but I do a lot of ad-hoc python scripts where I drop scripts everywhere in my filesystem, but I need dependencies installed in a virtualenv so my ad-hoc scripts can access them. The problem I'm having is that sometimes things will run for a whole day and then fail at the end because of a typo or something.

I've been looking at other languages to see if there's a language like python but type checked, or some kind of prechecking so I don't lose hours of processing to a print(str+int).

I took a look at Scala but instead of virtualenv style dependency management it's more like maven projects. It has Ammonite where you can declare dependencies at the top of files but that seems kind of hacky.

The other option is Python compile time checks using type hints and mypy, which I think I should eventually learn but haven't gotten around to.

The Lily language looks like the closest thing to "functional type checked python" that I've seen and that's cool.

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#4
post #3

Maybe off topic, but I do a lot of ad-hoc python scripts where I drop scripts everywhere in my filesystem, but I need dependencies installed in a virtualenv so my ad-hoc scripts can access them. The problem I'm having is that sometimes things will run for a whole day and then fail at the end because of a typo or something. I've been looking at other languages to see if there's a language like python but type checked,…

Have a look at https://nim-lang.org .. you might like it

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#5
post #3

Maybe off topic, but I do a lot of ad-hoc python scripts where I drop scripts everywhere in my filesystem, but I need dependencies installed in a virtualenv so my ad-hoc scripts can access them. The problem I'm having is that sometimes things will run for a whole day and then fail at the end because of a typo or something. I've been looking at other languages to see if there's a language like python but type checked,…

Depending what you want, using

go run source.go

gives you the compile time checks, while still giving you the source code visibility and simplicity of scripts

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#6
post #3

Maybe off topic, but I do a lot of ad-hoc python scripts where I drop scripts everywhere in my filesystem, but I need dependencies installed in a virtualenv so my ad-hoc scripts can access them. The problem I'm having is that sometimes things will run for a whole day and then fail at the end because of a typo or something. I've been looking at other languages to see if there's a language like python but type checked,…

Linters should catch most typos; failing that, Python's type hints are a pain to use, but you can address a lot of low-hanging fruit for free.

I think for your use case though, Go would be perfect. Everything is statically compiled, so you don't need to mess with virtualenvs, and everything is statically typed ahead of time. I'm a professional Python developer, but I often do my prototyping in Go because the type system is more ergonomic than Python/mypy.

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#7
post #3

Maybe off topic, but I do a lot of ad-hoc python scripts where I drop scripts everywhere in my filesystem, but I need dependencies installed in a virtualenv so my ad-hoc scripts can access them. The problem I'm having is that sometimes things will run for a whole day and then fail at the end because of a typo or something. I've been looking at other languages to see if there's a language like python but type checked,…

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 expressiveness and type safety

#8

Prior art like Wirth's or Modula-3 language added a minimal amount of features like exceptions or some OOP on top of simple, efficient, systems languages. Usually have a GC but many prefer ref counting for efficiency. This seems like that kind of thinking in an interpreted language. Just going by what's on the front page: didn't dig deep into it or anything. Interesting project.

Reference counting isn't more efficient than GC; usually the value of reference counting is that it's deterministic and you can bind finalizers to them (with traditional GC, finalizers run when GC runs which may not even happen). The canonical example is a file object that closes its operating system file when the object is no longer used; this is nice in theory, but as the Python folks found out, not a good substitute for properly closing files.

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#9
One of the bullet points is "Abstract data types (with `Option` and `Result` predefined)." I wonder if they mean "Algebraic data type", since I have seen Option/Result before as an example of those, and they're both commonly abbreviated ADTs. Or maybe they're trying to get at a concept I'm missing here?

Re: Lily: An interpreted language with a focus on expressiveness and type safety

#10
post #5
post #3

Maybe off topic, but I do a lot of ad-hoc python scripts where I drop scripts everywhere in my filesystem, but I need dependencies installed in a virtualenv so my ad-hoc scripts can access them. The problem I'm having is that sometimes things will run for a whole day and then fail at the end because of a typo or something. I've been looking at other languages to see if there's a language like python but type checked,…

Depending what you want, using go run source.go gives you the compile time checks, while still giving you the source code visibility and simplicity of scripts

I took a look at Go but it seems to be more of a systems language than a scripting language and I assume that means it's less amendable to "This guy across the country needs this information in 2 hours max".
Post reply on HN