4 ms·
Coming from Crystal/Ruby, I just could never get it to do what I wanted it to do. Tried writing a generic stream API, and using closures naturally like anyone w
by sam0x17 8y ago
Coming from Crystal/Ruby, I just could never get it to do what I wanted it to do. Tried writing a generic stream API, and using closures naturally like anyone would to do things like "on_data" etc., only to run into insurmountable life cycle and borrowing problems. Tried for 4 weeks straight to get the same 100 lines of code to work. Ended up giving up when the rust gitter told me it was impossible to do this sort of thing, and wrote a perfectly working implementation in crystal in an afternoon.
- p0nce 8y agoPerhaps a GC would help Rust being this productive?
- majewsky 8y agoWe have a ton of GC languages already. Rust is unique for being able to do a lot of things very safely, but also fast because it does not require a GC.
- pjmlp 8y agoBeing able to generate fast code doesn't imply not having a GC. It is all a matter how it is implemented and the additional language features for manual types and control of allocations, and how good the compiler backend is transforming all that AST information into actual code. Something like Modula-3, Active Oberon, System C#, Eiffel, D and so forth.
- Jach 8y agoRust had an optional GC once, they removed it. Nim is the answer to scrubs like me who thought Rust was interesting up until that point, since Nim is super fast and lets you allocate/deallocate directly (use of GC is optional) and has three different GC implementations to choose from (including a soft real time one).
- rcxdude 8y agodespite the name for the syntax, rust never really had a GC, just a slightly shorter syntax for reference-counted heap-allocated objects and a vague idea of 'probably it'll handle loops one day', until the language design solidified around an extremely minimal runtime and preferring standard library features over language features.
- sam0x17 8y agoOr crystal.
- rcxdude 8y agoI find a lot of the frustration with such things in rust is because people try to optimize things very early with rust, because it makes it explicit when you are opting into something which costs some performance. Many beginners try to write something with references which either won't work (and in C++ would simply crash) or requires substantial effort to accomplish without some degree of indirection, runtime tracking, or allocation. In higher-level languages the indirection and allocation are so ingrained into the language users don't even realize it's there (how many people know that basically every class member access or function call in python involves a hash table lookup?). If you try to do the same in rust you find you need to say where you want the runtime tracking and indirection to occur, and in general this means you use less of it, but it doesn't mean you should tie yourself in knots trying to avoid it. A little more eager use of trait references, Rc, and RefCell makes for a much better rust experience, but there's a strange psychology to it which makes people unwilling to do it, even when they know it's there and how to use it (and there is a difficulty of teaching beginners that it is there and how to use it).