5 ms·
A bit off-topic but why would someone write a forum (or any web app) in such a low-level language? Isn't it more trouble than it's worth, considering it's not a
by endorphine 4y ago
A bit off-topic but why would someone write a forum (or any web app) in such a low-level language? Isn't it more trouble than it's worth, considering it's not a performance sensitive, critical or constrained environment?
I could understand going as far as Go, but further than that it just feels not the right trade-off for the productivity lost.
- d4mi3n 4y agoI've seen a surprising number of Rust web frameworks cropping up which may be encouraging use of the language at higher levels in the application stack. I could absolutely see somebody familiar with Rust reaching for it to do something like this.
- radarsat1 4y agoBy low level, do you mean strongly typed? Rust can be used for "low level" programming (systems programming) but I don't know if I'd call the whole language inherently "low level". It's strongly typed but has a good trait system and generics, very good for domain modeling at different "levels", so it seems suited just fine to "high level" programming to me, provided you are looking for a compiled, typed language rather than a dynamic one like e.g. Python.
- random3 4y ago+1 - genuinely curious if a high-level slang/DSL is possible in Rust or it's just a matter of having tools for the existing Rust developers that prefer to code in Rust
- cies 4y ago> why would someone write a forum (or any web app) in such a low-level language? [...] I could understand going as far as Go Oh so many reasons: Lemmy is a socialist project. Rust is a project that has it roots in FLOSS movement and Mozilla foundation. Go, otoh, is Google's thingy; a tech/advertising multi-national. Technically Go is in some ways less low level than Rust. See the null guards everywhere in Go, and the idiomatic abstractions that Rust provides for this in the stdlib. Rust has sum types that allow for really high-level abstractions, was designed with generics in mind. I personally find it more intellectually rewarding to program in Rust, over Go or say Python. The stack overflow favorite list shows more people like Rust as a language. You call it "more trouble than it's worth", but that's up to the Lemmy devs to decide. As a FLOSS project, expecting they put in the effort of love there... Sure Go was a viable alternative; but would the devs enjoy writing it in Go? Also then they would be skilled in Go, maybe that's not what they want.
- Cyberdog 4y ago> Lemmy is a socialist project. As in the project itself is socialist? What does this mean?
- another_story 4y agoIf you go and look at the boards you'll find a lot of posters lean hard left.
- wraptile 4y agoThe creators and maintainers are quite extreme too.
- darthrupert 4y agoI would claim that most web services are performance sensitive, since every single millisecond matters for UX experience. Having big JS at client side circumvents this of course, but it might be thought that that is just a hack to circumvent slow server-side processing.
- dom96 4y agoI think the simple answer is that the hype is with Rust so it will be used for just about anything, even if it is not well suited for it. This happens to every language that is sufficiently popular (and probably even some that aren't). I myself am guilty of this, I wrote a web app recently using Rust, mainly because I wanted to learn Rust. I probably wouldn't reach for Rust next time as implementing my project in it has felt like overkill throughout.
- kuramitropolis 4y agoOnce you get over the initial learning curve, Rust is a very capable and productive application language, and I'd argue that the whole "low-level"/"high-level" divide is just a historical artifact. Sure, there used to be a tradeoff between performance and expressivity in a language, such that a "low-level" language would just become crufty and kludgy up to the point that someone would decide "screw it, we'll implement a safer but less performant language in this less safe but more performant one". Today, the hardware is much more powerful, and the theory and practice of software development is more advanced. Thanks to open source, devs have been exposed to good ideas from all corners of the ecosystem, so all that would remain is coming up with sane syntax and semantics - and Rust positively excels in that regard. I'm fluent in Python and JS, but I put off learning "low-level" languages because of the innumerable footguns. Go looks like it has plenty of those, too, and TypeScript is... just a mess. Rust is next-gen stuff in my opinion, and categorizing it as just a "systems-level" language makes no sense. It's "systems" all the way down, and the more kinds of systems a language can efficiently cover, the more good things can come out of it.
- gpm 4y agoNo, I really wouldn't characterize rust as more trouble than it's worth. Rust exposes low level primitives and is efficient, that's nice and all, but you mostly don't actually think about them when programming non-low-level applications. What it does force you to think about a lot is it's correctness guarantees. Things like only letting you modify data that no one else currently has a reference to, and things like forcing you to check error conditions by wrapping them behind an "enum" (algebraic data type). Rust is making a tradeoff here between friction in writing code, and the the amount of time it takes to understand code as well as the number of bugs you write. All in all, for most large programming projects there is no language I think I'd be more productive in than rust. For small scripts, the tradeoff can be less worth it (in which case I tend to use python, or for even smaller ones bash), but those scale poorly to giant projects where you want to be able to do things like refactor without introducing bugs in a file you forgot about. It happens to be the case that rust maps many of it's primitive types directly to low level types that you can reason about in a low level fashion (e.g. ADTs are tagged unions, references are actually just pointers - maybe with a second vtable pointer depending on the type) - but you don't need to do that unless you're worrying about optimizing the constants for performance or doing terrible hacks with unsafe.
- aloisdg 4y agoOCaml, haskell, Idris, F#...
- jjice 4y agoThe type system is awesome to work with. It is low level, but it does a good job at feeling like a high level language. The biggest thing to get used to is the borrow checker, but it also helps with data races. While it works as a low level language, I think it _feels_ like a higher level one to work with.
- Klonoar 4y agoFor pretty much everything required to build a forum, Rust can easily hide away 99% of the low-level things you don't need to deal with. You're moving around strings and talking to a database, and possibly doing some templating. It's not rocket science, and provides the same story as Go with regards to build + deploy.
- justinpombrio 4y agoRust is higher-level than Go, in practice. Rust says "a String is a valid Unicode sequence, an OsString is a valid filename according to your OS, and a &[u8] is a sequence of bytes; I'll enforce the validity of these types for you". Go says "a string is a sequence of bytes, make sure you use them correctly." Rust says "here's an Iterator interface, with hundreds of methods for your convenience". Go says "we didn't have polymorphism when the standard library was developed, so there aren't any fancy iterators; how about you use a for loop?" Rust says "error handling is important, so there's syntax built into the language for it (the '?' operator)." Go says "just write `res, err = func(); if (err) { handleErr }` over and over again." Rust says "please think carefully about the difference between shared references, mutable references, and ownership; I'll be checking your work." Go says "you don't need to think about that, I'll keep track of it with GC for you (unless your sharing data between threads in which case you do and you're on your own)". In the last instance, Rust is lower level than Go. But in the rest, it's higher level.
- galdosdi 4y agoI am in the middle of learning Rust and have found its difficulty highly exaggerated. If you already had experience working with C pointers (and making up / following little informal rules to prevent a leak or double free) then Rust's memory stuff won't seem weird or hard, you'll just be like "ohhhh they're having the type system do the thing I used to do by hand, right on" for the most part. Yet it has a lot of nice abstractions you usually see in much higher level languages like Scala or Lisp. So if you already learned C, you can learn Rust and see it as higher level than the usual Java/Go. If you skipped C and this is your first time learning heap memory management and pointers, then yeah, Rust will feel lower level This situation is why there is such a big disconnect on people's opinions on rust I think. That and that it's oddly popular among total programming noobs. Not anything wrong with that but I don't recommend it as a first language anymore than C, for the same reasons. Might as well walk before running