News for hackers. Stuff that matters.
Re:Building a fast Electron app with Rust by pornel on Sunday March 18, 2018 @10:40AM (#16612124)
> but why not make the UI native for each platform?

As a developer I prefer web tech for UIs, because it's actually a nice toolkit to work with, and has great tooling.

I can easily debug and live edit the UI with DevTools. OTOH in Xcode's constraint-based layout I struggle to even move buttons around (if I fail to update all constraints right, the whole layout collapses). On Windows I don't even know which of the many UI frameworks is the least deprecated this year.

Re:Building a fast Electron app with Rust by ken on Sunday March 18, 2018 @11:20AM (#16612334)
> I struggle to even move buttons around (if I fail to update all constraints right, the whole layout collapses)

I would say that accurately describes my experience with CSS. Any selector has the potential to mess up the entire page.

With NSLayoutConstraints, not only does it match my mental model of how layout ought to work, but I know that in a properly-factored layout, constraints can only mess up their local section.

Globals make debugging tough in any context, and I wouldn't blame the language simply for allowing their use.

Re:Building a fast Electron app with Rust by jakelazaroff on Sunday March 18, 2018 @11:50AM (#16612484)
> Any selector has the potential to mess up the entire page.

That's true, but the modern web stack has several solutions to this. If you don't mind "CSS-in-JS", I've been using the excellent styled-components [1] library for my company's React app. I believe Vuejs supports scoped styles out of the box [2]. And if you'd prefer to just write plain CSS, CSS modules [3] will mangle the classnames in your CSS files so you don't have to worry about collision.

[1] https://www.styled-components.com/

[2] https://vue-loader.vuejs.org/en/features/scoped-css.html

[3] https://github.com/css-modules/css-modules

Re:Building a fast Electron app with Rust by ken on Sunday March 18, 2018 @10:58PM (#16615954)
Yep, and I consider this one of the main advantages of tools like SASS, even.
Re:Building a fast Electron app with Rust by girvo on Sunday March 18, 2018 @09:06PM (#16615493)
So your hypothetical native layout is properly factored, but the CSS one isn’t in this comparison?
Re:Building a fast Electron app with Rust by ken on Monday March 19, 2018 @10:38AM (#16618641)
No. Even in perfectly factored CSS, one bad selector still can mess up the whole page, no? That's why all those nifty tools (mentioned in a sibling comment) exist.
Re:Building a fast Electron app with Rust by matthewmacleod on Sunday March 18, 2018 @10:58AM (#16612224)
I can understand that, and certainly the web platform is much nicer than it used to be – especially when building for a constrained, known environment like Electron.

Don't discount the native platforms though, which are still very powerful. Constraint-based layout can be frustrating at first, but I've found it's not noticeably more awkward than CSS after a little experience.

Similarly, it's no worse figuring out how to build a native Windows GUI than it is figuring out what CSS or JS framework to use. Just a bit of research :)