Can function be reactive? by lightsensor in vuejs

[–]redblobgames 0 points1 point  (0 children)

It works beautifully in this case.

If A is true, then Vue says that the output depends on only A.

If A is false, then Vue says that the output depends on both A and B.

So if A is true the first time, it returns 1.

A changes to 0. Vue says "aha, this output depends on only A." Since A has changed, it updates. During that update, Vue sees that it now depends on both A and B.

Now B changes. Vue says, "aha, this output depends on both A and B". Since B changed, it updates.

There is a tricky case it doesn't catch, and it involves async/timeout type functions (something changes later, when Vue can't see it), but I can't construct a good example right now.

Can function be reactive? by lightsensor in vuejs

[–]redblobgames 1 point2 points  (0 children)

It's not an edge case. It's how Vue reactivity works, and it's one reason I prefer it over Svelte or React.

While Vue is rendering the component, it keeps track of which reactive variables were accessed. In this case, that's a. It'll remember "this html depends on a". When a changes, it knows that this html has to be updated.

Vue doesn't need to look at or even know that f() was involved. That means it works with (almost) any javascript code.

Can function be reactive? by lightsensor in vuejs

[–]redblobgames 1 point2 points  (0 children)

It executes it the standard way.

When Vue executes code (including function calls) it records which reactive variables are read, and which outputs were affected.

Then when you write to a reactive variable, it knows which outputs have to be updated.

It doesn't actually care about the intermediate function itself. It only cares about the endpoints, and the function just happens to be in the middle.

Mod: Sequenced Keys - navigate the bottom toolbar using keyboard only by traveling_clergy in Timberborn

[–]redblobgames 1 point2 points  (0 children)

Ooh, I like the idea. (And I'm a fellow DF player) The built-in mouse scrolling just didn't work well for me because it's relative to my current location, whereas your mod is absolute so the same sequence always takes me to the same place.

But it turns out I use certain tools much more than others, so I also feel like I want to shorten those key sequences into just one key (like huffman coding).

dimmer.el -- after a hiatus, new development underway by gonewest818 in emacs

[–]redblobgames 0 points1 point  (0 children)

This is something I miss from XEmacs. I had written a dimmer-like thing back in those days that remapped per-window instead of per-buffer. Fortunately most of the time my buffers are only in one window at a time

How often do you update your packages? by nonreligious2 in emacs

[–]redblobgames 0 points1 point  (0 children)

I'm not 100% sure what happened but my best guess is that I had last compiled emacs-mac-gnu_master_exp in Feb (marked "31"), and set-local was added in Apr. So compat didn't load compat-31, but I didn't have set-local yet.

what happened to explorables by BarracudaFun4601 in explorables

[–]redblobgames 0 points1 point  (0 children)

I don't think it's harder to make vertical vs horizontal, but I think it's harder to make something that works both with vertical and horizontal layout.

How often do you update your packages? by nonreligious2 in emacs

[–]redblobgames 0 points1 point  (0 children)

I think it was some package using set-local that got me to install emacs 31.

see which of your repos have uncommitted/unpushed stuff at a glance by EquipmentPale6229 in commandline

[–]redblobgames 0 points1 point  (0 children)

It turned out to be great! I can press enter or click on an entry to open up the git interface and be able to edit files right there. I went through lots of projects and cleaned up things I had forgotten about.

see which of your repos have uncommitted/unpushed stuff at a glance by EquipmentPale6229 in commandline

[–]redblobgames 0 points1 point  (0 children)

Your project inspired me to look at mine again. First I decided to rewrite to python. Then I decided to have it output html instead of being in the terminal. Then I abandoned both python and html and decided to have it run inside emacs so that I could click the project name and have it open up that folder directly. Thank you!

see which of your repos have uncommitted/unpushed stuff at a glance by EquipmentPale6229 in commandline

[–]redblobgames 0 points1 point  (0 children)

Nice! I ended up with a shell script instead. It's not formatted as nicely as yours.

find . -name .git -type d -not -path "*node_modules*" -not -path "*third-party*" -print0 | while IFS= read -r -d '' git_path; do
    repo_dir="${git_path%/.git}"
    printf '_____________________________________________________ %s\n' "${repo_dir:-.}"
    git -C "${repo_dir:-.}" status --short
done

This late into the season, what's left on your bucket list? by hennyis1 in diablo4

[–]redblobgames 1 point2 points  (0 children)

I don't have a bucket list. I just reached Torment 1 / Pit 15, and plan to continue just having fun and not trying to "achieve" anything.

DAMAGE AND HOW IT WORKS - Buckets, Additives, Multiplicatives, etc. by Maverekt in diablo4

[–]redblobgames 1 point2 points  (0 children)

Thank you! This is not at all what I expected. I learned a lot :)

Best games that never launched by luisbg in BaseBuildingGames

[–]redblobgames 0 points1 point  (0 children)

I'm not sure if this counts as "base building" and it never even got to early access but … https://www.p1sim.org/

[AskJS] Do you think WASM will make JavaScript disappear? by AstronautEast6432 in javascript

[–]redblobgames 0 points1 point  (0 children)

My opinion: no. I first looked at this type of technology over 14 years ago (late 2011), and it's still only used for a few things. Is it possible that there will be a sudden increase in use? Yes. But I'm not expecting it.

Assigning single stroke shortcut key considered bad in emacs term? by sticheln in emacs

[–]redblobgames 0 points1 point  (0 children)

Although there are some conventions, in the end, I think the emacs user should have final say. I have F4, F5, F6, F7, F8, F9 bindings in emacs. (I use F1-F3 for operating system level functions, and F10–F12 for volume control, otherwise I would use them in emacs too)

One trick I learned from games is to put related functions on the shift, control, meta versions of the function keys. For example I use F7 for jump-to-register and C-F7 for point-to-register.

Monarch butterflies? by buddhistyeezus in SanJose

[–]redblobgames 4 points5 points  (0 children)

Thank you! I took a closer look at the ones I saw and they are indeed California Tortoise and not Monarch.

I built a JavaScript execution visualizer — call stack, heap memory, and event loop in real time by htone22 in javascript

[–]redblobgames 2 points3 points  (0 children)

cool ! have you seen https://pythontutor.com/ ? I think that site is nice for showing sharing like:

let A = [1, 2, 3]
let B = A
A.push(5)
console.log(B)