HNHacker News
TopNewBestAskShowJobs

onsclom

214 karma · joined October 21, 2021

onsclom.net
submissionscomments
onsclom··on What dif­fer­enti­ates front-end frame­works
This QML example is implementing the example from the article, and the article already implements this example in Svelte. However, the Svelte implementation becomes even more concise when you inline the functions:

  <script>
   let count = 0
  </script>
  
  <button on:click={()=>count--}>decrement</button>
  <span>{count}</span>
  <button on:click={()=>count++}>increment</button>
  <button on:click={()=>setTimeout(()=>count++, 1000)}>
   increment later
  </button>
Play with this in the Svelte REPL here: https://svelte.dev/repl/97d42ad98e4b4a929d3c5a3de880e6fc?ver...

Doing this, I also realized rubymamis cheated a good bit on their QML version. It's missing the text for the buttons. It's not wrapped in `ApplicationWindow { }`. And there's a bug with their implementation: If you clicked their "increment later" button many times quickly then it would keep resetting the timer and only increment once.

onsclom··on What dif­fer­enti­ates front-end frame­works
Having used both QML and Svelte, I enjoy Svelte a lot more. The reactive APIs are very similar, just declare variables, mutate them, and use them. But Svelte is much nicer for many reasons:

1. It uses modern JavaScript and not some limited custom ES5-like JavaScript

2. Svelte can be used with TypeScript so your UI code can be statically typed

3. The integration with Svelte and VSCode is much better than QML and Qt Creator (the big thing is that IntelliSense is much better at analyzing JavaScript code than whatever Qt Creator uses)

4. Having an actual live reloading dev server is so much nicer than compiling and running for every change

5. Svelte has much better documentation than QML

These are just the first things that came to mind, but I could probably keep going for a while. Do you think I'm being unfair to QML? And/or have you used Svelte?

onsclom··on Show HN: Gemini web client in 100 lines of C
If you or someone else finds the link to this, I would love this!
onsclom··on Why do we create modern desktop GUI apps using HTML/CSS/JavaScript? (2022)
> That is not my experience. Visual Studio Code doesn't seem to run as smoothly as I would like. Meanwhile every C++/QT application I have run works perfectly. Where are you getting this from?

I’m in a bit of a unique position where I work on both a Qt app using Qt Creator and a React app using VS Code. Qt Creator has crashed on me numerous times, has slower initial loads, regularly has weird visual bugs, and is overall much less enjoyable to use.

I develop on a modern windows computer. Maybe Qt Creator performance wins against VS Code on Linux? In my experience, VS Code does not perform as well on Linux as it does on Windows or OSX.

onsclom··on Functional Programming – How and Why
Great points! I am still trying to figure out how to best use functional programming with JavaScript. I've found writing performance critical parts imperatively while being conscious about shared mutable state is a decent compromise.

> My second advice is to not use recursion to process arrays languages (like JavaScript) that have a very limited call stack size.

Can also confirm this, here was my process on the some of the harder days in Advent of Code:

1. I wonder if I can solve this in a pure functional style with JavaScript

2. Yay, it works on the example input

3. Oh, I hit the call stack limit on the real input

4. Time to rewrite the recursion as a loop lol

← PreviousPage 2 of 2