|
Rust doesn't reuse concepts well. The different capabilities and subsystems are all build from disjoint building blocks, which you could call modular in a sense, but it doesn't make them easy to use, learn, or joyful. The module system, the macro system(s), the core language, the borrow checker.
It's all different micro-languages without a shared foundation. I think it's easier to when you compare Rust to simpler languages like Carp or Zig. Carp due to its homoiconicity and lisp heritage allows you to write macros in regular old Carp.
Zig doesn't really have Macros, but comptime (compile time) code evaluation, which results in something with a lot of the benefits of a macro system without the drawback of unreadable DSLs, because it too is plain old Zig annotated with `comptime`.
Zigs module system is build on Struct name-spacing, so if you know Structs, you know the module system.
Its build system is also build on Zig code. My guess is that Rusts origins are partially to be blamed for this, the web is build the same way, disjoint standards that are developed by different groups of people.
It's just that just like the web, the sum of the parts is less elegant and usable than each constituent. |
Where this could be a problem - I write a comptime function, only using other functions that I’ve verified can be executed at compile time. But now the implementation details of those functions (that they’re comptime) has leaked to their definition. Now a change to the impl of those functions could break my code, without the authors of those functions realising it.
Perhaps this is not a problem in practice?