3 ms·
rusty seems needlessly verbose... never tried to read any code in it before this post... which I fail to see the purpose...
by gcb0 13y ago
rusty seems needlessly verbose... never tried to read any code in it before this post... which I fail to see the purpose...
- girvo 13y agoThat verboseness allows you as a programmer to get the compiler to do exactly what you want, safely. I'm not really a fan of the syntax, but I totally get why it is the way it is; it's hard to do that while keeping the ALGOL/C styled syntax. Nimrod is another way of tackling it, with a Pascal/python influenced way of attacking the problem. It can also be a bit verbose, but trades that off for not having some features that Rust does. Tl;dr - it's worth it, IMO :)
- derefr 13y agoAre there any homoiconic "get the compiler to do exactly what you want, safely" languages?
- chrismonsanto 13y agohttps://github.com/eudoxia0/Hylas-Lisp https://github.com/eudoxia0/Hylas-Lisp is one example, targeting LLVM
- dbaupp 13y agoFWIW, much of the verbosity in this post is optional, e.g. the very first example could be static mut base: uint = 0x200000; pub extern "C" fn malloc(len: uint) -> *mut u8 { base as *mut u8 } (I'll admit the second can be reduced less, since it's actually doing real work: basically just dropping the `: uint` on the `let ret`, dropping the `return` and associated `;`, and removing the () on the if condition.) I guess the major source of verbosity is the `extern "C"`, which, fortunately, is only necessary when one requires a function uses the C ABI/calling-convention; in the overwhelmingly common case one writes `pub fn foo(...)` which will use the Rust ABI (and it gets reduced to just `fn foo(...)` if the function can be private to a module).
- kibwen 13y agoInterfacing with C is more verbose than typical Rust code. The author of this post also chose not to make use of Rust's type inference, which means that what is typically written as: let ret = base; ...was instead written as: let ret: uint = base; ...with all the additional verbosity that entails.