frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Async Programming Is Just Inject Time

https://willhbr.net/2026/03/02/async-inject-and-effects/
35•marvinborner•8h ago

Comments

gpderetta•7h ago
> Your CPU doesn’t know or care what functions are [...]

Well, most architectures do not use plain jumps with implicit arguments for function calls, but have explicit call/ret or branch-with-link instructions. Even those that used jumps had branch hints. The reason is that the microarchitecture must know about call/ret pairs to be able to predict the return path as the generic dynamic predictor is just not good enough for such a common path.

Reduced prediction performance compared normal calls is actually a concern for some coroutine and async code.

> in C we don’t have any dynamic lookup inside functions—every dynamic jump comes from an explicit conditional statement

function pointers.

adamnew123456•6h ago
> Well, most architectures do not use plain jumps with implicit arguments for function calls, but have explicit call/ret or branch-with-link instructions.

Anyone who wants to go deeper on this would be well served doing some reading on "return oriented programming" and shadow stacks / control flow integrity. I got turned onto this by a few LWN articles that talk about the subject (https://lwn.net/Articles/940403/ among others).

It turns out that "jump to this pointer" is actually a dangerous construct, and it's not something you get much high-level exposure to since functions as an abstraction are so unleaky.

rdevilla•7h ago
> To start with, you need to remember that functions don’t exist. They’re made up. They’re a social construct.

https://www.felixcloutier.com/x86/call

Sufficiently large distances of abstraction from the concrete, underlying mechanics are indistinguishable from religion and superstitious belief. Expect LLMs to widen this gap in understanding.

We are not far away from the tech priests of the Adeptus Mechanicus.

throwaway27448•6h ago
> Sufficiently large distances of abstraction from the concrete, underlying mechanics are indistinguishable from religion and superstitious belief.

Hell, you can apply this to all culture. Humans are not very rational or observant beings, despite how much some of us insist to the contrary. Basically any abstraction is a) going to be taken at face value, or on an assumption that the world is inherently structural, and b) the assumption is essentially guaranteed to either be inaccurate or tautological.

"Religion" was invented about 500 years ago to distinguish from the secularists, but the distance between them these days is mostly one of chosen ritual and the direction in which arrogance is spewed. After all, the church that persecuted Galileo was hardly any more irrational than the states we entrust nuclear weapons to is today.

hackingonempty•7h ago
> If you want to read more, I’d recommend starting with the Effekt and Koka language tours

Instead of exploring a research language that nobody uses you could try a mature effects system for a semi-popular language. I think Zio is great and runs on the JVM and ScalaJS. https://zio.dev/

tie-in•5h ago
It's also possible to implement a functional effect system in under 30 lines of JavaScript: https://lackofimagination.org/2025/11/managing-side-effects-...
jiehong•4h ago
I heard ocaml had one?
noelwelsh•7h ago
This article would benefit from an introduction that lays out the structure of what is to come. I'm expecting an article on effect systems, but it jumps straight into a chunky section on the implementation of function calls. I'm immediately wondering why this is here, and what is has to do with effect systems.

Also, this is a very operational description: how it works. It's also possible to give a denotational description: what it means. Having both is very useful. I find that people tend to start with the operational and then move to the denotational.

willhbr•6h ago
That's fair feedback, thanks

I focussed on how it works since that's what I set out to understand myself after seeing effects mentioned a few times

jcranmer•5h ago
> Your CPU doesn’t know or care what functions are

This has already been commented on by a couple of people, but yes, your CPU absolutely does care a lot about functions. At the very least, call/ret matching is important for branch prediction, but the big arches nowadays have shadow stacks and CFI checks that require you to use call/rets as regular functions. x86 has a more thoroughly built-in notion of functions, since they have a (since mostly-defunct) infrastructure for doing task switching via regular-ish call instructions.

> The toString method that gets called depends on the type of the receiver object. This isn’t determined at compile time, but instead a lookup that happens at runtime. The compiler effectively generates a switch statement that looks at the result of getClass and then calls the right method. It’s smarter than that for performance I’m sure, but conceptually that’s what it’s doing.

No, it's conceptually doing the exact opposite. Class objects have a vtable pointer, a pointer to a list of functions, and the compiler is reading the vtable and calling the n'th function via function pointer. The difference is quite important: vtables are an inherently open system (anyone can define their own vtable, if they're sufficiently crazy), but switches are inherently closed (the complete set of possible targets has to be known at compile-time). Not that I've written it up anywhere, but I've come to think of the closed nature of switch statements as fundamentally anathema to the ideals of object-oriented programming.

fanf2•4h ago
The vtable vs switch dichotomy was called the “expression problem” by Philip Wadler https://en.wikipedia.org/wiki/Expression_problem
jiehong•4h ago
> having to add IO effects to all functions

Sound like Haskell, and its Monads. I think it does end up being very similar in the end.

Would you compare effects and monads?

yunnpp•3h ago
I came here to ask the same question; did somebody just reinvent monads?

Also note that much of Haskell now uses MonadIO, so you are no longer constrained to IO or having to manually lift IO into your monad, so long as your monad instances MonadIO. This makes code reuse across libraries trivial. I say this because their div() example says that it can only be called from an Exception effect context, which is like old-school IO-everywhere Haskell. It seems to me like they're going to run into the function colour problem.

Eating out of boredom isn't a thing

https://greyenlightenment.com/2026/01/28/eating-out-of-boredom-isnt-really-a-thing/
1•paulpauper•1m ago•0 comments

Claude Used to Hack Mexican Government

https://www.schneier.com/blog/archives/2026/03/claude-used-to-hack-mexican-government.html
1•Jimmc414•2m ago•0 comments

The Evolution of Go (2015) [video]

https://www.youtube.com/watch?v=0ReKdcpNyQg
1•tosh•3m ago•0 comments

3W for In-Browser AI: WebLLM and WASM and WebWorkers

https://blog.mozilla.ai/3w-for-in-browser-ai-webllm-wasm-webworkers/
1•hwclass•3m ago•0 comments

New (early) diabetes cure in China

https://hrnews1.substack.com/p/communist-china-just-cured-diabetes
1•donatello•3m ago•0 comments

Project Oberon Emulator in JavaScript and Java

https://schierlm.github.io/OberonEmulator/
1•tosh•5m ago•0 comments

White House autism briefing linked to Swift shifts in prescribing patterns

https://www.brown.edu/news/2026-03-05/autism-briefing-prescriptions
1•geox•5m ago•0 comments

Show HN: Open-source multi-model code review council (BYOK, free tier)

https://council.stardreamgames.com/
1•TheTrueObelus•5m ago•0 comments

Show HN: Remotely use my guitar tuner

https://realtuner.online/
1•smith-kyle•9m ago•0 comments

The Betting States of America [video]

https://www.youtube.com/watch?v=dVC9zOxJLo8
1•anarbadalov•9m ago•0 comments

Gum: A tool for glamorous shell scripts

https://github.com/charmbracelet/gum
1•thunderbong•9m ago•0 comments

Show HN: Contexa – Git-inspired context management for LLM agents

https://github.com/swadhinbiswas/contexa
1•0x0003r•9m ago•0 comments

Show HN: Mantle – Remap your Mac keyboard without editing Kanata config files

https://getmantle.app/
1•gsteezy•9m ago•0 comments

Apple users in the US can no longer download ByteDance's Chinese apps

https://www.wired.com/story/bytedance-apps-are-no-longer-available-in-us-app-stores/
1•LorenDB•10m ago•0 comments

Five CLIs Walk into a Context Window

https://theredbeard.io/blog/five-clis-walk-into-a-context-window/
1•ac29•10m ago•0 comments

Show HN: Hydra – Real-time ops dashboard for developers running AI agents

https://github.com/kunalnano/hydra
1•marinerk9•13m ago•0 comments

Noemon: ARC-AGI-2 top score at a fraction of the cost

https://twitter.com/noemon_ai/status/2029970169326379380
2•markerbrod•14m ago•1 comments

Browsercord.com – free in-browser screen recorder and editor with share links

https://browserecord.com
2•zygo•14m ago•1 comments

Asteroid defense mission shifted the orbit of more than its target

https://arstechnica.com/science/2026/03/nasas-dart-mission-shifted-the-orbits-of-two-asteroids/
3•LorenDB•14m ago•0 comments

TypeScript 6.0 RC

https://devblogs.microsoft.com/typescript/announcing-typescript-6-0-rc/
4•johnz•15m ago•0 comments

Why it takes you and an elephant the same amount of time to poop

https://www.pbs.org/newshour/health/takes-elephant-amount-time-poop
5•Tomte•17m ago•1 comments

A semantic history: How the term 'vibe coding' went from a tweet to prod

https://www.coderabbit.ai/blog/a-semantic-history-how-the-term-vibe-coding-went-from-a-tweet-to-prod
1•dmkravets•18m ago•0 comments

Fiber-free processed foods hit emotional memory fast, especially in older brains

https://medicalxpress.com/news/2026-02-fiber-free-foods-emotional-memory.html
1•PaulHoule•19m ago•0 comments

Why InterPositive Is Joining Netflix

http://about.netflix.com/en/news/why-interpositive-is-joining-netflix
2•ChrisArchitect•20m ago•0 comments

Agor: Figma but for AI Coding Assistants

https://github.com/preset-io/agor
1•skadamat•21m ago•0 comments

Oracle and OpenAI End Plans to Expand Flagship Data Center

https://www.bloomberg.com/news/articles/2026-03-06/oracle-and-openai-end-plans-to-expand-flagship...
5•kgwgk•22m ago•0 comments

Virtue Metascience – What good is science anyway?

https://www.macroscience.org/p/virtue-metascience
1•Luc•22m ago•0 comments

Knowing What Code to Throw Away

https://matthewsinclair.com/blog/0188-on-knowing-what-code-to-throw-away
2•speckx•24m ago•0 comments

The Millisecond That Could Change Cancer Treatment

https://spectrum.ieee.org/flash-radiotherapy
2•oldnetguy•25m ago•0 comments

Teaching LLMs to reason like Bayesians

https://research.google/blog/teaching-llms-to-reason-like-bayesians/
2•etothet•25m ago•0 comments