r/rust • • Sep 07 '19

JetBrains is working on a UI library using Clojure, Kotlin and Rust

https://github.com/JetBrains/noria-clj
273 Upvotes

48 comments sorted by

92

u/gendulf Sep 07 '19

That README doesn't seem to tell anything about what the UI library is for.

49

u/[deleted] Sep 07 '19

I agree, lots of text in the readme with no visible relation to the title of this post

40

u/jetzajac Sep 07 '19

Author here, I want to make things clear. This is a new desktop UI framework for JVM. It is very work-in-progress now. It is using WebRender for actual rendering and based on incremental computations framework for user-level UI building and layout engine. The core of it is written in Kotlin/Java and it has Clojure bindings. The name Noria has nothing to do with the existing Rust crate and probably will be changed soon.

2

u/JuanAG Sep 08 '19

Can i ask you if it will offer the option to build the UI as HTML and CSS one?

The moment i read WebRender i had to ask

12

u/jetzajac Sep 08 '19

No. WebRender itself has little to do with CSS. And we are not planning to use CSS or HTML anywhere.

1

u/sophrosun3 Sep 08 '19

This is super cool! I’ve been curious whether jetpack compose might have a role to play in jet brains tooling for non-android targets. Is that on your radar?

35

u/ishitatsuyuki Sep 07 '19

At a glance it seems that Clojure is used for the incremental concepts, Kotlin is used for the retained-mode API, and finally Rust for the heavy-lift of rendering.

Despite the name "Noria", it seems this is some variant of FRP, like that of Elm's.

12

u/binkarus Sep 07 '19 edited Sep 07 '19

The name noria is shared with the rust crate https://crates.io/crates/noria, which is about dataflow. Having read through the README, it seems that it too is about dataflow, which is caching intermediate results in thunks. I'm guessing it's a coincidence from similar minds.

It appears to be attempting to use dataflow as a means of doing tree updates in a UI instead of the diffing that would be done between iterations of virtual doms, although functionally, it's about the same in terms of performance, I would think.

5

u/unrealhoang Sep 07 '19

The Clojure part seems really similar to Rust’s Salsa, or does it do anything more advance?

3

u/ishitatsuyuki Sep 07 '19

Yeah, it looks like self-adjusting computation, though it might have some design choices because SAC doesn’t perfectly fit UI programs.

Further reading: https://blog.janestreet.com/breaking-down-frp/

1

u/jetzajac Sep 07 '19

It is kind of self-adjusting computations. But it has nothing to do with FRP. Thunk<T> noria-clj cares about are not like Observable<T>. These are used purely for read-tracking, to figure out which computations has to be updated when certain thing has changed.

2

u/jetzajac Sep 07 '19

Comparing with Salsa, it is taking slightly different tradeoffs. Salsa is made for lazy cached computations, while noria-clj has to do with eager side-effecting idempotent functions.

2

u/bgourlie Sep 07 '19

Elm abandoned FRP quite a while ago in favor of what is referred to as TEA, which stands for "The Elm architecture" and which has been adopted by things like Redux and even a few rust web framework.

21

u/bonega Sep 07 '19

Clojure, Kotlin and Rust - They got to be trolling me... *checks intellij for data miners*

8

u/[deleted] Sep 07 '19

UI library for what? all platforms?

21

u/hashedram Sep 07 '19

Kotlin and rust.

Null pointers? What are those?

32

u/Omniviral Sep 07 '19

std::ptr::null()

:P

12

u/[deleted] Sep 07 '19

I don’t get it.

7

u/[deleted] Sep 07 '19

You are right

3

u/[deleted] Sep 07 '19

Yeah I dont understand it either. At first I thought they were making an IDE for Rust and I got excited but now I just have more questions.

2

u/Devildude4427 Sep 07 '19

Why would they make an IDE just for Rust? CLion handles that just fine right now.

4

u/numbstruck Sep 07 '19

For the same reasons they have Ruby, Python, and other language focused IDEs, I would imagine. I don't currently do much programming in rust (just getting started). Are there special things that need to be done to setup debugging, or build/test on save/update? Multi-crate projects also spring to mind.

1

u/Devildude4427 Sep 07 '19 edited Sep 07 '19

Except those make more sense, as they have more unique features (python env, for example), not to mention, a very wide audience.

There aren’t really any special items with Rust that require anything more than installing the Rust plugin. Standard CLion debugger works just fine, and you wouldn’t run build or test every time you save or update. Just wouldn’t make sense to do, as a IDE like CLion constantly saves, and building complex crates can easily take a minute to compile and build. Tests are a bit quicker, but still not quick enough to do that.

Multi-crate projects aren’t an issue. They work just fine. I don’t have a single complaint.

1

u/numbstruck Sep 07 '19

Nice! I wasn't certain, so thank you for confirming 👍

0

u/[deleted] Sep 07 '19

CLion? Never heard of it. I honestly just use Visual Studio Code with the Rust Extension and love it. Not a fan of the actual Visual Studio IDES though, but for class they force us to use it.

4

u/Devildude4427 Sep 07 '19 edited Sep 08 '19

CLion is the JetBrains IDE for C/++ and Rust, sort of.

Rust is technically just a plugin addition to the IDE, but it fits in best to the tooling that’s built into CLion, and it’s one of the initialization options, indicating that’s probably the IDE they want you to use for Rust development.

2

u/[deleted] Sep 08 '19

Oh my bad. That makes more sense. I’ll look into it.

3

u/Devildude4427 Sep 08 '19

If you’re using VScode, you’ll probably not be interested, as JetBrains licenses are rather expensive.

1

u/[deleted] Sep 08 '19

The thing is, through my school I get the educational pack for JetBrains and it includes a lot of JetBrains Programs, like Pycharm for example.

I was thinking CLion was made from a different company but now I understand. Is there really a reason I should switch?

What exact benefits does a full IDE have for Rust, if any?

PyCharm is great and I like it a lot because it lets you easily separate projects, but like you said, with cargo its damn easy to manage your own packages as it does not get installed globally.

Is there any reason you would recommend it?

1

u/Devildude4427 Sep 08 '19

Oh, if you’re in school, you likely have access to the full suite of IDEs for free. If you have a student email (.edu or similar), JetBrains gives you full access to the full version of their IDEs, like IntelliJ Ultimate or the standard Pycharm, rather than the educational version.

Is there a reason? Well, there’s reasons, but the big factor is going to be cost, if you can’t get it for free. VScode is great, but it’s not an IDE. It’s a text editor. A full blown IDE gives you a much better experience, as it has all manner of debugging tools and profilers, etc.

If you’re writing Rust, efficiency is probably going to be a main target, and VScode can’t help you out there, while a dedicated IDE can.

1

u/[deleted] Sep 08 '19

Why would you say VScode isn’t efficient. I found it to be the best editor for me with extensions like crates and rls installed, as well as having clippy and rustfmt.

Cargo Run and Cargo Test already give you the debugging you need, and there is automatic syntax checking / debugging while writing the code.

The only thing is the auto-complete can become a bit glitchy sometimes.

→ More replies (0)

-1

u/JuanAG Sep 08 '19

Really? Is not free but for few money you get almost you need and i can always download a high quality IDE for other lang free as the subscription covers all it products. 250€ the first year is not many, if you think that expensive better dont look how much will cost other IDEs that are exclusive for few langs

1

u/Devildude4427 Sep 08 '19

Did you have a stroke while typing that? Jesus Christ.

Sure, $250 a year for the All Products Pack is a fair deal, however, there are plenty of free IDEs out there (JetBrains even provides a free version of IntelliJ), and $250 is incredibly expensive compared to freeware. CLion is $90 on its own, but that’s still very expensive.

I love their products, but work gives them to me for free, so I don’t pay a dime. If I had to pay, I’m not sure that I’d use their products.

-1

u/JuanAG Sep 08 '19

Fine fine not exactly, i dont have the same good feeling that if i used a proper product, intelliJ for Java is far ahead in that point

Is the best we can have rigth now but it doent make it what we should get, a plugin is fine for keeping the market as the lang evolves and decide it fate while not spending huge amounts of money but i expect a proper full integrated IDE soon

1

u/Devildude4427 Sep 08 '19

Sorry to burst your bubble, but all of their IDEs are built upon IntelliJ, and stripped down to a single language/group plugin. Java integration is also a plugin.

1

u/JuanAG Sep 08 '19

Not even close, i can install on intelliJ the sql plugin and it will never as complete as DataGrip, or the HTML/CSS ones and WebStorm will be ahead as there are better integrated

2

u/Devildude4427 Sep 08 '19

IntelliJ contains pretty much everything. Its the base platform. You don’t know what you’re talking about dude. Some buttons may be in different places, but functionality is all there, except for Rider, which is the odd one out.

4

u/[deleted] Sep 07 '19 edited Sep 07 '19

3

u/jetzajac Sep 07 '19

This is a draft of my talk about old version of it at FPConf in Moscow. This text is very outdated.

3

u/bonega Sep 07 '19

I love the automated translation. "Everything is bad!", "Fingers in the blood"

3

u/paul_h Sep 07 '19

One mention of Swing, in a commit message, so I for one am left wondering

2

u/pmbauer Sep 07 '19

Reminds me of http://hoplon.io/ more than elm