Lily Programming Language

(lily-lang.org)

43 points | by FascinatedBox 3 days ago

8 comments

  • lagniappe 12 minutes ago
    One thing I very much appreciate in new-lang posts is seeing a code example above-the-fold, front and center. Kudos to the authors.
  • pansa2 6 hours ago
    > statically-typed

    > Embed/extend in C

    Is Lily intended to be (or could it be used as) a statically-typed alternative to Lua?

    Personally I'm happy with dynamic typing for scripting - but I suspect many people would welcome a statically-typed option, and there don't seem to be many available.

  • oneseven 8 hours ago
    What I really want to see from a "*-programming-language" post on HN is _why_. Why Lily?
    • keychera 6 hours ago
      I am curious as well. some past readme has Why sections and I am not sure why they are removed/changed

      this have "Why" section https://gitlab.com/FascinatedBox/lily/-/blob/d3ace2907747106...

      this have "How Lily stands out from other languages:" section https://gitlab.com/FascinatedBox/lily/-/blob/785a88534cced53...

    • andyferris 8 hours ago
      The README on gitlab at least has a sentence or two on that: https://gitlab.com/FascinatedBox/lily

      > An interpreted language with a focus on expressiveness and type safety

      Personally I think typed scripting languages could be the future. They should support AOT compilation where necessary.

      • bonesss 56 minutes ago
        F# and C# are typed scripting languages. F# is quite similar to python in script form (.fsx), and has OCamls expressiveness, exhaustive pattern matching, and type inference. That results in highly expressive, terse, and ergonomic domain code.

        The .Net VM now supports AOT compilation.

        The future is now-ish :)

      • keyle 7 hours ago
        Why do you think that's the future?

        Isn't a waste to essentially reinterpret an entire program that may be run 5000 times a day?

        AOT compilation, how is that different than make && run?

        At some point, you have a compiled language, if it's quick to compile, you're doing the AOT yourself, the scripting is an illusion. Pun intended.

        • nine_k 6 hours ago
          Isn't it a waste to run a test suite for a program that would run 1M times a day in production?

          The key adjective here is successfully run. You want to detect any errors as early as possible. Ideally even at the early stages of writing the script, when a typechecker is already able to point at certain errors, and thus help avoid missteps in further design.

      • nofriend 7 hours ago
        a statically typed aot compiled scripting language is... not
        • satvikpendem 4 hours ago
          I script with Rust via cargo-script, it works great. Scripting is a task for when you want to achieve something in one file instead of a full blown application. It is not about the language, you can script in C or assembly if you so chose.
        • nine_k 6 hours ago
          "Scripting" is a role: an embedded, human-friendly, compact language, also suitable for interactive work / REPL.

          (Laugh all you want, but Haskell has a rather nice REPL, and can work as a scripting language.)

        • LoganDark 6 hours ago
          Luau gets pretty close to statically typed and AOT compiled now. It's still a scripting language.

          Even C or Rust can be a scripting language. You just integrate the toolchain to your app, same as every other scripting language.

          • mastermage 2 hours ago
            +1 for Luau which is just realy good.
    • EagnaIonat 2 hours ago
      > why

      Building a program language is like poetry. Everyone does it at some point, just most of us know never to share it.

      • saghm 0 minutes ago
        That just moves the question to "why is this one being shared" then
    • paulddraper 7 hours ago
      From the link:

      > Key features of Lily:

      > Built-in template mode

      > Embed/extend in C

      > Single-inheritance classes

      > Exceptions

      > Generics

      > Algebraic data types (with Option and Result predefined).

      • andsoitis 7 hours ago
        That’s what. Not why.
        • nine_k 6 hours ago
          The why: because Lua, Python, JavaScript, Janet, etc lack many or all these features. And each of these features is known to make life easier for a human programmer.
          • dismalaf 5 hours ago
            Looking through that list of features, Ruby (the dynamic language I know best) has all but 1 built-in (and the other can be added with Gems). I'm guessing Python probably has them all too (but I don't know Python that well). They're pretty common. So the why still isn't clear.
            • nine_k 4 hours ago
              Is Ruby easy to embed in a C program?
              • bandrami 4 hours ago
                That was originally the point of Ruby
              • debugnik 2 hours ago
                RPG Maker used to embed Ruby before it was cool (and before they switched to JS for web support).
              • dismalaf 4 hours ago
                Yes -> https://mruby.org

                It's also incredibly easy to extend the main Ruby implementation with C, C++, Odin, Zig, Rust, Fortran, etc... Literally a few lines.

        • paulddraper 7 hours ago
          The reason it exists is to provide those features when programming computers.
  • oncallthrow 59 minutes ago
    Why not just use Ok/Error which is an accepted idiom and shorter than Success/Failure?

    I see this so often in new languages, making poor choices seemingly only to distinguish themselves from existing languages

  • roxolotl 6 hours ago
    I’m a sucker for little embeddable languages but I’m even more of a sucker for rpn. Wonderful little example shows how simple of a math scheme it is.
    • zombot 4 hours ago
      And not only math. See Forth as a reference.
  • aiexplorations 3 hours ago
    I would like to understand the motivations for building another programming language when in fact, firstly, a lot of code is being written by Claude and the like, and secondly, the existing languages and low level options like C, Assembly have become more accessible now thanks to AI coding tools.
  • boxed 1 hour ago
    > for v in values: {

    Both colon and {... why? And it seems very mixed in the example.

    • OJFord 1 hour ago
      I have no knowledge of lily, but a good reason could be for example that you can do `: print(v)`, but need braces for a multi-line block. Or that braces are the difference between creating a new scope and not. It's not necessarily just syntax for the sake of it.
  • 7e 6 hours ago
    Has anyone yet designed a language with the explicit goal of being cheapest/easiest to use by an AI coding agent?