I went on holiday and read “The Book” and I am extremely impressed by Rust!
I am primarily a Scala developer, and an active contributor to libre software. I am one of the maintainers of http://ensime.org which brings IDE-like features to text editors (Emacs, Atom, Vim, etc) for Scala and Java. It’s fair to say that I am deeply involved with the Scala tooling community so naturally I have a lot of questions around Rust tooling
I also have a few language / library questions that I’ll tag on at the end.
It would be great if you could help me out by reading my questions around Rust tooling and answering, if you can!
ENSIME equivalent for Rust?
I understand that there is no interactive (aka presentation) compiler interface yet for Rust. Are there any plans to create one? Can I help you?
I would be very happy to discuss the architecture of a Rust language server further, leaning on my experiences in Scala, so please reach out to me about this if you’re a Rust compiler developer. I think the ENSIME model would work very well for you and you might want to consider being vscode compliant from the beginning to make it easier for editors to support Rust.
Actually I would love to write the Rust equivalent of ENSIME, but unfortunately my spare time is spread too thinly already so this could only realistically happen if somebody were to fund me to do it
IMHO it’s tooling like this that makes or breaks a language, so hint hint
Is there a tutorial for setting up Emacs to write Rust applications? e.g. for basic major mode, build tool support and a .ctags setup. I mena in depth, not just “install rust-mode and flymake-rust” (a flycheck plugin would be pretty useful).
Rustaceans in London?
A monthly / quarterly meetup sounds like the sort of thing skillsmatter.com would be willing to host… I’d love to meet some Rust hackers in real life! Is anybody interested in organising anything like this? A bunch of Rustaceans could just agree to come to the next (monthly) Church of Emacs meetup and maybe somebody could briefly talk about setting up a Rust dev environment, then we decanter to the pub and talk Rust…
Docker images and easy windows / osx installs?
Is there an official docker image available for continuous integration, e.g. with all the matrix of Rust versions and some common 3rd party libs in it? I use drone for GNU/Linux builds.
For Windows I use appveyor and for OSX I use travis… does anybody have a recipe for doing rust CI on those platforms?
Code formatting tool?
In Scala we have a tool called Scalariform which can be setup by the build tool to automatically format all the sources in a project according to a style guide. This is amazing because it just kills needless discussions about formatting. Is there such a thing in Rust?
Libraries / Ecosystem
If I wanted to write a GUI for a cross-platform Rust application, what are my choices?
Even if there is a native GUI toolkit, I would still consider writing a webapp (e.g. purescript or racket) that talks to a local Rust server over Websockets.
Having said that, I assume there is a websockets library?
Distributing with licenses?
I noticed that a lot of the ecosystem is using MIT or BSD licensing that requires that the license be included with all binary distributions. This can get tedious to manage, has anybody written a library that will include the various licenses as part of the binary? e.g. automatically adding a --license-info flag to a CLI that prints out all the licenses that are used.
CSP / streams?
One thing I felt is missing is support for concurrent sequential programming or stream processing. Both Go and Clojure have excellent support for CSP which effectively rewrites seemingly procedural code to be asyncronous (never blocks a thread) but I didn’t see anything similar for Rust (the word “channel” is used in a similar but different way). Has anybody written anything like this? Which would presumably have to be implemented as a macro?
In addition, Scala (and Java) are now seeing a surge of streaming (or so called “reactive”) libraries. One of the most impressive is sirthias/swave (the ScalaDays talk is well worth watching). Is there anything similar for rust?
A standard benchmark I like is to imagine that you have an infinite supply of table data that you need to read one row at a time, you can process each row independently (parallelise the hell out of it) then fan in to do some slow persistence step. How hard is it to set up a pipeline that uses backpressure to keep memory usage to a minimum?
High Performance Linear Algebra?
One of my more popular projects is netlib-java which is used by Apache Spark and similar technologies. Would there be any interest in creating something similar for Rust? Perhaps something higher level, maybe more a Breeze for Rust (which tries to be a MATLAB like syntax in Scala). Although sadly I think this is another area where somebody would need to be willing to pay for it.
recursion and call stack optimisation?
There was an example in The Book for
is_symmetric which used recursion, but not mention of call stack optimisation. Does rust do tail call stack optimisation (or any other kind of recursion)? Without this I don’t think I’d want to write any recursive code.
In Scala it is becoming very idiomatic to define domain information as Abstract Data Types. This has two important parts:
- products (case classes)
- coproducts (sealed traits) - like an enum of products
where a coproduct and all its implementations are defined in a single file. Does Rust have anything similar and is there a way to access the implementing classes or a coproduct at a) compile time b) runtime?
You could say that List[T] is a coproduct with two class implementations: Cons[T] and the empty list. As is common, this is a recursive type because Cons[T] refers back to List[T].
In Scala it is possible to do something equivalent to auto deriving for any interface (we would call it “type class derivation”). But in Rust it seems that this is limited to just a few interfaces that are defined in the standard library. Are there any plans to support userland interfaces? It would be really amazing if ADTs could be supported. The canonical example in Scala is to write a custom wire format marshaller, which is all derived at compile time for any ADT.
When I was following The Book’s error handling example I couldn’t help but think that there was a lot of boilerplate involved with creating the impls for the user’s custom error type. Is this really necessary? Could autoderiving perhaps help here?
Is it possible to do anything like http://fommil.github.io/scalax15/#/6/3 in Rust? i.e. have something more specific than Int or String as a compile time type that is completely indistinguishable (no cost) from the base type at runtime.