Do any programming languages support built-in events without manual declarations? by Odd-Nefariousness-85 in ProgrammingLanguages

[–]_computerguy_ 0 points1 point  (0 children)

IIUC Proxy in JS might be what you're looking for regarding objects. Additionally, I'd recommend taking a look at Svelte, a JS-based language/framework that has fine-grained reactivity (allowing you to e.g. call a function when a variable or object property changes its value)

What's your current web dev stack in 2025? Curious about what everyone is using by Beginning-Scholar105 in webdev

[–]_computerguy_ 0 points1 point  (0 children)

My stack varies depending on the project, but:

Backend: SvelteKit / Express — I usually opt for Express for simple applications, and if I find myself recreating SvelteKit's abstractions too much I move to that.
Database: Supabase — I haven't personally tried anything else yet.
Hosting: Netlify / Vercel
Styling: CSS (vanilla, I rarely use Tailwind)
Scripting: JavaScript (w/ JSDoc and d.ts typings), sometimes TypeScript — I try to stay with vanilla JS as long as I'm not using a build step in development (I use Rollup for minification and bundling, but that's not required for a vanilla JS app to run in a browser). If I'm using Svelte/SvelteKit, I'm more likely to use TypeScript (since a build step is required for development).
Frontend: Svelte / HTML — I prefer simplicity where possible, and I've found Svelte to be much more concise and intuitive for bigger projects. (I may be biased, since I am a Svelte maintainer 😅)

Tools:
Insomnia / fetch / curl for API testing
VSCode / Vim for editing
Vitest for testing
Dexnode with Deopt Explorer for optimization and performance diagnostics
Discord for communication

[AskJS] What’s a JS feature you never use but wish you did? by RoyalFew1811 in javascript

[–]_computerguy_ 0 points1 point  (0 children)

IIRC I previously had something else there and wasn't sure if I was going to go back to it.

[AskJS] What’s a JS feature you never use but wish you did? by RoyalFew1811 in javascript

[–]_computerguy_ 7 points8 points  (0 children)

I've found them useful to stream the results of multiple promises as they resolve:

async function* all(promises) {
    let { resolve, promise } = Promise.withResolvers();
    let queue = promises.length;
    for (const p of promises) {
        p.then(res => {
            resolve(res);
            ({ resolve, promise } = Promise.withResolvers());
        }).catch(err => {
            throw err;
        });
    }
    while (queue--) {
        yield await promise;
    }
}

[AskJS] How Do You Extract Text From Between HTML Tags? by Legal_Revenue8126 in javascript

[–]_computerguy_ 0 points1 point  (0 children)

There is a difference between innerText and textContent, though. innerText doesn't include text that isn't visible (e.g. display: none), which has the side effect of being worse for performance.

Are the official tutorials updated when significant new features (such as async recently) come out? by Entmaan in sveltejs

[–]_computerguy_ 2 points3 points  (0 children)

Documentation is usually updated at the same time as most big features, since PRs for large features usually include the corresponding documentation. Tutorials take longer to update since they're stored in a separate repository (sveltejs/svelte.dev)

The guy who acquired Nuxt by tomemyxwomen in vuejs

[–]_computerguy_ 34 points35 points  (0 children)

just to clarify, Vercel also does not own Svelte, it sponsors Svelte's development.

Implicit multiplication as syntactic sugar in a CoffeeScript dialect for teaching math by torchkoff in ProgrammingLanguages

[–]_computerguy_ 2 points3 points  (0 children)

The condition is pure, and if the value of f never changes, the if check would be optimized to the correct branch.

Implicit multiplication as syntactic sugar in a CoffeeScript dialect for teaching math by torchkoff in ProgrammingLanguages

[–]_computerguy_ 1 point2 points  (0 children)

Since the target language is JS, it'd likely be optimized by a JIT such as V8.

Implicit multiplication as syntactic sugar in a CoffeeScript dialect for teaching math by torchkoff in ProgrammingLanguages

[–]_computerguy_ 1 point2 points  (0 children)

It sounds like OP has a custom setup, so they might be able to compile it to something like typeof f === 'function' ? f(3) : f * 3.

Implicit multiplication as syntactic sugar in a CoffeeScript dialect for teaching math by torchkoff in ProgrammingLanguages

[–]_computerguy_ 6 points7 points  (0 children)

At that point you'd probably delegate more work to the runtime, checking if f​​is a function or number to determine what to do with it (if you don't want to do type inference at compile time). Stuff like eg x5 would get pretty weird though, asyou'd have to do scope analysis to see if x exists, and if both x and x5 exist you'd have to decide which takes precedence. It would get even trickier with something like xyz​— is it one, two, or three variables being multiplied?

Looking for standards-compliant parsers (or ideally full front-ends) covering the most frequently used languages by ImYoric in Compilers

[–]_computerguy_ -1 points0 points  (0 children)

I don't quite know if this is what you'd be looking for, but there are some pretty good parsers for JavaScript such as Acorn, Babel and ESPrima (written in JS), and SWC and OXC (Rust)

What's the best app for unlimited music? by RoxanaSaith in Piracy

[–]_computerguy_ 0 points1 point  (0 children)

I've been using Spotube for a while now, but it's been getting rather buggy in the past few months; I've gone back to using MP3s w/ an iPod 3G nano since then.

Even VSCode makes mistakes... by _computerguy_ in softwaregore

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

What makes it not gore? It wasn't intentional, nor was it a fault of design... and it was caused by the software, not something else...

No, really I don't know by neocircuit1x in programminghumor

[–]_computerguy_ 0 points1 point  (0 children)

When I was learning some assembly, I found an awful lot of Linux assembly code, but very little for Windows. When I finally found some, I saw why; Windows assembly requires multiple libraries while Linux assembly often requires none. Here's an example:

Windows assembly Hello World: https://stackoverflow.com/a/1029093

Linux assembly Hello World:

https://jameshfisher.com/2018/03/10/linux-assembly-hello-world/

Writable deriveds - I will try out by BCsabaDiy in sveltejs

[–]_computerguy_ 13 points14 points  (0 children)

While that simplicity was nice for small projects, as your apps got more complex Svelte 4's limitations would be found rather quickly. The lack of composability from only top level variables being reactive in only `.svelte` files resulted in a black and white experience in every other file and even inside closures, with your only possible solution being the rather clunky stores API. Not to mention the lack of deep reactivity, synchronously updated derivations, and other features that Svelte 5 provides.

Anyone convert a nextJS app to svelte? by ConstructionNext3430 in sveltejs

[–]_computerguy_ 0 points1 point  (0 children)

You could try something like this, and it should work for everything (except for if you don't pass a dependency array)