cuchaz,
@cuchaz@gladtech.social avatar

Once again I get foiled by switching languages. :blobcatfacepalm2:

In Javascript, you have to compare strings with ===, not ==, or else you'll run into type coercion problems, because Javascript thinks 1 == "1" is a totally fine thing to be true. (it's not)

But in Kotlin, === compares identity not equality for strings. But in the JVM, string values are aggressively cached, so === actually does what you want most of the time. Unless your strings come from weird places, like JNI code. Then you get awful non-deterministic behavior that's incredibly hard to debug, but it totally goes away when you use the correct comparison operator == for strings.

sigh I'm not really as good at this whole programming thing as I should be by now.

happyborg,
@happyborg@fosstodon.org avatar

@cuchaz
Programming is hard.

A skill is choosing systems and tools that make it easier and making meta choices to enable you to maximise your agency in those choices.

I remember the pain I endured learning #nodeJS a decade ago, then looking at #Angular [shudder] and #React hmm.

Then the pleasure that followed learning to use #Svelte and #Rust. You'd have a hard time getting me to use anything else now. Not happening.

My debut Rust project is now part of debian / Ubuntu.

"===" 🤣
#RustLang

cuchaz,
@cuchaz@gladtech.social avatar

@happyborg Rust is definitely an improvement in language design, and tooling too. Tragically, I can't use it everywhere. Like browsers. Sure, browsers have WASM now, but I still feel it's not ready for primetime just yet.

happyborg,
@happyborg@fosstodon.org avatar

@cuchaz
I've used it previously in the browser and found it worked well.

Since then it's much easier and my demo uses Tauri + Svelte + Rust to target desktop and mobile. My first dabbling with Android so it will be an interesting test.

What things are you waiting for or think aren't ready?

cuchaz,
@cuchaz@gladtech.social avatar

@happyborg what always bothers me about WASM in web land when I periodically check in on it is that you can't really build much using just the WASM VM yet. You still need the JS VM for really basic stuff like accessing the DOM, or fetching resources, so it seems like it's purely extra complication to bring WASM into the mix. It seems far easier to just not do that.

I haven't checked in on WASM in maybe 6 months or so tho, so maybe things have gotten better now?

happyborg,
@happyborg@fosstodon.org avatar

@cuchaz
Of course it depends on what you value and are trying to achieve, and if what you have works there's less need to change that.

I like new tech, and I like to both learn to use it and apply it, so that creates the opposite bias.

For what I was trying to do though, and indeed for my current demo, I did need WASM (Rust in browser), so it's not just about my preferences. WASM opens lots of possibilities so it is worth evaluating IMO.

Trying it out will help decide when/where to use it.

cuchaz,
@cuchaz@gladtech.social avatar

@happyborg for sure. I feel like WASM in the browser now is a good fit for compute-heavy workloads, but maybe less good for DOM things and IO. So I wouldn't reach for it first for usual web app things like fetching and UI work, but I'm tempted to try it out for cryptography libraries.

The thing I'm worried about there is performance of the channel between the JS VM and the WASM VM. Would, say, encrypting a large file perform well if we had to send it into (and out of) the WASM VM? Or would keeping everything in the JS VM be faster, even tho JS bytecode probably executes a bit more slowly. Because handling the sensitive cryptography bits in a more suitable language like rust has a lot of safety benefits, but it might not be worth it if low performance makes the UI unusable.

dngrs,
@dngrs@chaos.social avatar

@happyborg what didn't you like about angular? I found it surprisingly pleasant, especially the reactive API. Though that can be rather brain melting too, and hard to debug...

happyborg,
@happyborg@fosstodon.org avatar

@dngrs there you go, you didn't even last to the end of the sentence! 😆

Try Svelte and you'll never ask anyone that again.

litchipi,
@litchipi@fosstodon.org avatar

@happyborg @cuchaz I'm not at all a frontend dev, but touched a bit of Javascript, and svelte really seamed to be the best modern JS framework !
Maybe i'll get back to learning frontend with Svelte one day 😁

But happy to see it's confirmed, and not just the feeling of a noob in the matter

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines