4 ms·
"Not to be a curmudgeon but why would one want to use Rust for web development for a non-toy project?" Web development is horrifically, unbelievably bent aroun
by jerf 12y ago
"Not to be a curmudgeon but why would one want to use Rust for web development for a non-toy project?"
Web development is horrifically, unbelievably bent around two facts:
1. There has been no convenient, highly popular and supported language for development that also has best-of-breed performance. You can have one or the other. (Yes, I've probably heard of your obscure fast-as-C language that has a great web stack... to a first approximation, nobody else has.)
2. Web development languages have been profoundly, deeply single-threaded, to the point that the web world began to take it as an unmitigated virtue that a page started with a request, generated a response, and dropped everything in the world that it knew at the end of the request. State is something that must be managed carefully, but especially in this era of people writing web applications that may literally have gigabytes available per concurrent user (obviously, not everybody, but this is a non-trivial use case!), the statelessness dogma has seriously broken people's mental models vs. what the hardware is actually capable of.
With Rust, you should be able to write fast, concurrent web applications that actually do something concurrently and aren't constantly marshaling across requests for the client to re-initiate AJAX calls or other such silliness, it'll be fast, and with its emphasis on memory safety, statically safe as well (something that you're not going to get very easily out of Java, and certainly not from a programmer just sitting down and pounding out some Java). It isn't going to be the solution to every problem, but it's going to be the solution to more problems than people realize right now, because we've so deeply internalized our essentially-PHP models of how the web works that we can't hardly even see how things ought to actually be working.
Rust isn't the only language biting at this apple. Go is obviously another one. But Rust has a pretty decent shot at taking a big chunk, if it plays its cards right.
You say the popular web development platforms are all dynamically typed... I'm increasingly coming around to the position that was an accident of history, rather than an immutable fact.
- MrBuddyCasino 12y agoSo I guess I'm gonna be that guy. According to http://www.techempower.com/benchmarks/ http://www.techempower.com/benchmarks/, the 2nd position is held by a Java framework, losing only 13,5% to the C++ overall winner. Granted, you need a 3rd party library to have something similar like goroutines / fibers / actor concurrency / whatever, but its all there if you want it.
- jerf 12y agoJava is not regarded as convenient for web development. Fast when built, yes, but not convenient. And C++ is borderline unsuitable. (A well-chosen and carefully used subset, sure, but the exact things that Rust is fixing about C++ is also why you should think about a dozen times before using it to build web apps.) And neither are as safe as Rust is/will be with multithreading. Doing really pervasive concurrency is possible, but not particularly easy with those languages.
- volune 12y agoWhy isnt java convenient for web development? too many semicolons?
- tormeh 12y agoSo... Scala, then?
- jerf 12y ago"Yes, I've probably heard of your obscure fast-as-C language that has a great web stack... to a first approximation, nobody else has."
- tormeh 12y agoIt's less obscure than Rust and among web developers less than Go as well. How is it obscure, really? http://www.indeed.com/jobtrends?q=scala%2C+rust%2C+Clojure%2C+haskell&l= http://www.indeed.com/jobtrends?q=scala%2C+rust%2C+Clojure%2...
- broodbucket 12y agoScala is far from obscure
- kevinsf90 12y agoThat's nonsense. Scala is pretty well known. (Apache Spark, Play Framework, Spray, Akka, Scalding, Kafka, etc...) As for the web stack: Play, Scalatra, Spray, etc... It can also use the fairly mature Java libs as well: Jersey, Jetty, etc... On the other hand, I don't know of any popular projects that are written in Rust, other than what Mozilla is doing with Servo. I can name companies as well: Twitter, Airbnb, LinkedIn, Gilt, Foursquare, The Guardian, etc... Github still probably runs mostly on Ruby as well, and for performance, you could use JRuby.
- DCKing 12y agoI would say Scala is convenient, popular, supported and with good performance. It also has the static safety and memory safety you desire. All the while with an excellent library collection which is a superset of Java's library collection. Clojure should get a mentiom too. Rust needs to get its game on to compete with that. It should at least beat JVM stuff on memory consumption, so it has that going for it.
- deleted 12y ago[deleted]
- moonchrome 12y agoAs far as I know Scala can't have value types (aside from the single member which is useless from performance perspective) for eg. you cannot do things like "std::vector<point3f>" and have that allocate a flat array of size N * size of 3 floats, instead it will allocate a array of pointers to point3f type objects and then do allocation for point3f N times and will also allocate extra memory for each point3f object for bookkeeping which is really significant when you're dealing with such small objects in large numbers. This is courtesy of JVM not having value types, and that's just one obvious performance dead end if you write code that deals with that sort of thing (both in memory usage and in access time/runtime). There's plenty of other stuff that makes JVM not suitable for performance sensitive work, as long as we aren't defining performance sensitive as "faster than Python and Ruby". Web apps seem to be IO bound so runtime performance generally doesn't matter.
- coolsunglasses 12y ago>There has been no convenient, highly popular and supported language for development that also has best-of-breed performance. Haskell and Scala?
- mercurial 12y agoNeither are "highly popular". Haskell's web stack is not particularly fast, in spite of the fact that it is possible to get good performance from the language.
- nardi 12y agoIs "faster than Nginx" fast enough for you? http://haskell.cs.yale.edu/wp-content/uploads/2013/08/hask035-voellmy.pdf http://haskell.cs.yale.edu/wp-content/uploads/2013/08/hask03...
- coolsunglasses 12y agoIn case somebody brings it up, the Techempower benchmark results for Haskell (GHC) are broken, they use an ancient (7.4) version of GHC. The paper linked uses the current (7.8.2) version.
- DCKing 12y agoBoth Haskell and Scala are more popular than Rust right now. Scala is actually on its way to become a mainstream language (http://sogrady-media.redmonk.com/sogrady/files/2014/01/lang-rank-114-wm.png http://sogrady-media.redmonk.com/sogrady/files/2014/01/lang-...), followed quite closely by Haskell.
- orthecreedence 12y ago(Common) Lisp fits your bill. It's threadable, cross-platform, compiles to machine code, well supported, stable, and able to be molded to any domain (such as web development). In fact, there are already some great web/app servers and frameworks for it already. It's not "highly popular" compared to something like Python, but has growing usage and attention. The implementations are converging on a standard set of modern features that are cross-platform. I routinely write code in one implementation/OS and run it on different implementations/OSes without a hitch.
- coldtea 12y ago>It's not "highly popular" compared to something like Python, but has growing usage and attention. Let's not kid ourselves. CL will never get anywhere regarding adoption for web use (at least for values of "never" = in the next 20 years, and "anywhere" = several high profile companies use it, and there are at least 3 dedicated books about its web frameworks). Almost all programming languages can claim "growing usage and attention", but it rarely amounts to much. Go has managed to have more usage and attention from high profile companies in 3 years of existence that CL or Smalltalk have had in the last 25.