Hacker News new | ask | show | jobs
by mrcjkb 242 days ago
> presumably because that's what Cargo does.

Nope. We chose TOML as the default for various reasons:

- Simplicity. There are use cases for a turing complete configuration language. Lux is not one of them.

- Ergonomics. The ability to edit it using the CLI (technically, that could be possible with Lua too, but it would be a lot more complex and not a very pleasant UX).

> which, I don't know if that's the right call?

The reason we currently support importing a Lua extra.rockspec is ease of migration for complex projects, e.g. with platform-specific overrides (not yet supported by the TOML spec).

2 comments

> The ability to edit it using the CLI

This perplexes me. Lua was conceived as a configuration language and the whole point of a configuration language is you edit a config file. Trying to abstract this away behind a CLI seems like it misses the ethos of Lua.

It’s also a tad strange that a package manager designed for Lua isn’t written in Lua. Presumably Lua developers already have Lua installed, know Lua, and would more likely contribute to a project written in Lua.

> Lua was conceived as a configuration language

That alone is a pretty weak argument.

> Trying to abstract this away behind a CLI seems like it misses the ethos of Lua.

With `lx add <package>`, you can install the package and add it to und config file in one step. And do things like fail if the package or version doesn't exist or isn't compatible with your system.

You can provide editor plugins or use LSP to give users hints if there's an update available, and use code actions to update them, etc.

> It’s also a tad strange that a package manager designed for Lua isn’t written in Lua.

Again, the fact that Lux relates to Lua is a pretty weak argument for choosing Lua as a language to write or configure it in.

Lots of Lua libraries and packages aren't written in Lua, but are built with Lua bindings. Lua (which as you yourself just mentioned was conceived as a configuration language) is a pretty poor choice for something with the scope of Lux. In fact, luarocks was recently rewritten in Teal. Lux has a Lua API (lux-lua) which means it can be embedded or used as a Lua library.

> Presumably Lua developers already have Lua installed, know Lua, and would more likely contribute to a project written in Lua.

We're not worried about finding contributors. If anything, what we need are high quality contributions. Lua developers who only know Lua are not what we're looking for.

Thanks that does answer my question! Had you considered parsing a subset of lua to get the properties you want? That way users don't have to learn a whole other syntax. I'm thinking in particular of my students whom I teach lua. They struggle enough learning one language, having to teach a second with all its quirks seems like a lot to throw at them.
Do you think that is more difficult than explaining to the students why they can’t use loops in their lua config files?
I wouldn't present it to them as "these config files are the same thing as Lua but without loops", but instead "these are config files and they have the same syntax as the Lua records we just learned about". And I would prefer that over "these are config files and they have a different syntax as the Lua records we just learned about." Although I can see merits on discussing that syntax differences exist between languages, that tends to overwhelm people learning their first language.
That's a neat idea, but it would mean we'd have to maintain our own library. When editing with the CLI, you have to make sure you preserve comments, which the toml-edit crate does quite well.