Hacker News new | past | comments | ask | show | jobs | submit login
Yuescript is a dynamic language that compiles to Lua (yuescript.org)
33 points by JNRowe 2 days ago | hide | past | favorite | 9 comments

My favorite compile-to-lua language: Fennel - https://fennel-lang.org/

Incidentally, my favorite Clojure environment for Neovim is written in Fennel! https://github.com/Olical/conjure (via Aniseed [https://github.com/Olical/aniseed] which enables you to write Neovim configuration and plugins in Fennel)

I have used Lua extensively as part of a commercial project and I really can't imagine why would someone want this. For me the biggest feature of Lua is that you can keep the overwhelming majority of the spec in your head with little effort. Beauty through simplicity.

I think the reason that "compile to Lua" isn't a more popular option in language development, even though the idea is often brought up, is because a lot of the "weirdness" of Lua comes from its data structures, or properly, its one data structure and its lookup semantics (__index/__newindex). If you try to build something on top of the core type semantics, you lose Lua's performance; if you modify them, you lose compatibility with other Lua code; if you change nothing, you lack selling points. Over the years, I've written and thrown out two half-baked Lua extensions after hitting this trilemma.

So Yuescript just looks like a polished and cleaned-up Moonscript, which is fine. But the elusive "new language which compiles to Lua" may never materialize, because Lua just isn't all that flexible.

It's similar to Lisp in this way - what you build out of it is going to be variations on the underlying theme, you might as well just be using Lisp, or Lua in this case, with a specific coding convention and style guide.

I prefer TypeScriptToLua's approach: https://typescripttolua.github.io/

The data structures are unchanged, so you have to remember to use base index 1 etc, but you get modern syntax and TS's great inferred typing system.

Definitely scales better than raw Lua but you get the perf and compat wherever Lua[jit] is supported.

It's nice if you used to use Lua and you use TS as a daily driver, you just have to remember the differences.

There's also Teal (https://github.com/teal-language/tl) but I haven't gotten around to trying it, it may be less confusing to others.

I've never understood the point of these. If I need Lua for an existing system, the #1 thing I want is types, because that's also probably the #1 reason I'm looking for a Lua alternative. (And if I'm developing my own system, my role doesn't intersect with its role.) If I could have anything it'd be KaiLua, but finished and usable.

>>> expressive and extremely concise. And it is suitable for writing some changing application logic with more maintainable code

Assuming you won't write large code bases, I fail to see why would I use this instead of Lua.

(I have been running a SMS gateway for the last 15 years. Full code base is Lua (Openresty). Gateway configuration is also Lua; several hundreds of Lua code per configuration file)

It says it compiles to Lua, so I guess because you'd rather write this than Lua?

I don't see why not.

That's was my point. I don't find it more expressive or more concise than directly writing Lua code

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact