Follow

I have a theory that I'd like y'all's help in testing. Setting aside convention/what you're used to as much as you can, which of the following two code examples do you find more readable?

Door number 1: svelte.dev/repl/hacker-news?ve

Door number 2: svelte.dev/repl/db03d0d8898b47

(Also interested in any additional thoughts you have beyond a simple vote)

@codesections I was surprised by the Promise chaining in both examples (line 15, ex 1). I would probably simply await the first call, then either perform the second one synchronously or, if it is in fact async, await it, too.

I think there are few situations where you absolutely have to use then() and unless you encounter one, I'd stick with await.

Someone correct me if I'm missing something, it's been a while for me.

@codesections I can see the appeal behind Door number 2.

But I had to learn and write some Lisp code in the recent past. Maybe that opened my mind a little.

@codesections The second one is mixing two different languages on the same line, like it's one entity.

That looks ugly and confusing to me.

The separation does not stand out, and I'd guess this would cause a few weird errors and unintended deletions.

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.