frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Replace your boss before they replace you

https://replaceyourboss.ai/
58•_tk_•43m ago•2 comments

Same-day upstream Linux support for Snapdragon 8 Elite Gen 5

https://www.qualcomm.com/developer/blog/2025/10/same-day-snapdragon-8-elite-gen-5-upstream-linux-...
178•mfilion•3h ago•77 comments

The Input Stack on Linux: An End-to-End Architecture Overview

https://venam.net/blog/unix/2025/11/27/input_devices_linux.html
52•venamresm__•2h ago•3 comments

Quake Engine Indicators

https://fabiensanglard.net/quake_indicators/index.html
91•liquid_x•3d ago•12 comments

Abuse of the nullish coalescing operator in JS/TS

https://fredrikmalmo.com/blog/js-ts-nullish-empty-string-coalescing
28•fred_•6d ago•35 comments

Linux Kernel Explorer

https://reverser.dev/linux-kernel-explorer
454•tanelpoder•13h ago•69 comments

Tell HN: Happy Thanksgiving

182•prodigycorp•14h ago•47 comments

The VanDersarl Blériot: a 1911 airplane homebuilt by teenage brothers

https://www.historynet.com/vandersarl-bleriot/
19•ForHackernews•2h ago•9 comments

Penpot: The Open-Source Figma

https://github.com/penpot/penpot
601•selvan•17h ago•140 comments

Show HN: Runprompt – run .prompt files from the command line

https://github.com/chr15m/runprompt
61•chr15m•4h ago•24 comments

Pakistan says rooftop solar output to exceed grid demand in some hubs next year

https://www.reuters.com/sustainability/boards-policy-regulation/pakistan-says-rooftop-solar-outpu...
70•toomuchtodo•2h ago•43 comments

Why Strong Consistency?

https://brooker.co.za/blog/2025/11/18/consistency.html
8•SchwKatze•21h ago•2 comments

Show HN: MkSlides – Markdown to slides with a similar workflow to MkDocs

https://github.com/MartenBE/mkslides
48•MartenBE•6h ago•7 comments

Mixpanel Security Breach

https://mixpanel.com/blog/sms-security-incident/
169•jaredwiener•12h ago•97 comments

The current state of the theory that GPL propagates to AI models

https://shujisado.org/2025/11/27/gpl-propagates-to-ai-models-trained-on-gpl-code/
128•jonymo•6h ago•152 comments

Coq: The World's Best Macro Assembler? (2013) [pdf]

https://nickbenton.name/coqasm.pdf
117•addaon•14h ago•51 comments

Inspired by Spider-Man, scientists recreate web-slinging technology

https://scienceclock.com/inspired-by-spider-man-scientists-recreate-web-slinging-technology/
6•ohjeez•23h ago•0 comments

TPUs vs. GPUs and why Google is positioned to win AI race in the long term

https://www.uncoveralpha.com/p/the-chip-made-for-the-ai-inference
100•vegasbrianc•5h ago•130 comments

DIY NAS: 2026 Edition

https://blog.briancmoses.com/2025/11/diy-nas-2026-edition.html
335•sashk•16h ago•206 comments

Ray Marching Soft Shadows in 2D (2020)

https://www.rykap.com/2020/09/23/distance-fields/
154•memalign•11h ago•26 comments

Show HN: SyncKit – Offline-first sync engine (Rust/WASM and TypeScript)

https://github.com/Dancode-188/synckit
41•danbitengo•4h ago•13 comments

Move Expressions

https://smallcultfollowing.com/babysteps/blog/2025/11/21/move-expressions/
3•ibobev•3d ago•0 comments

Interactive λ-Reduction

https://deltanets.org/
99•jy14898•2d ago•21 comments

Seagate achieves 6.9TB storage capacity per platter

https://www.tomshardware.com/pc-components/hdds/seagate-achieves-a-whopping-6-9tb-storage-capacit...
41•elorant•2h ago•31 comments

Technical Deflation

https://benanderson.work/blog/technical-deflation/
51•0x79de•3d ago•47 comments

Music eases surgery and speeds recovery, study finds

https://www.bbc.com/news/articles/c231dv9zpz3o
163•1659447091•14h ago•78 comments

We're losing our voice to LLMs

https://tonyalicea.dev/blog/were-losing-our-voice-to-llms/
277•TonyAlicea10•4h ago•310 comments

Cherry gives up German production and wants to sell core division

https://www.heise.de/en/news/Cherry-gives-up-German-production-and-wants-to-sell-core-division-11...
11•jsheard•58m ago•0 comments

G0-G3 corners, visualised: learn what "Apple corners" are

https://www.printables.com/model/1490911-g0-g3-corners-visualised-learn-what-apple-corners
112•dgroshev•4d ago•56 comments

Memories of .us

https://computer.rip/2025-11-11-dot-us.html
4•sabas_ge•1d ago•0 comments
Open in hackernews

Abuse of the nullish coalescing operator in JS/TS

https://fredrikmalmo.com/blog/js-ts-nullish-empty-string-coalescing
28•fred_•6d ago

Comments

renewiltord•1h ago
In general, I agree. You don’t want silent failures. They’re awful and hard to reason about.

> By doing this, you're opening up for the possibility of showing a UI where the name is "". Is that really a valid state for the UI?

But as a user, if I get a white screen of death instead of your program saying “Hi, , you have 3 videos on your watchlist” I am going to flip out.

Programmers know this so they do that so that something irrelevant like my name doesn’t prevent me from actually streaming my movies.

polishdude20•39m ago
Exactly, something like a name missing shouldn't cause the app to completely error out for the user.
slooonz•33m ago
Yes it should, because hopefully errors are logged and reported and can be acted upon. Missing name doesn’t.
noman-land•31m ago
Why not both?
rustc•25m ago
That's how you get this feature: https://wiki.php.net/rfc/deprecate-bareword-strings.

tldr: undefined constants were treated as a string (+ a warning), so `$x = FOO` was `$x = "FOO"` + a warning if `FOO` was not a defined constant. Thankfully this feature was removed in PHP 8.

pitched•27m ago
If the error isn’t repairable by the user, blocking them from using the app entirely is mean. If the error screen has a message telling the user where to go to set their name, that’s fine but annoying. If the error screen tells the user they can’t use the app until someone checks a dashboard and sees a large enough increase in errors to investigate, that’s a bigger problem.
jackblemming•25m ago
This reads like a dogmatic view of someone who hasn’t worked on a project that’s a million plus lines of code where something is always going wrong, and crashing the entire program when that’s the case is simply unacceptable.
noman-land•32m ago
This is a fine line. If you get a white screen of death you know something is wrong. If the first name is missing it may mean other things are missing and the app is in a bad state. That means the user could lose any work they try to do, which is a cardinal sin for an app to commit.

Context matters a lot. If it's Spotify and my music won't play is a lot different than I filled a form to send my rent check and it silently failed.

hahn-kev•20m ago
Totally agree, I think this is a good place for debug asserts which only throw during development, but fallback in prod builds.
pverheggen•10m ago
Well, what would be better is “Hi, you have…”, and that would require a conditional, not coalescing.
superjose•1h ago
I can see this.

I learned from a friend to use Zod to check for process.env. I refined it a bit and got:

```

const EnvSchema = z.object({

  NODE_ENV: z.enum(['development', 'production', 'staging']),

  DATABASE_URL: z.string(),

  POSTHOG_KEY: z.string(),
});

export type AlertDownEnv = z.infer<typeof EnvSchema>;

export function getEnvironments(env: Record<string, string>): AlertDownEnv { return EnvSchema.parse(env); }

```

Then you can:

```

const env = getEnvironments(process.env);

```

`env` will be fully typed!

Definitely, I need to do some improvements in my frontend logic!

ryanpetrich•1h ago
Should throw expressions (https://github.com/tc39/proposal-throw-expressions) ever make it into the JavaScript standard, the example could be simplified to:

  const env_var = process.env.MY_ENV_VAR ?? throw new Error("MY_ENV_VAR is not set");
h1fra•40m ago
so like assert(process.env.MY_ENV_VAR) but in a less readable oneliner?
ameliaquining•35m ago
There isn't a built-in assert function that behaves that way; you would need to either write it or import it.
t-writescode•29m ago
Since JS doesn’t have if statements return values, null chaining is a great way to keep both const variables and have some level of decidability.

Null chaining is also a common pattern across most languages and is generally seen as readable

MobiusHorizons•5m ago
I get why we prefer final in languages with a need for thread safety, but I have never understood why people prefer const in typescript. I have seen people bend over backwards to avoid a `let` even if it results in higher complexity code. It just doesn’t seem to solve a problem I’ve ever actually encountered in typescript code.
jackblemming•29m ago
That doesn’t assign it to the shorthand local variable.
GMoromisato•41m ago
Is this a weakness in the type definition? If we're sure the value cannot be undefined, then why doesn't the type reflect that? Why not cast to a non-undefined type as soon as we're sure (and throw if it is not)? At least that would document our belief in the value state.

I may not understand.

ameliaquining•32m ago
If your type definitions are airtight then this problem doesn't come up, but sometimes, for whatever reason which may not be entirely within your control, they aren't. Narrowing and failing early is precisely what the article advises doing.
raincole•12m ago
JavaScript isn't even statically typed.

> Why not cast to a non-undefined type as soon as we're sure (and throw if it is not)

This is exactly what the OP author suggests.

SkiFire13•28m ago
> Personally, I've come to see this ubiquitous string of symbols, ?? "", as the JS equivalent to .unwrap() in Rust

It's funny you bring this up because people opposed to `.unwrap()` usually mention methods like `.unwrap_or` as a "better" alternative, and that's exactly the equivalent of `??` in Rust.

ameliaquining•24m ago
Semantically the two are kind of opposite; the similarity is that they're the lowest-syntax way in their respective languages to ignore the possibility of a missing value, and so get overused in situations where that possibility should not be ignored, leading to bugs.
cypressious•21m ago
It seems Rust's unwrap is the exact opposite of ?? "". It throws an error instead of using a fallback value, which is exactly what the author suggests instead of using ?? "".
robertlagrant•8m ago
From the article:

> In Rust, however, you're forced to reason about the "seriousness" of calling .unwrap() as it could terminate your program. In TS you're not faced with the same consequences.

paulddraper•5m ago
Yes that was a mistake.

unwrap() is the error.

unwrap_or() is the fallback.

d--b•21m ago
It’s a feature of the language that’s totally fine to use as much as needed. it’s not a quick n dirty fix.

Don’t listen to those opinionated purists that don’t like certain styles for some reason (probably because they didn’t have that operator when growing up and think it’s a hack)

vadansky•19m ago
He lost me at the first example:

```ts user?.name ?? "" ```

The issue isn't the nullish coalescing, but trying to treat a `string | null` as a string and just giving it a non-sense value you hope you'll never use.

You could have the same issue with `if` or `user?.name!`.

Basically seems the issue is the `""`. Maybe it can be `null` and it should be `NA`, or maybe it shouldn't be `null` and should have been handled upstream.

yieldcrv•18m ago
This post and everyone defending this is absolutely crazy

Is this a kink? You like being on call?

You think your performance review is going to be better because you fixed a fire over a holiday weekend or will it be worse when the post mortem said it crashed because you didn’t handle the event bus failing to return firstName

btdmaster•18m ago
See also "Parse, don't validate (2019)" [0]

[0] https://news.ycombinator.com/item?id=41031585

britch•16m ago
Early errors are good, but I think the author overstates the importance of filtering out empty strings

---

I disagree that erroring out when the app doesn't have ALL the data is the best course of action. I imagine it depends a bit on the domain, but for most apps I've worked on it's better to show someone partial or empty data than an error.

Often the decision of what to do when the data is missing is best left up the the display component. "Don't show this div if string is empty", or show placeholder value.

---

Flip side, when writing an under the hood function, it often doesn't matter if the data is empty or not.

If I'm aggregating a list of fooBars, do I care if fooBarDisplayName is empty or not? When I'm writing tests and building test-data, needing to add a value for each string field is cumbersome.

Sometimes a field really really matters and should throw (an empty string ID is bad), but those are the exception and not the rule.

robertlagrant•9m ago
I keep wondering about a type system where you can say something like "A number greater than 4" or "A string of length greater than 0" or "A number greater than the value of $othernum". If you could do that, you could push so much of this "coping" logic to only the very edge of your application that validates inputs, and then proceed with lovely typesafe values.
raincole•6m ago
https://en.wikipedia.org/wiki/Refinement_type
robertlagrant•4m ago
Thank you - I didn't know it had a name. But I'm not surprised it came from ML.
davidmurdoch•3m ago
Your can do that now in Typescript. But it will take several minutes to resolve your types. I've done it and it's a horrible dev experience, sadly.