HN user

olcay_

32 karma
Posts0
Comments13
View on HN
No posts found.
Deno Desktop 1 month ago

There's Compose Multiplatform if you are willing to switch to Kotlin. Only caveat is that it uses Canvas rendering on web.

I set my chats to be automatically deleted in 24 hours. This way when we have a small argument with someone, there's less chance of someone being triggered/angered by re-reading the chat. Although there have been rare cases where I had big arguments and would've liked to have the receipts.

If WASM succeeded in being the one universal ABI, it could be the perfect successor to the unix pipe for the AI age. Wasm modules for libraries, that double as terminal tools.. One could only imagine

Teaching Claude Why 2 months ago

It's interesting that they lowered the misalignment rate by that much with only 3m tokens of training.

Maybe we can align models by ourselves to our liking in the future.

Anthropic coming out to say they won't surveil Americans wasn't actually a positive for me. It meant they're okay with surveilling the rest of the world, which in turn signaled "fuck you, you're inferior, deal with it" to me (as someone from the aforementioned rest of the world).

When OpenAI snatched those contracts, it made me think no worse of OpenAI. The surveillance was already factored into how I saw them (both).

I think Jetpack Compose is not actually as bad as you think. I think it's really great and I wish more people caught on actually.

I can't comment on the learning materials as I was following it since the project started and I was already accustomed to the Android Developers website.

Kotlin has a few reactiveness concepts that make reactivity easier but might scare off developers from other languages. The most important ones are Flows and Coroutines.

Say you want to have a UI that shows the current list of connected devices that should always show up to date info. The function to get the list would be something like this:

  val devices = manager.getDevices()
But you need it to be declarative instead of imperative, so you use a Flow:
  val devices = flow {
      while(true) {
          emit(manager.getDevices())
          delay(1000)
      }
  }
Devices is now a cold flow. It does nothing unless it's being collected. When you start collecting it, e.g. by using collect:
  devices.collect { list -> ... }
Now it starts running the while loop and you get the up to date devices list in your lambda every second. You can also make the lambda run only when the list has changed, or debounce it, or run only for the latest value, and more with trivial function chaining. But this function is suspending, which is Kotlin's way of async functions, and suspend functions take turns running on the threads that are managed by the coroutine scope they are in, so you need to provide it a coroutine scope by wrapping your collection in scope.launch { ... } .

And your viewmodel can now collect the flow in a way that's going to be accessible without suspending (async) functions by turning it into a StateFlow:

  val devicesStateFlow: StateFlow<List<Device>> = devicesFlow.stateIn(scope, some more arguments...)
  // Now synchronous code can call like this:
  print(devicesStateFlow.value)

  // And Compose (reactive ui) code can do this in Composable functions:
  val devicesState by vm.devicesStateFlow.collectAsState() 
I think that was the source of confusion you had when you were trying to use datastore. It's designed for reactive applications so you were supposed to use it in a viewmodel, turn it into a stateflow and collect it as state in your ui.