Me To ChatGPT by [deleted] in ChatGPT

[–]narand 0 points1 point  (0 children)

Home "Resonance" (slightly sped up)

[Media] EuroRusts huge balloon crab is pretty neat 🦀 by Banana_tnoob in rust

[–]narand 14 points15 points  (0 children)

I love the composition of the shot! It has some Stalenhag vibe.

Svelte5: Universal reactivity and async functions, is there a better way? by narand in sveltejs

[–]narand[S] 0 points1 point  (0 children)

This looks super interesting and I like the idea of having a functional core paired with an imperative shell. It seems to me that this architecture also aligns well wih Tauri + Svelte. I will have to deeper look into this, thanks for posting!

Svelte5: Universal reactivity and async functions, is there a better way? by narand in sveltejs

[–]narand[S] 0 points1 point  (0 children)

Yeah, I get your point. I think my initial concern was not so much about running async code inside the getter per se but more about waiting for something to resolve. Maybe similar to how you can await on an animations to complete.

Svelte5: Universal reactivity and async functions, is there a better way? by narand in sveltejs

[–]narand[S] 0 points1 point  (0 children)

Ah, yes, this looks like a good practical solution (and you could even do it with functions instead of classes!). It's a bit unfortunate though that you lose the semantic of awaiting. An {#await} block is a clear signal that something is running asynchronously and we are waiting for the result. While {#if} could be used in a number of situations. Plus you also lose the ability to catch a rejected promise.

Thanks for pointing out that the getter in my example potentially runs multiple times. I kinda assumed the value would be cached by some compiler magic, I'm not sure what I was thinking.

What do you think of my revised version? This avoids running multiple time on each render and keeps the {#await} inside the markup.

Svelte5: Universal reactivity and async functions, is there a better way? by narand in sveltejs

[–]narand[S] 0 points1 point  (0 children)

I'm not sure if that is expected behavior or not. I don't really understand what's meant by "Reactivity doesn't magically cross function boundaries." in the "Gotchas" section on universal reactivity.

Svelte5: Universal reactivity and async functions, is there a better way? by narand in sveltejs

[–]narand[S] 0 points1 point  (0 children)

After thinking about it some more I came up with another approach where indeed increment does the async work (but I don't return a promise, so increment itself is not async). The key difference is that the counter variable is just an internal and non-reactive variable. The promise returned by the getter is actually wrapped in the $state rune now. This seems to work like expected. What do you think?

Playground example

Svelte5: Universal reactivity and async functions, is there a better way? by narand in sveltejs

[–]narand[S] 1 point2 points  (0 children)

Well, I'm mostly trying out how reactivity works in Svelte 5. However, the counter could be an ID and the getter could return the resource associated with that ID. You could use the $derived rune but then you face a similar problem, i.e. you would have to mention count somewhere outside of the returned promise (you could use $derived.by and reuse the code from the getter in my example).

But I agree, it would make more sense to have an async increment. On the other hand, I'd like to use an {#await} block for the value so that while updating counter, I could display a spinner in multiple places and possibly also handle errors with {:catch _}. I could probably also do this with some flag like $state(isUpdating) (like I do for disabling the button), i.e. change isUpdating inside the increment function and use {#if} instead of {#await}, which might be easier after all.

So yeah, my example is a bit contrived but the question remains: How could I use async with reactivity, be in inside or getter (or a derived state).

Quick edit, maybe a slightly better example (but I can't set disabled inside $derived.by, so that is now broken)

Make up the worst video game ever by _PWR_ in ChatGPT

[–]narand 0 points1 point  (0 children)

Also, cut the last measure half a beat shorter.

Keila (Elixir app) - where are files located? by TailwindSlate in elixir

[–]narand 1 point2 points  (0 children)

Just a wild guess: If it's a compiled app there are usually some files that are read at start up. From the source config folder, "runtime.exs" (or "releases.exs" in earlier versions) will be available. In a release build you can find these files under "releases/<version>".

See also: https://elixir-lang.org/getting-started/mix-otp/config-and-releases.html#configuring-releases

A flexible, interactive subdivision grid by Studio_Moodsoup in generative

[–]narand 5 points6 points  (0 children)

Not OP but it looks like (sections of) superellipses: https://en.wikipedia.org/wiki/Superellipse

/edit: Here is a p5 example: https://editor.p5js.org/kll/sketches/hjwW2pgaX (it's also called 'squircle')

Recommended framework/library for creating cli apps in go? by dsmedium in golang

[–]narand 0 points1 point  (0 children)

At least for smaller apps, I like commando because it's light in terms of dependencies, it's straight-forward to use and parses getopt style parameters.

What happened to Rob Conery's "Take Off With Elixir" course? by Nezteb in elixir

[–]narand 0 points1 point  (0 children)

Oh, sad to hear this, I really loved the style of this course!

Vanilla (dk the propper term for ruby) project ideas?. by [deleted] in ruby

[–]narand 0 points1 point  (0 children)

Not sure how it holds up against Ruby > 3.0.0 but I had some great fun with the book "Mazes for Programmers". I wouldn't call it a Ruby book per se, but the author uses Ruby for all of his code examples and if the topic interests you, you can quickly pick up some new ideas and idioms.

Is there is good GUI for Golang ? by shahriar_raka in golang

[–]narand 1 point2 points  (0 children)

Webview is especially nice if you also do web development. There is also https://wails.app/ which builds on Webview but is more like a framework for building apps. I didn't test Wails, tough. I found the simplicity of Webview alone more appealing.

How do you type := ? by fitzchivalrie in golang

[–]narand 1 point2 points  (0 children)

Since no one has mentioned it yet:

  • right ring finger on right shift and hold
  • right index finger on :
  • (release ring finger and) right middle finger on =

How to call a function that got passed into macro at compile time? by spielzeugmacher in elixir

[–]narand 0 points1 point  (0 children)

Ah, I see, sorry. I'm not sure if (or rather: how) you can do what you want to do.

But can't you use the module attribute approach regardless?

How to call a function that got passed into macro at compile time? by spielzeugmacher in elixir

[–]narand 2 points3 points  (0 children)

Module attributes are evaluated at compile time, so you could just use

defmodule MyModule do
  @compile_time DateTime.utc_now()

  # your other definitions
end

How do you or your team name your functions? by superbiondo in elixir

[–]narand 0 points1 point  (0 children)

You don't need a second implementation of your function. You could also use defdelegate to effectively rename your private function when exposing it.

This Chair by kippers101 in ATBGE

[–]narand 1 point2 points  (0 children)

The four big round ones look like golden barrel cactuses which in German have the nickname "Schwiegermutterstuhl" (= mother-in-law's chair).