Live data from Hacker News

Node.js 26.0.0 (Now with Temporal)

nodejs.org

51–60 of 63 posts

Re: Node.js 26.0.0 (Now with Temporal)

#51

Earlier quoted context omitted.

Why more secure? I see that Deno has WebSockets, but I've never used them: https://docs.deno.com/api/web/~/WebSocket

"ws" is regularly the only package in my package.json

Same. Without that I could remove all npm dependence, which would greatly improve security.

Re: Node.js 26.0.0 (Now with Temporal)

#52

Tangent: if you use Node.js at build time you should check out VitePlus https://viteplus.dev (No affiliation, just a fan of VoidZero's consistently excellent tools.)

Kind of difficult to install, especially in the enterprise business environment. At least they kept it free for everyone.

Re: Node.js 26.0.0 (Now with Temporal)

#53

Earlier quoted context omitted.

https://nodejs.org/en/blog/release/v26.1.0 is particularly cool as it added initial FFI support.

This API is inherently unsafe. Invalid pointers, incorrect signatures, or accessing memory after it has been freed can crash the process or corrupt memory. Absolutely great idea to expose such "features" to the web dev world! All the JS devs that are already struggling with mildly complicated language features will love the giant new field of bugs they only dreamed of. The arrival of the first very hyped tool that wi…

Criticism noted! But it is experimental, unconstrained FFI is inherently unsafe, and not all JavaScript developers are "mildly educated web devs".

I doubt we'll see this go into mainstream dependencies likely to be used by such developers – it hasn't in Ruby which has had easily accessible FFI mechanisms for years.

Though, there is already a fun experiment using it: https://blog.platformatic.dev/destino-doom-terminal-nodejs-f...

Re: Node.js 26.0.0 (Now with Temporal)

#54

Earlier quoted context omitted.

"ws" is regularly the only package in my package.json

Same. Without that I could remove all npm dependence, which would greatly improve security.

If you're not tied to the ecosystem, why not switch to Deno?

Re: Node.js 26.0.0 (Now with Temporal)

#55
post #23

Earlier quoted context omitted.

Initially it didn't make sense to me... but it looks like type striping is really the way to go for future TS. There's the "types as comments" proposal[1] which could even land on browsers one day. I started using the erasableSyntaxOnly setting in my tsconfig to get ready for this. [1] https://tc39.es/proposal-type-annotations/

At this point we should really prompt all the AI power in the world we have to create a TS replacement. It seems grotesque.

Something that uses WASM probably has more chances to succeed given the massive effort/investment in the past decade to shift from JS to TS.

Re: Node.js 26.0.0 (Now with Temporal)

#56
post #22

Off-topic but, Safari seems to be the only browser that doesn't support Temporal yet. It looks like the only blocker for adopting it on web. https://caniuse.com/?search=Temporal

Should be easy enough to detect/polyfill...

    if (!globalThis.Temporal) {
      // await import('temporal-polyfill/global');
      await import('https://cdn.jsdelivr.net/npm/temporal-polyfill@0.3.0/global.min.js'); 
    }

Re: Node.js 26.0.0 (Now with Temporal)

#57
post #41

> Upsert ( https://github.com/tc39/proposal-upsert ): [Weak]Map.prototype.getOrInsert(), [Weak]Map.prototype.getOrInsertComputed() Their usage of upsert appears different than I was used to: Me: Upsert = Update or Insert Them: Upsert = Get or Insert

what is the value of an "update or insert" call on `Map`? is that not just set? `getOrInsert` here seems to be the Python "set_default" method on dicts, which is very useful at avoiding tedium in some basic data munging

I do this all the time, getOrInsert would come really handy: you need something from a Map-backed storage, but the value may be unset, so you first check if it's undefined, set the default value, and then use that.

Example:

    update(store, (draft) => {
      if (!draft.alertConfigurations.has(req.params.clusterId))
        draft.alertConfigurations.set(req.params.clusterId, new Map());
      const clusterAlerts = draft.alertConfigurations.get(req.params.clusterId);
      req.body.forEach((alert) => clusterAlerts.set(alert.id, { ...alert, predefined: false }));
    });

Re: Node.js 26.0.0 (Now with Temporal)

#59
post #52

Tangent: if you use Node.js at build time you should check out VitePlus https://viteplus.dev (No affiliation, just a fan of VoidZero's consistently excellent tools.)

Kind of difficult to install, especially in the enterprise business environment. At least they kept it free for everyone.

Difficult how?

Re: Node.js 26.0.0 (Now with Temporal)

#60
post #52

Earlier quoted context omitted.

Kind of difficult to install, especially in the enterprise business environment. At least they kept it free for everyone.

Difficult how?

In corporate environment you cannot just simply download and run scripts from the internet. npm/npx create/install is allowed though.
Post reply on HN