News for hackers. Stuff that matters.
Re:Qt for WebAssembly by 21 on Tuesday June 19, 2018 @03:45PM (#17349721)
> what stops QT from taking over all multi-platform targeted applications

The fact that Electron is much better. I know this in a highly unpopular opinion here. I've programmed in them all (MFC/wxWidgets/QT/WinForms/WPF) and HTML/CSS/JS is just so much easier.

Re:Qt for WebAssembly by sho_hn on Tuesday June 19, 2018 @03:56PM (#17349819)
Having recently made a website with a non-trivial layout that required lots of ugly JS to implement adequate scaling and bevavior, boy, I can't disagree more. I do UI in QML in $dayJob and gained a whole new appreciation for how much simpler and faster it is to achieve similar results in a more consciously crafted language.

Unfortunately it was our wedding website and I didn't think "let's hold off until I can use Qt/WASM" would go over too well ... :-)

Re:Qt for WebAssembly by littlestymaar on Tuesday June 19, 2018 @08:43PM (#17351498)
Are you really comparing your professional expertise with something you've just started to learn for your wedding website?

If all you know is C, writing an “Hello world” in C will be easier than doing the same in Python, but is that really a good insight of which language is easier to write ?

Re:Qt for WebAssembly by sho_hn on Tuesday June 19, 2018 @09:25PM (#17351687)
I see your point, but no. I've made websites semi-regularly since the late 90s and have contributed to a browser engine, so it's not lack of familiarity. This was just the first site in a few years. I think my argument takes rustyness/routine into account.
Re:Qt for WebAssembly by dimgl on Tuesday June 19, 2018 @04:01PM (#17349871)
> QML > consciously crafted

LOL

Re:Qt for WebAssembly by sho_hn on Tuesday June 19, 2018 @04:07PM (#17349904)
Now QML has its warts for sure, but it benefits from being designed with well-known use cases in mind, so it has lots of features suitable to them.

HTML was designed for structured, flowing text documents and everything else got bolted on top with only partial awareness of where the journey was headed (reading up on the origins of stylesheets and the relevant discussions is interesting in this respect). As a result it's just a mess for what it's used for now, pain-alleviating salves like flexbox notwithstanding.

When I do any non-trivial UI in the web stack, I can feel I am in continuous workaround territory. I'm trying to bend something ill-suited to my will. I don't get that feeling with QML.

Re:Qt for WebAssembly by martin_ky on Wednesday June 20, 2018 @04:28AM (#17353534)
> When I do any non-trivial UI in the web stack, I can feel I am in continuous workaround territory. I'm trying to bend something ill-suited to my will. I don't get that feeling with QML.

That has been my experience as well.

I think the web dev crowd advocating HTML/CSS originates in a) limited knowledge beyond the web tech field, and/or b) thinking that web is the state-of-the-art of computing.

The trouble with modern web is, that it was not so much designed as it evolved. But evolution in general is doggone slow and produces mistakes and mutations. I think the evolution of the web platform is still in a very early phase.

Re:Qt for WebAssembly by shittyadmin on Tuesday June 19, 2018 @04:49PM (#17350198)
Try writing something as simple as a dialog in Qt. It all makes sense, you subclass a QDialog, instantiate it and show it.

Try doing that in pure HTML/CSS/JS, you're basically left with a clusterfuck. There's piles and piles of libraries built to workaround this clusterfuck from Bootstrap to react-modal and even the best of them have worse APIs for this than Qt does.

Ultimately, drawing widgets just makes more sense for desktop applications than trying to hack document-oriented HTML to be a usable UI framework.

Don't get me started on layouts...

Re:Qt for WebAssembly by dchest on Tuesday June 19, 2018 @05:29PM (#17350421)

    <dialog>
        <p>Hello world</p>
        <button>OK</button>
    </dialog>

    <script>
        let dialog = document.querySelector('dialog');
        dialog.querySelector('button').addEventListener('click', () => dialog.close());
        dialog.showModal();
    </script>
Re:Qt for WebAssembly by yoavm on Tuesday June 19, 2018 @07:57PM (#17351287)
Yeah, it would be great when it'll work for more than just 60% of the internet users. Maybe then we can actually use it!
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @05:16AM (#17353713)
I'm so sorry that a little bit of HTML and JavaScript reminds you and other commenters under my post of web developer's Old Browser nightmares and brave endeavors of satisfying 100% of Web users at any the cost, but we're talking about Electron which ships a quite recent version of Chromium :-)
Re:Qt for WebAssembly by singularity2001 on Wednesday June 20, 2018 @05:13AM (#17353698)
https://caniuse.com/#search=dialog ? NO! <script> confirm("No dialog needed") </script>
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @05:24AM (#17353753)
Nice table, which shows that you are free to use <dialog> and many other modern features to write your Electron app:

  Electron v2.0.2
  Chromium v61.0.3163.100
  Node v8.9.3v8 v6.1.534.41
Re:Qt for WebAssembly by singularity2001 on Wednesday June 20, 2018 @11:28AM (#17356286)
Electron… fair point! Except we were comparing new web GUIs.

On the flip side Electron explicitly does not impliment confirm() and prompt() which made me furious.

So there is definitely truth in the general js=cluster-fuck sentiment.

Re:Qt for WebAssembly by hajile on Wednesday June 20, 2018 @02:35PM (#17358288)
`confirm()`, `alert()`, `prompt()` and similar are widely regarded as mistakes. Including them on your new Electron app isn't something you should be doing in the first place.
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @03:21PM (#17358796)
Re:Qt for WebAssembly by singularity2001 on Wednesday June 20, 2018 @05:01AM (#17353652)
TypeError: dialog.showModal is not a function
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @05:20AM (#17353724)
Your Electron version is old; if you're shipping it, you're probably putting your users at risk due to security issues in them. Check the latest versions here: https://electronjs.org/releases
Re:Qt for WebAssembly by _ZeD_ on Wednesday June 20, 2018 @01:57AM (#17352937)
cool... then now make it work for ie. and mobiles. and... everything else other than the betas of chrome and firefox
Re:Qt for WebAssembly by thiht on Wednesday June 20, 2018 @11:51AM (#17356491)
Re:Qt for WebAssembly by littlestymaar on Tuesday June 19, 2018 @08:54PM (#17351531)
You forgot a few part of the experience :

- learn C++

- install a C++ compiler

- learn Qt

- install Qt

For the web, you just need a browser, and JavaScript & CSS is way simpler and with way more documentation (especially for beginners). And for a simple modal dialog, you'll end up with 20 lines of code with no need for any framework …

Re:Qt for WebAssembly by _ZeD_ on Wednesday June 20, 2018 @02:00AM (#17352945)
for the web you need to

- learn html

- learn css

- learn javascript

- learn ui framework whatever

- learn what a transpiler is

- install node.js just to process your files

- learn how a client-server architecture works

- learn how to setup a web server

...

dude, you just don't know how deep this rabbit hole is

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @04:04AM (#17353438)
Lol, this is ridiculous.

You need to learn HTML, CSS and JS, but that are orders of magnitude easier than C++. Many people using it doesn't even have any computer science training.

Everything else you said (transpiling, framework, webserver) is totally optional and context dependent. And absolutely not needed to write a modal … I wrote a personal website this year, and I didn't need a single of this. Of course they are useful if you want to write a professional web app, but so is unit testing, a CI server, or a build system. But this isn't necessary to do simple stuff on the web.

Writing a website has a incredibly low barrier to entry, that why so many people complain about web developers not being real devs.

If you think the web is harder to grasp that the C++ ecosystem, you're being delusional to say the least.

Re:Qt for WebAssembly by shittyadmin on Wednesday June 20, 2018 @09:36AM (#17355182)
Orders of magnitude easier than C++? Please. C++ at least done Qt style really isn't that bad, it took me a few hours to get up and running with a reasonable Qt setup at work and start a project, when I had to do the same for electron I spent nearly a week mucking with gulp, babel, react and reading about which packing solution I should use, if I want to use TypeScript or Flow and if I can integrate them with the libraries I need to work with...

Learning Qt is much easier than the JS ecosystem. It's one intergrated package with no messing around and a very clear suggested structure to applications.

My coworkers still seem to want to hack everything in to main.js, can't understand react and one of the main libraries we are required to work with just doesn't integrate well with it at all. On the Qt side of things everything flows smoothly, the class architecture makes sense.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @03:10AM (#17353236)
A computing course that doesn't teach C++ is a quite poor one.
Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @04:16AM (#17353478)
What year is it again? Many (if not most?) computer science classes don't teach C++ anymore. They still teach C or Java, but not C++.

You need to realize the world you live in: while still useful for some specific applications, C++ is not a mainstream language anymore.

Re:Qt for WebAssembly by ahartmetz on Wednesday June 20, 2018 @08:49AM (#17354859)
C++ is used by most games and widely used in embedded computing, often with Qt. All major HTML engines are written in C++, too. You seem to be confusing your immediate environment with the world.
Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @04:24AM (#17353518)
My university never teached C, first year students were perfectly able to understand C++ in early 90's.

It still does nowadays, in 2018, and like any good CS degree it teaches lots of other programming languages and paradigms as well.

There is lot of room for learning during 5 years.

If a computer science class in 2018 only does language X or Y, it is indeed quite poor.

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @05:01AM (#17353651)
Oh, but there's plenty of language to teach : Java, Python, JavaScript, etc. and guess what. None of those were invented «early 90's» ;).

If a university wants to teach object-oriented programming, they can teach Java or C++. Guess which wins the decision in the majority of cases …

C++ isn't mainstream anymore, get used to it.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @05:35AM (#17353803)
An university teaches much more than just object-oriented programming.

In 2018 C++ is the programming language driving Machine Learning, VR/AR, HPC, Fintech, GPGPU, WebAssembly, compiler research, OS research.

Which are all CS degree relevant subjects.

If you want to learn a specific language for whatever is currently cool on the job market there are vocational schools for that.

Re:Qt for WebAssembly by detaro on Wednesday June 20, 2018 @05:09AM (#17353686)
Java: 1995

Python: 1991

JavaScript: 1995

> If a university wants to teach object-oriented programming, they can teach Java or C++

Or Python. Or Smalltalk. Or Ruby. Or...

IMHO you both go off the opposite ends: No, a generic "developer" isn't badly educated if they don't know C++, but that doesn't mean C++ is some irrelevant language. It's critical for some domains of computing, and widely used.

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @06:19AM (#17353985)
> IMHO you both go off the opposite ends: No, a generic "developer" isn't badly educated if they don't know C++, but that doesn't mean C++ is some irrelevant language. It's critical for some domains of computing, and widely used.

I never said it was irrelevant, I said it wasn't the mainstream it was in the early 90s. See my post above:

> while still useful for some specific applications, C++ is not a mainstream language anymore.

So are on the same line you and I :

> a generic "developer" isn't badly educated if they don't know C++

Re:Qt for WebAssembly by htor on Tuesday June 19, 2018 @05:20PM (#17350375)
if you're having a hard time doing modals and layouts with html and css you should perhaps start over and try grasping the core concepts. this system, unlike qt, is about separation of concerns, so structure and presentation are defined separately. far from a clusterfuck, it's actually a very good idea. if you are having a hard time finding non-crap libraries, then build your own pile of shit library. at least there are plenty of choices to pick from. it's called an ecosystem and it, unfortunately, is what you people don't have.
Re:Qt for WebAssembly by remoroid on Tuesday June 19, 2018 @05:55PM (#17350597)
No... Leaving aside your opinion that Electron is easier, Electron forces an unsolvable problem on you - the performance of the app is horrible. A bare bones nothing Electron app idles using 150mb ram and has a huge binary size, all 25 million lines of chromium and nodejs. And Javascript is slow and not designed for application programming.
Re:Qt for WebAssembly by 21 on Tuesday June 19, 2018 @05:57PM (#17350610)
Sounds like the argument C++ programmers use against Python.
Re:Qt for WebAssembly by remoroid on Tuesday June 19, 2018 @06:00PM (#17350634)
You're not responding to my point though? I have a slow laptop, and I cant run Electron apps. If I run a Qt app, it runs beautifully. Would people use VLC if it was made in Electron? No.

I like Python too.

Re:Qt for WebAssembly by 21 on Tuesday June 19, 2018 @06:05PM (#17350657)
Not everybody has a slow laptop. And while people wax how computers from 80s were booting in 2 seconds and everything was lightning fast compared to the bloated software of today, there doesn't seem to be much of a movement towards ditching todays computers and going back to Windows 95 and Mac OS 9.

https://insights.stackoverflow.com/survey/2018/#development-...

Re:Qt for WebAssembly by remoroid on Tuesday June 19, 2018 @06:17PM (#17350729)

  > Not everybody has a slow laptop
No shit, my point was, and still is, Electron has extremely poor performance, and theres no reason to use it over Qt..

You still havent responded to my point..

Re:Qt for WebAssembly by pjmlp on Tuesday June 19, 2018 @03:51PM (#17349777)
CSS3 hackary better than native frameworks?! Not really.

Maybe when I get to see Blend implemented with WebComponents.

Re:Qt for WebAssembly by dimgl on Tuesday June 19, 2018 @03:59PM (#17349857)
Hackery*, and I'm not sure why the hate towards CSS3. With a few lines of code I can build a pretty good looking responsive UI that doesn't take hours to polish.
Re:Qt for WebAssembly by sireat on Wednesday June 20, 2018 @07:27AM (#17354328)
I'd give my left toe to learn to do this in a few lines of code in HTML/CSS3.

Desktop centric UI toolkits provide a set of widgets which lets me build up a UI in a predictable way that respects my sanity.

Windows Forms, WPF, Qt, vxWidgets, tkinter, Java AWT, SWT etc they all have warts but ALL of them feel faster than building UI for the web.

The problem with web is that there are no consistent set of widgets.

Let's take a stupid date picker. A year ago for a project I thought I'd use the HTML5 <input type="date"/> way no Javascript needed!

Sadly I couldn't figure out a way to keep the calendar in an always on state so had to resort to jQuery datepicker. So jQuery widgets was an attempt to do what desktop UI does but now that is no longer in vogue.

Today on the web there is no consistency, there is no agreed upon toolkit. How many different approaches to widgets does React have?

Ideally you would be able to import a web component into your project and use it without worrying about any abstractions leaking.

Re:Qt for WebAssembly by pjmlp on Tuesday June 19, 2018 @04:20PM (#17349993)
Yeah, when running on a specific browser version targeting a single OS.
Re:Qt for WebAssembly by pcwalton on Tuesday June 19, 2018 @07:30PM (#17351153)
That's hardly true when it comes to CSS3 stuff that's been around for a decade.

Moreover, it's unfair to insist on portability when comparing native vs. Web without doing the same on the native side.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @02:02AM (#17352950)
Only if the only browsers one cares about are latest version of Chrome and Safari.

There plenty of deployment scenarios with other kinds of browsers.

Of course it is fair, using something like Qt, wxWidgets, or even roll our own was never as complicated to get pixel perfect UI across OSes.

Re:Qt for WebAssembly by crzwdjk on Thursday June 21, 2018 @12:37PM (#17366698)
Is pixel perfect UI really what you even want these days? With high-DPI screens and screen scaling being a thing, not everyone's pixels are the same. And that's not even talking about accessibility for people with low vision who want text to be big and readable.
Re:Qt for WebAssembly by littlestymaar on Tuesday June 19, 2018 @08:31PM (#17351442)
«native frameworks» => if you want a true native framework, you need one specific development per platform. Or more realistically, you end up developing for Windows only, unless you target a specific niche where MacOS is somewhat relevant, and never Linux.

Or you use a cross-plateform (not so native then) UI toolkit, like Qt. You have a sub-part UI experience and you still need to write C++. Why would you do that ? (And that's why the vast majority of software isn't developed this way).

CSS and JavaScript have quirks, but I mean, we're talking about C++ as an alternative …

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @01:58AM (#17352941)
No, you develop like we did on the 16 bit days.

Either do a new one for platform, which was the case when Assembly ruled.

Or make a proper application architecture suited to the applications being done in-house, that wraps the native APIs into general ones.

C++ is strongly typed and compiles to native code, a much saner alternative than "anything goes JS".

And CSS + JS are miles away what something like VB, Delphi or Smalltalk allowed in the early 90's.

Yes I know they weren't responsive and whatever.

There were layout managers already available, it was just a matter of actually using them.

Vast majority isn't developed that way, because it is cheaper to pay to young inexperience JS developers that are re-inventing the idioms of the 90's desktop UIs[0], than experienced C++ developers aware of what actually takes to make a good UI/UX.

[0] - https://bitquabit.com/post/the-more-things-change/

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @04:20AM (#17353499)
> Vast majority isn't developed that way, because it is cheaper to pay to young inexperience JS developers […], than experienced C++ developers

I think you just nailed the essential point: in 2010+, the young and cheap developers are JavaScript ones, and not C++ ones. Maybe that tells something about which one is the most accessible, don't you think?

Re:Qt for WebAssembly by martin_ky on Wednesday June 20, 2018 @03:28PM (#17358857)
I think, this goes way beyond just companies preferring to hire cheaper developers and beyond software engineering as such. There is a larger, universal force at play here. Examples of poorly designed, engineered and built things are everywhere in the world. It is seemingly cheaper to do it this way. But what may be saved upfront on production quality, is usually spent many times over on usage, maintenance and subsequent rebuilding, making the total cost higher.

For example, a road built with cheaper materials will break and need to be patched more often. A poorly engineered application will be slower, consume more CPU power, more data bandwidth and require more storage space, will be buggier and waste more users' time.

With only a very basic understanding of economic theory, I would imagine that market forces at scale would optimize these inefficiencies and ultimately work to reduce total costs. Perhaps this unconscious, natural process would even work, were we not consciously optimizing against it on the wrong variables, such as the next quarter's profits.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @04:27AM (#17353529)
I can also go to craigslist and get someone that does repairs on the side, or pay for someone that costs twice as much but actually does the job only once.
Re:Qt for WebAssembly by hajile on Wednesday June 20, 2018 @05:03PM (#17359753)
> C++ is strongly typed and compiles to native code, a much saner alternative than "anything goes JS".

C++ (though statically typed) is weakly typed.

Re:Qt for WebAssembly by pjmlp on Thursday June 21, 2018 @08:30AM (#17364471)
C++ is not C, if that is what you are getting at.
Re:Qt for WebAssembly by hajile on Thursday June 21, 2018 @11:08AM (#17365827)
C++ is not C, but is still weakly typed. I think even Rust is weakly typed in unsafe mode (I'm open to correction about that). This makes sense when you think about the CPU which is weakly typed and dynamically typed (it's also dynamically scoped unlike all the modern lexically scoped languages running on top of it).
Re:Qt for WebAssembly by steveklabnik on Thursday June 21, 2018 @01:46PM (#17367493)
"weakly typed" is not well-defined, however, I don't think that Rust is, even in unsafe. If you can provide a C or C++ example, I can tell you what that looks like in Rust.
Re:Qt for WebAssembly by pseudalopex on Tuesday June 19, 2018 @10:53PM (#17352195)
Qt has bindings for many languages, including JavaScript. It's capable of delivering experiences much closer to native than any Electron app I've ever seen. The catch is that a minimum-effort Electron app feels like a web page but a minimum-effort Qt app feels like a bad native app. There are also frameworks like wxWidgets that use actual native controls.
Re:Qt for WebAssembly by htor on Tuesday June 19, 2018 @05:26PM (#17350402)
...and what do you think is used to style webcomponents?
Re:Qt for WebAssembly by pjmlp on Tuesday June 19, 2018 @05:49PM (#17350545)
Lots of CSS hacks to make them work properly across all browser versions and OSes.
Re:Qt for WebAssembly by littlestymaar on Tuesday June 19, 2018 @08:38PM (#17351478)
What year do you live in? 2010? The most wanted features from CSS3 have been supported everywhere for years!

Look at the support for (flexbox)[https://caniuse.com/#search=flexbox] for instance.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @04:16AM (#17353479)
In the year where not all deployment targets are using the latest Chrome and Safari.

Where there are devices beyond computers and smart phones with browsers on them, the majority of them without any kind of update system in place and based in some kind of browser implementation.

Re:Qt for WebAssembly by hesarenu on Wednesday June 20, 2018 @04:03AM (#17353435)
You are not familiar with web are you?
Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @04:13AM (#17353470)
Doing web projects since 1997, coding across multiple platforms since 1986.
Re:Qt for WebAssembly by hesarenu on Wednesday June 20, 2018 @04:52AM (#17353632)
So not familiar with modern development? Since you don't need much CSS hacks now.
Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @05:37AM (#17353811)
So not familiar with the fact that not everyone runs the very latest Chrome or Safari on their desktop computers, and there are other kind of devices on the field?
Re:Qt for WebAssembly by imtringued on Wednesday June 20, 2018 @10:47AM (#17355876)
That's too generous. Even the things that work properly on every browser are usually hacks because HTML and CSS were made for documents rather than applications.
Re:Qt for WebAssembly by Tehdasi on Tuesday June 19, 2018 @06:57PM (#17350946)
It's more DOM vs. whatever framework.

DOM is very good for laying out webpages, but seriously falls over when trying to do layout for applications. The layout of the frameworks you mention are all designed around making application layout as efficient as possible.

Although WPF stands out, it's layout is for more DOM like than the others, and suffers for it.