4 ms·
My wishlist is something that is essentially coffeescript for rust, basically rust without semicolons or the borrow checker. The ruby syntax is not specifically
by antifa 5y ago
My wishlist is something that is essentially coffeescript for rust, basically rust without semicolons or the borrow checker. The ruby syntax is not specifically important, but generally desirable. Ideally it would transpile individual files directly to rust with a GC or RC boilerplate sprinkled into it, then run the full rust compiler.
Nim and Crystal are nice, but are not rust under the hood.
This would open rust up more to smaller brained devs like me who can't do full rust full time. I think it's generally underestimated how valuable this would be to establishing the rust utopia we all want to see.
- UncleMeat 5y agoWhy Rust instead of C or C++ if you don’t want the borrow checker? That’s the whole thing that makes it superior to alternatives!
- antifa 5y agoThe goal is to abstract away the borrow checker for the business logic of software I write, not for the borrow checker to be absent from a rust compiler.
- chrismorgan 5y agoHonestly, if you remove the borrow checker from Rust, it’s radically not Rust any more. I hold that the defining feature of Rust is its ownership model; and there’s nothing left of that without the borrow checker. (You could assign similar semantics and just not check them, but without the ability to check them they’re completely useless.) Most of Rust’s design hinges upon the ownership model, and most features that it has are there at least in significant part to make the ownership model work or be tolerable. To be sure, you could create a dynamic/scripting language with algebraic data types (enum) and a struct/impl divide; even traits are possible, though mix generics in and it’ll be decidedly bothersome to achieve any sort of speed, yet you kinda need generics for traits to make sense over classical OOP (there’s a reason scripting languages tend to go for classes and such—Rust-style traits work excellently compiled, but not so well dynamic). But you’re talking about converting such code into Rust, and I say: without ownership modelling and the borrow checker you have absolutely no chance of converting it to anything but completely unsafe Rust code (as in: Rust will slow you down and gain you nothing, you should generate something like C instead). And you can’t just sling GC at it: Rust is really quite poorly equipped for that style of box-everything GC code, and the only ways of making it work at all will perform very badly.
- antifa 5y agoThe goal is to abstract away the borrow checker for the business logic of software I write, not for the borrow checker to be absent from a rust compiler. I still want everything that is rust, I just want an alternative to php/ruby/python that is natively integrated into rust and the full rust ecosystem.
- mlindner 5y agoI think this and the original post misunderstands what the borrow checker fundamentally is. The only way to "abstract the borrow checker" is to write another language on top of Rust.
- chrismorgan 5y agoThe borrow checker is pervasive. You can’t just abstract it away. There’s a reason it’s explicit. If you think it’s possible, try designing what it would look like, and what it would compile your code to. You will quickly find that it can’t work without losing the quintessence of Rust completely (and a lot of performance).
- mixedCase 5y ago> basically rust without semicolons or the borrow checker The thread spells out OCaml as the main inspiration for Rust, and fits the "without the borrow checker" part. Plenty of semicolons in it, however. F# offers a similar experience with fewer semi-colons, but I can't see how removing semi-colons help make the language more accessible.
- gmfawcett 5y agoReally the only mandatory semicolons in OCaml are in data structures: `let my_list = [1; 2; 3]`. In code, they can all be replaced with appropriate `let` bindings.
- antifa 5y agoSemicolons aren't a hard requirement for me, it's just an example of signaling asthetics to draw in the greater ruby/python type crowd.
- xixixao 5y agoI think we could use at least three languages as a set: - Rust - RustGC - RustScript I elaborated here: https://gist.github.com/xixixao/8e363dbd3663b6729cd5b6d74dbbf9d4 https://gist.github.com/xixixao/8e363dbd3663b6729cd5b6d74dbb...
- pizza234 5y ago> basically rust without semicolons I think semicolons are necessary due to Rust being an expression-oriented language. Related discussion: https://news.ycombinator.com/item?id=20614286 https://news.ycombinator.com/item?id=20614286. Although I didn't delve into the technical details, at the very least, semicolons are necessary to distinguish statements from expressions.
- njharman 5y agoI would guess "expression oriented" would mean a lang with no statements, more like lisp.
- mamcx 5y agoAfter using Rust a lot, the borrow checker is not that bothersome actually. Exist MANY more things that are far more significant as causes to fear Rust: - Is actually complex language! - It has weird, inconsistent inter-mixed between traits, generics, macros, procedural macros, elides, alias, type alias... - The ways async/await is introduced, multiply the complexity, is super-infectios, and I can't say you can do "fearless concurrency" anymore. - Is slow to compile! A "nicer" Rust is actually easy to grasp: - Borrow checker, xor mutability stay. Is good - Structs, Traits, Enum, Pattern matching, iterators - Add generators, PLS! - A simpler module system - One single way to do macros, hopefully like Zig - Probably everything auto-clone (and maybe the compiler elide it for "copy" types). - Pick a more ergonomic async/concurrency story like Go or Lua. Whatever that is not the complexity of today I think this is all...
- tialaramex 5y agoI'd like generators too. You'll notice that yield is reserved (although of course unlike C++ Rust actually can just take new keywords anyway, because it has a way to spell identifiers that are now keywords) so one day Rust will likely have generators. But you can't have one way to do macros unless that way is proc macros or you're willing to give up on the power of proc macros. The proc macro is just much too powerful (and thus dangerous) to give people something else and have it be satisfactory. And I don't think auto-clone is a good idea. That's a potentially expensive operation, it's worth taking the time to admit to yourself that you are choosing to pay that price when you use it. This also means when you forgot that you'd need a clone you're reminded there and then (by the resulting diagnostics) to make the decision, whereas with auto-clone in those cases it just mysteriously has worse performance than you expected (because there's a silent clone)
- rightbyte 5y ago> although of course unlike C++ Rust actually can just take new keywords anyway, because it has a way to spell identifiers that are now keywords C and C++ introduce new keywords all the time, by prefixing them with "_" and a capital letter. If you want the nice spelling you need to use a header. E.g. "_Complex". "co_await" etc are operators.
- iknowstuff 5y agoSounds like Swift. Compiles to machine code, reference counted, has a stable ABI, tries to aim for software correctness with its optionals. Lacks data race safety but tries to alleviate it with actors and potentially an ownership system in the future.
- inimino 5y agoNobody wants to see a Rust utopia. That sounds like a monoculture nightmare. Do you want a Java utopia? A C utopia? A C# utopia? A Haskell utopia? There is no utopia, just a bunch of different choices! It's fine for there to be different languages for different tasks, just like you're legally allowed to own more than one hammer. Please don't follow the hype that you should be using Rust when you clearly don't want to. Rust is just another tool, and only the best tool for a minority of jobs. There are plenty of other excellent choices.