Microsoft rewrote Q# compiler in Rust
github.com
github.com
https://survey.stackoverflow.co/2023/#section-admired-and-de...
Haskell, Scheme, OCaml, SML, Rust, Typescript, Smalltalk, Java, Scala, Common Lisp, Kotlin, C, C++, C#, Javascript, Forth, Delphi/Object Pascal, Turbo Pascal, Python, BASIC (various flavors), Fortran.
How about you?
The intent was never to deploy it using SML, it was to flesh out and formalize the design, and act as a specification for development of the full system.
The system was designed to run on a cluster long before the Kubernetes days, and so had to deal with many of the distribution, scaling, and concurrency issues itself, in addition to its business logic.
One of the experiences I had while working on that system was that at the time, I was reading "Monad Transformers and Modular Interpreters" - a seminal paper by Liang, Hudak, and Jones - and I thought I could probably quite easily implement the paper's approach using ML parameterized modules, instead of the Haskell typeclasses used in the paper. I tried it, and was soon disabused of that notion. Partly as a result of that, we wrote the distributed simulation engine for a later version of the system in Haskell.
Rust, Typescript, C++, Go, Java, OCaml, Python, Javascript, Matlab, PHP, SystemVerilog, CMake, C, Bash
Ok I will make this site. :)
It is really unsurpassed in that regard, which is probably partly why it is so popular in DevOps. If only the language was a bit better...
It's definitely not a bad language like PHP though.
When doing critical thinking, please set asides your own biases and try to understand that your own viewpoint is not always the correct one.
In some ways, Python is in fact worse than many of the mainstream alternatives - for example, it's not unusual for people to look to rewrite Python systems in some other language because of performance issues at scale. Same (if not worse) goes for Ruby.
Let the Marie Kondofication of programming languages begin.
But one of Kondo's points is that "Only you can know what kind of environment makes you happy," i.e. there are no universals.
The entire reason we have people trying to cram JavaScript everywhere is that, for some reason, it sparks joy for them.
Hell, even going back, K&R vs Allman brace style was about what sparked joy. Color themes? Spark joy. At this point, I am convinced that the way to get a software developer to do anything is to just play on that need for joy.
Wait really? I feel like it's just "you literally have no choice for frontend" and the various side effects of that.
Some might say it's Stockholm syndrome, but then there's the Python developers doing the same thing everywhere. And the LISP enthusiasts. So unless there's a lot of Stockholm syndrome (although it's not out of the question when it comes to LISP), a lot of it is easily explained by "me like language here, me go put language elsewhere to keep language"
The easiest way to turn front end developers into full stack developers was to let them use the same language for everything, and it was easier to bring JavaScript to the server than to bring any other language to the web.
These days with WASM and JavaScript as compilation targets it might have been avoided, but it's already too late.
Anyway I rambled a bit but the point is "joy" has nothing to do with it.
Any decent developer can become competent with a new language in a matter of weeks, whereas making a large application with the wrong choice of language and tooling can become a maintenance nightmare. Given how difficult it is to verify JavaScript programs as "correct", its use on the server has always riled me up.
I'm only going to address NodeJS because I think that niche projects that target niche workloads are just unrelated.
I believe it does explain NodeJS. The idea is simple - your frontend engineers can own your edge services/ APIs. They're already heavily invested in JS and, at least at one point, there was a theory that unifying languages across frontend + edge made sense for other reasons.
Some people really just learn one language.
I think that's a gross oversimplification. My colleagues know JavaScript, TypeScript and ECMAScript, as well as YAML, HTML and CSS.
Works outside software development too.
do_something(a_thing);
Others are infix: x = a + b * c;
And yet others are postfix: foo.frobnicate()?;
My sole braincell can't handle all that complexity, which is why I'll just stick with simple old Lisp.To each their own, I suppose.
And personally i consider Rust to be from the OCaml/SML family of languages similar to F#, so i guess they moved within the family
As for learning a functional language, I recommend this Haskell tutorial[0], and accompanying video series of an experienced haskeller (Brian McKenna) running through it[1]. I've read countless texts and tutorials explaining Haskell and FP to me but it didn't fully click until I saw someone with experience using the language and tooling effectively.
[0]: https://github.com/system-f/fp-course [1]: https://www.youtube.com/playlist?list=PLly9WMAVMrayYo2c-1E_r...
There are a few other video series from other experienced haskellers available that may be better, too, I just haven't watched them so I cannot comment.
The foundational concept is functoriality, i.e. mapping over the argument of a type. Whether a datatype has an instance of
1. (covariant) Functor
2. Contravariant functor
3. Functor+Contravariant (phantom argument), or
4. neither
says a lot about its structure and tells me what further questions I can ask (what hierarchies I can expect): A datatype can only be a Monad if is covariant. It can only be Divisible and Decidable if it is contravariant. If it is both (3.) then its argument is not used (phantom) and can be mapped to any type. If it is neither (4.) it can be invariant (where the argument appears in both positive and negative position: like the Endo datatype) or a more complicated datatype like GADT, which would require a more complicated functor.
At a high level, it seemed like F# is more functional like OCaml, than Rust is. I'd like to hear more about the reasoning, was it just performance? How different was it to justify a re-write?
My guess is because Rust is great with WebAssembly and they seem to target it with Q#:
So if you want fast browser perf, Wasm is a great choice.
There's also Wasm on the edge with the likes of Cloudflare Workers and Vercel https://vercel.com/docs/concepts/functions/edge-functions/wa...
It also has some interesting isolation properties.
You can't even do a syscall in 50ns.
Cloudflare's 5ms includes time to read the application code from disk. (I'm the one who originally did this measurement.)
50ns is the median time to initialize the Wasm module. I think it would make sense to do another round of measuring with more factors that test things end to end, and see how each of the platform performs.
BTW, I'm a big admirer of Cloudflare Workers... great work!
Maybe.
Yes, targeting WebAssembly, and the ability to then run in the browser, was a big part of it.
WebAssembly (will) also enable our language service extension to run in VS Code for the Web, as well as VS Code for desktop, with largely the same feature set.
It also means the core logic compiles to very performant native code for most platforms, which we use for the CLI.
It's early days for the project, with lots of work ahead of us, but I'm really proud of this first step. Happy to answer any other questions where I can!
So, am I hearing correctly, the goal was really about portability, and allowing Q# to run in a browser, not for any performance reasons of .NET.
For example, if you go to the playground that we publish on every push to main (https://microsoft.github.io/qsharp/), and open the Developer Tools to see the network traffic, you'll see that our WebAssembly module is just 1.5MB (504kb over the wire) - which includes the not just the language (parser, type system, IR, etc.) but also the runtime interpreter and quantum simulator.
Similarly, for the native tools, on my MacBook (i.e. ARM64) the command line compiler ("./target/release/qsc") is 3.9MB, which is entirely standalone with no dependencies.
We do have many features to add, so I'm sure those will grow a bit, but we are focused on keeping things as small, portable, and fast as a general principal.
If Q# is a language for quantum computing, and it is a niche language just for exploring quantum computing.
Then, how does that lead to a requirement to re-write to target WASM?
If you are a person that would be doing quantum computing, why do you care if you can run it in a web browser, or VS code for the web. You would just install tooling on your own machine. Or if you are editing code in a web browser, the code itself would get compiled and run on server, why does it have to compile and run right there in a browser.
So if we remove WebAssembly as a goal, Why can't you just use .NET, CLR and stick with current MS languages to build it in?
I don't understand why running in the web is a needed feature for this set of users.
I understand RUST is very speedy. Is that the real goal, and all of "Rust also works on WASM", is just a side benefit?
Seems like quantum computing needs speed. Performance is the real goal. To simulate a quantum computer a normal computer must run many more steps.
So we have performance of : .NET, Rust binary, or Rust to WASM.
Guess, maybe I answered my own question. If Rust is faster then .NET, then that is goal, and Rust can also run on WASM as option is a side benefit.
I'm afraid this seems to be more indictment of .NET in general, not just F#.
This is what underpins Blazor.
https://github.com/dotnet/runtime/tree/main/src/mono/wasm
Example C# app running in a browser:
https://github.com/dotnet/runtime/blob/main/src/mono/sample/...
Deploying GC language with a huge runtime and stdlib to WASM sounds like a bad idea.
Or for something more modern, Flutter.
Flutter is basically cost center app framework (like xamarin) - not something you model performant software after.
Flutter is doing quite alright, much better than Xamarin, with the MAUI reboot.
https://jkone27-3876.medium.com/f-is-the-net-rust-62f71f8dae...
tldr: developers
It's arguably different enough of a domain to justify a new language.
Quantum computing is a niche, to say the least, and the field is far from clearly defined. This sounds a lot of IBM proclaiming RPG will be the best "big iron" language ever - and today nobody uses it.
There is probably more to it, but these are the parts I know a bit about.
https://learn.microsoft.com/en-us/azure/quantum/overview-wha...
To do the same thing in an existing language, you'd need a deeply embedded DSL so that the program can be manipulated by the Q# "compiler" before running it. It's possible, but it can get kind of clunky, where you have to use the "embedded" if statements, for loops, etc. instead of the ones from the host language. A new language helps with having a cleaner separation.