frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

iFixit iPhone Air teardown

https://www.ifixit.com/News/113171/iphone-air-teardown
39•zdw•2h ago•15 comments

$2 WeAct Display FS adds a 0.96-inch USB information display to your computer

https://www.cnx-software.com/2025/09/18/2-weact-display-fs-adds-a-0-96-inch-usb-information-displ...
228•smartmic•8h ago•107 comments

Ultrasonic Chef's Knife

https://seattleultrasonics.com/
498•hemloc_io•13h ago•400 comments

The bloat of edge-case first libraries

https://43081j.com/2025/09/bloat-of-edge-case-libraries
28•PaulHoule•3h ago•27 comments

Hyperion: Minecraft game engine for custom events

https://hyperion.rs/
54•cjcuddy•4d ago•12 comments

Slavery After Abolition: Revolt on the Amelia

https://www.historytoday.com/archive/feature/slavery-after-abolition-revolt-amelia
9•samclemens•3d ago•0 comments

Teen suspect surrenders in 2023 Las Vegas casino cyberattack case

https://www.casino.org/news/teen-suspect-surrenders-in-2023-las-vegas-strip-cyberattack-case/
47•campuscodi•6h ago•21 comments

Designing NotebookLM

https://jasonspielman.com/notebooklm
197•vinhnx•12h ago•67 comments

In defence of swap: common misconceptions (2018)

https://chrisdown.name/2018/01/02/in-defence-of-swap.html
34•jitl•5h ago•14 comments

I’m Not a Robot

https://neal.fun/not-a-robot/
379•meetpateltech•4d ago•198 comments

Were RNNs all we needed? A GPU programming perspective

https://dhruvmsheth.github.io/projects/gpu_pogramming_curnn/
47•omegablues•2d ago•11 comments

Knitted Anatomy

https://www.knitted-anatomy.at/cardiovascular-system/
77•blikstiender•3d ago•5 comments

A brief history of threads and threading

https://eclecticlight.co/2025/09/20/a-brief-history-of-threads-and-threading/
61•emschwartz•8h ago•12 comments

Teardown of Apple 40W dynamic power adapter with 60W max

https://www.chargerlab.com/teardown-of-apple-40w-dynamic-power-adapter-with-60w-max-a3365/
122•givinguflac•2d ago•89 comments

Amazon to end commingling after years of complaints from brands and sellers

https://www.modernretail.co/operations/amazon-to-end-commingling-program-after-years-of-complaint...
178•blindriver•3h ago•62 comments

Scream cipher

https://sethmlarson.dev/scream-cipher
257•alexmolas•2d ago•94 comments

A revolution in English bell ringing

https://harpers.org/archive/2025/10/a-change-of-tune-veronique-greenwood-bell-ringing/
60•ascertain•9h ago•26 comments

Ask HN: Radar and radio failures at Dallas area airports

19•pdonner•3h ago•9 comments

FLX1s phone is launched

https://furilabs.com/flx1s-is-launched/
207•slau•18h ago•146 comments

AI Was Supposed to Help Juniors Shine. Why Does It Mostly Make Seniors Stronger?

https://elma.dev/notes/ai-makes-seniors-stronger/
14•elmsec•4h ago•14 comments

Learning Languages with the Help of Algorithms

https://www.johndcook.com/blog/2025/09/17/learning-languages-with-the-help-of-algorithms/
9•ibobev•3d ago•1 comments

Escapee pregnancy test frogs colonised Wales for 50 years (2019)

https://www.bbc.com/news/uk-wales-44886585
111•Luc•4d ago•47 comments

Solving a wooden puzzle using Haskell

https://glocq.github.io/en/blog/20250428/
57•Bogdanp•4d ago•18 comments

After Babel Fish: The promise of cheap translations at the speed of the Web

https://hedgehogreview.com/issues/lessons-of-babel/articles/after-babel-fish
50•miqkt•2d ago•10 comments

MapSCII – World map in terminal

https://github.com/rastapasta/mapscii
155•_august•2d ago•19 comments

Vapor chamber tech keeps iPhone 17 Pro cool

https://spectrum.ieee.org/iphone-17-pro-vapor-chamber
104•rbanffy•15h ago•228 comments

Images over DNS

https://dgl.cx/2025/09/images-over-dns
168•dgl•17h ago•45 comments

Bazel and Glibc Versions

https://blogsystem5.substack.com/p/glibc-versions-bazel
17•goranmoomin•7h ago•27 comments

PYREX vs. pyrex: What's the difference?

https://www.corning.com/worldwide/en/products/life-sciences/resources/stories/in-the-field/pyrex-...
130•lisper•22h ago•101 comments

Why do some gamers invert their controls?

https://www.theguardian.com/games/2025/sep/18/why-do-some-gamers-invert-their-controls-scientists...
77•zdw•7h ago•120 comments
Open in hackernews

The bloat of edge-case first libraries

https://43081j.com/2025/09/bloat-of-edge-case-libraries
28•PaulHoule•3h ago

Comments

01HNNWZ0MV43FF•2h ago
3 of those 4 examples wouldn't exist in a statically-typed language like TypeScript
ants_everywhere•2h ago
Yes this is just ad hoc runtime type checking
mewpmewp2•1h ago
Alternative -> could just use something like Zod or have native stdlib Zod like type of thing to improve a lot on this type of edge case handling. Although if performance is key, then might question how much this constant parsing and validation would add on top, but in 99% cases probably wouldn't matter.
b_e_n_t_o_n•2h ago
JavaScript had to implement these checks because you could pass a function literally anything and it was on the implementation to deal with it. Typescript has this same problem tbh.
Spivak•1h ago
I mean they clearly don't have to, Python has the same problem of being able to pass anything—you don't see this kind of incredibly defensive programming. But Python set a culture of being for "consenting adults" where it's expected that callers will read the docs and ensure preconditions are satisfied, and if they don't whatever happens, happens.

It leads to less code, and more generalizable code. Maybe the caller does know what they're doing, who am I to say they can't.

pcwelder•38m ago
>if they don't whatever happens, happens

What happens is you get an error. So you immediately know something is wrong.

Javascript goes the extra mile to avoid throwing errors.

So you've 3>"2" succeeding in Javascript but it's an exception in python. This behavior leads to hard to catch bugs in the former.

Standard operators and methods have runtime type checks in python and that's what examples in the article are replicating.

umanwizard•50m ago
> Typescript has this same problem

Don’t most languages have the same problem? Even C or Rust have escape hatches that let you override compile-time type checking and pass whatever gibberish you want to a function. How is Typescript any worse?

b_e_n_t_o_n•44m ago
node main.js just runs the code. you could simply not run tsc, which plenty of people do. can you ignore all type errors in Rust?
nevir•32m ago
The Rust equivalent is more like using `unsafe` and derefing raw pointers
b_e_n_t_o_n•29m ago
Yeah and you can explicitly assert a null is a string in TS, but it's explicit. You can't build a Rust program without those asserts but it's trivial to skip the type checking for TS which is more of a linter than a type system.
chamomeal•19m ago
I disagree that TS is more of a linter. But I definitely feel sympathetic to that perspective.

I’ll pull off the cleanest, nicest generic constraints on some component that infers everything perfectly and doesn’t allow invalid inputs, just for a coworker to throw @ts-nocheck on the entire file. It hurts

0x20cowboy•2h ago
I agree with the spirit of this, but I’d go one more step with the example:

export function clamp(value: number, min: number, max: number): number { return }

That is just adding an extra jump and entry on the callstack where you could just have done:

Math.min(Math.max(value, min), max);

Where you need it.

(The example used was probably just for illustration though)

chii•1h ago
> you could just have done ...

i disagree with this particular example - it's actually a good use case for being a utility maths function in a library.

I mean, the very `min()` and `max()` function you used in the illustration could also have been used as an example, if you use the same logic!

mewpmewp2•1h ago
I'm not native English, but I've done coding for way more than 10+ years, yet I would be able to understand and read quicker Math.min(Math.max(value, min), max) compared to registering in my brain what exactly "clamp" does.

In terms of DRY and cleanliness, yes "clamp" sounds awesome. But in terms of practicality and quick understanding? Math.min and Math.max there is such a frequent pattern that brain immediately understands what is being tried to do there, as opposed to exact meaning of "clamp" to me.

It may be just me though, clamp is not a word I frequently hear in English, and I see it in code sometimes, but not frequently enough to consciously register what it does as fast in my brain. Despite seeing code for probably 8h+ a day for the past 10 years.

If it was in std lib of JS, maybe then it would be better.

Like there is some sort of balance line on how frequently something is used and whether it's REALLY worth to abstract it. If it's in stdlib, use it, if it's not use it if truly it's pretty much always used.

xmprt•1h ago
Maybe it's different since you're not native English but clamp is as intuitive for me as something like ceil or floor methods. It might not be as simple for someone who is ESL, probably because no major programming languages that I know of include clamp in their standard library like they do with min, max, ceil, floor.

I'm also coming from being a Go programmer where the native library is very barebones so a lot of custom utility methods like this are inevitable.

aero_code•48m ago
FYI, some major programming languages have clamp:

C++: https://en.cppreference.com/w/cpp/algorithm/clamp.html

.NET/C#: https://learn.microsoft.com/en-us/dotnet/api/system.math.cla...

Java: https://docs.oracle.com/en/java/javase/24/docs/api/java.base...

Ruby: https://ruby-doc.org/core-2.4.0/Comparable.html#method-i-cla...

Rust: https://doc.rust-lang.org/stable/std/primitive.f64.html#meth...

webstrand•3m ago
Even CSS has clamp. I have to periodically remind myself that Math.clamp is missing from the stdlib, it's much easier to read when you need to use a bunch. Math.min(lower, Math.max(value, upper)) is fine for a one-off, but when you need multiple instances of clamp in the same expression the extra parentheses become troublesome.
pigbearpig•1h ago
The author does acknowledge that in the "How it Should Be" section.
BobbyTables2•1h ago
How are the download rates of these things so high?

Are there 1000 people running 100 CI pipelines/day where downloads aren’t cached?

GenerocUsername•1h ago
Yes
kingstnap•1h ago
Yep. True webscale is astronomical levels of inefficient and wasteful usage of bandwidth and CPU.
khaledh•1h ago
This is why every language needs a good standard library, which unfortunately JavaScript never had.
franciscop•43m ago
I've tried to optimize to avoid these before. The problem is that these libraries are normally not used directly, they are usually pretty low in the dependency tree (root?). The farther you go down in the dependency tree, the older the packages are, where rightfully there's some reluctance to update things for the sake of updating things, risking breaking a stable library. It's a tricky thing and not so easy as to just say "don't use npm's `is-array`, use `Array.isArray()` instead", since every JS/TS package author writing code in 2025 knows that already.

It'd be a lot more productive to ask the authors of the (normally bigger, user-facing) libraries that you use nowadays to avoid using these libraries with deep and outdated dependencies. e.g. I stopped using Storybook because of this, but I'm happy to see that they've been working on cleaning up their dependency tree and nowadays it's much better:

https://storybook.js.org/blog/storybook-bloat-fixed/

tobr•29m ago
I would be a little upset if a clamp function could throw a validation error when I passed only numbers. I’ve always written clamp to work even if min is larger than max. Basically, clamp comes down to sorting the three numbers and returning the middle one. I’ve never thought of that as an edge case, it just seems like a more general way to think of the operation that gives you less surprises since every possible input has a well-defined output.
pash•22m ago
> We should be able to define our functions to accept the inputs they are designed for, and not try to handle every possible edge case.

Oh, look, somebody just re-discovered static typing.

eduction•22m ago
Incredibly shallow post. The level of validation and defensiveness in any piece of code will generally have to do with how close to the edge of your application it is — that is, how close to the input.

Functions near the core can assume more and code less defensively than those near the edge.

Libraries shouldnt be edge case first? What? /What kind/ of libraries? You really can’t imagine a library where it makes sense to code very defensively?

Also the post doesn’t even use “edge case” correctly. Definitionally you can’t have an edge case before you’ve defined the acceptable input. In their clamp function the edge case would be something like a large number on the border of graduating from long to BigInt or something. Edge case does not mean invalid input. Edge case is a rare/extreme input that is valid.

MathMonkeyMan•11m ago
This is what undefined behavior is for. You specify a contract for your function, and then the implementation of the function assumes that the contract is satisfied. It does not check, and does not try to diagnose errors.

It's not about performance, it's about separating concerns: the caller handles the not-a-number case, so the callee doesn't have to.

Then you add optional runtime checking of the contract, preferably in a different build mode (or a different version, e.g. "my-lib1.2-debug"), to get sensible diagnostics quickly in tests and canary deployments. The checks are redundant by definition. Defensive programming.