5 ms·
Non-rhetorical questions: why not use the language itself so people can leverage features like autocomplete, type-checking, linting, and intuitive error handlin
by ralmidani 5y ago
Non-rhetorical questions: why not use the language itself so people can leverage features like autocomplete, type-checking, linting, and intuitive error handling in an IDE? Is there anything about Rust that makes it impractical for representing config/dependencies/etc?
- anon_tor_12345 5y agohow do you imagine this working? should the binaries for this ship a rust compiler?
- ralmidani 5y agoYou could, for example, compile AOT to a JSON file and build everything deterministically from there. Tell devs to not edit that JSON directly. I believe NPM and Yarn do something similar.
- anon_tor_12345 5y agoi have no idea what you're saying >compile AOT to a JSON file and build everything deterministically from there you want the dev that develops zellij to AOT compile all settings (that they set using rust as you imagine) to a JSON file that is then... what by end users? inspected but not edited? how would settings change then?
- goldsteinq 5y agoYep. Rust is a compiled language with monomorphized generics. It's slow to compile, and also you'll need to carry rustc everywhere. rustc is huge.
- jhgb 5y agoOr, one could embed Chez Scheme, the compiler of which is like 800 kB in size and compiles stuff very quickly.
- goldsteinq 5y agoOr, one could embed Lua, which has simple syntax and built for that exact purpose
- jhgb 5y agoPossibly, but the dilemma of having to choose between Lua 5.4, with its portability and language features, and LuaJIT's performance isn't very pleasant. I'm sure that LuaJIT updated to 5.4 version language would be very popular, but it doesn't exist right now.
- ibraheemdev 5y agoThat is one thing people love about xmonad, you write your config in haskell.
- jamamp 5y agoAnother option is JSON with the "$schema": "..." item[0]. Most editors seem to pick that up automatically and provide autocomplete and type-checking. [0] https://json-schema.org/ https://json-schema.org/
- alpaca128 5y agoThe point of config/scripting languages is to make the user's life easier. I assume nobody wants to deal with the Rust borrow checker and lifetime annotations while tinkering with their configuration. So it depends - should it be an unchanging set of options/flags the user can switch around and then recompile? Probably fine though it'll never be as quick as e.g. recompiling programs from the suckless project. Want to expose interfaces for users to expand and modify the program's code? Not so much. Rust is a fantastic language, but it's probably not the kind of language you want for this purpose. Same reason why game engines often have scripting languages; so people don't have to deal with C++ where it's not required for performance. Imho the best compromise is embedding something like Lua which is simple and still flexible enough to allow more than JSON-style declarations.