frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

DoNotNotify is now Open Source

https://donotnotify.com/opensource.html
38•awaaz•1h ago•5 comments

Show HN: LocalGPT – A local-first AI assistant in Rust with persistent memory

https://github.com/localgpt-app/localgpt
204•yi_wang•7h ago•84 comments

Haskell for all: Beyond agentic coding

https://haskellforall.com/2026/02/beyond-agentic-coding
96•RebelPotato•7h ago•27 comments

Moroccan sardine prices to stabilise via new measures: officials

https://maghrebi.org/2026/01/27/moroccan-sardine-prices-to-stabilise-via-new-measures-officials/
16•mooreds•5d ago•0 comments

Roger Ebert Reviews "The Shawshank Redemption" (1999)

https://www.rogerebert.com/reviews/great-movie-the-shawshank-redemption-1994
22•monero-xmr•3h ago•21 comments

SectorC: A C Compiler in 512 bytes (2023)

https://xorvoid.com/sectorc.html
292•valyala•15h ago•56 comments

LLMs as the new high level language

https://federicopereiro.com/llm-high/
104•swah•4d ago•187 comments

Software factories and the agentic moment

https://factory.strongdm.ai/
227•mellosouls•18h ago•386 comments

Speed up responses with fast mode

https://code.claude.com/docs/en/fast-mode
182•surprisetalk•15h ago•185 comments

The Architecture of Open Source Applications (Volume 1) Berkeley DB

https://aosabook.org/en/v1/bdb.html
23•grep_it•5d ago•3 comments

LineageOS 23.2

https://lineageos.org/Changelog-31/
44•pentagrama•3h ago•9 comments

Hoot: Scheme on WebAssembly

https://www.spritely.institute/hoot/
192•AlexeyBrin•20h ago•36 comments

Stories from 25 Years of Software Development

https://susam.net/twenty-five-years-of-computing.html
195•vinhnx•18h ago•19 comments

Brookhaven Lab's RHIC concludes 25-year run with final collisions

https://www.hpcwire.com/off-the-wire/brookhaven-labs-rhic-concludes-25-year-run-with-final-collis...
79•gnufx•14h ago•62 comments

Vocal Guide – belt sing without killing yourself

https://jesperordrup.github.io/vocal-guide/
357•jesperordrup•1d ago•104 comments

uLauncher

https://github.com/jrpie/launcher
21•dtj1123•4d ago•5 comments

Substack confirms data breach affects users’ email addresses and phone numbers

https://techcrunch.com/2026/02/05/substack-confirms-data-breach-affecting-email-addresses-and-pho...
57•witnessme•4h ago•16 comments

Wood Gas Vehicles: Firewood in the Fuel Tank (2010)

https://solar.lowtechmagazine.com/2010/01/wood-gas-vehicles-firewood-in-the-fuel-tank/
48•Rygian•3d ago•19 comments

First Proof

https://arxiv.org/abs/2602.05192
145•samasblack•17h ago•89 comments

Show HN: I saw this cool navigation reveal, so I made a simple HTML+CSS version

https://github.com/Momciloo/fun-with-clip-path
101•momciloo•15h ago•23 comments

Start all of your commands with a comma (2009)

https://rhodesmill.org/brandon/2009/commands-with-comma/
605•theblazehen•3d ago•218 comments

Al Lowe on model trains, funny deaths and working with Disney

https://spillhistorie.no/2026/02/06/interview-with-sierra-veteran-al-lowe/
113•thelok•17h ago•25 comments

The AI boom is causing shortages everywhere else

https://www.washingtonpost.com/technology/2026/02/07/ai-spending-economy-shortages/
337•1vuio0pswjnm7•21h ago•548 comments

The Scriptovision Super Micro Script video titler is almost a home computer

http://oldvcr.blogspot.com/2026/02/the-scriptovision-super-micro-script.html
11•todsacerdoti•7h ago•1 comments

Show HN: A luma dependent chroma compression algorithm (image compression)

https://www.bitsnbites.eu/a-spatial-domain-variable-block-size-luma-dependent-chroma-compression-...
43•mbitsnbites•3d ago•7 comments

OpenCiv3: Open-source, cross-platform reimagining of Civilization III

https://openciv3.org/
918•klaussilveira•1d ago•278 comments

Where did all the starships go?

https://www.datawrapper.de/blog/science-fiction-decline
173•speckx•4d ago•259 comments

Show HN: Look Ma, No Linux: Shell, App Installer, Vi, Cc on ESP32-S3 / BreezyBox

https://github.com/valdanylchuk/breezydemo
311•isitcontent•1d ago•39 comments

Selection rather than prediction

https://voratiq.com/blog/selection-rather-than-prediction/
40•languid-photic•4d ago•20 comments

FDA intends to take action against non-FDA-approved GLP-1 drugs

https://www.fda.gov/news-events/press-announcements/fda-intends-take-action-against-non-fda-appro...
123•randycupertino•10h ago•251 comments
Open in hackernews

Creating C closures from Lua closures

https://lowkpro.com/blog/creating-c-closures-from-lua-closures.html
60•publicdebates•1mo ago

Comments

widdershins•1mo ago
This doesn't seem like something that should require generating assembly to solve. Couldn't `CALLBACK` just return a table, which contains both the userdata pointer to `REAL_CALLBACK` and a value for `findex`, eliminating the global variable? Then `Add` could extract that. You could even make the table returned by `CALLBACK` callable in Lua with a metatable.

Or, if you're worried about performance/memory, you could allocate a struct for `CALLBACK` to return as userdata, containing the function pointer and `findex`. If you made a little allocator for these it would be extremely fast.

I'm sure I'm missing things, but the solution you chose feels like the nuclear option.

comex•1mo ago
The code is passing the function pointers into Win32 APIs, so the caller side isn’t controlled; the callbacks have to work as native C function pointers.

This was probably posted in response to this other link from two days ago, which is about about JIT-compiling wndproc callbacks in particular; the comments discuss the “proper” way to do it, which is to use GWLP_USERDATA:

https://news.ycombinator.com/item?id=46259334

At least, that’s the proper way to do it if you control the entire application. But for what’s apparently a thin wrapper that exposes Win32 APIs directly to Lua, I can understand picking an approach that makes life easier for the Lua code author, even if it’s hackier under the hood. It also avoids the need to write custom behavior for each API.

publicdebates•1mo ago
It was inspired by that post, but not in response to it. Over the 3 or 4 months that I took writing lowkPRO, one of the features I'm most proud of is this, the ability for it to create C callbacks on the fly that just call Lua callbacks and return the value to C. And I would argue that it's not hacky but just well-engineered. After all, everything compiles to assembly at the end of the day, right?
CodesInChaos•1mo ago
Well designed C APIs have a context/userdata parameter on their callbacks, which is registered and stored alongside the function pointer. Unfortunately WNDPROC lacks this parameter.

GWLP_USERDATA should be the best option, though the API for setting it and setting the WNDPROC being separate looks error prone.

publicdebates•1mo ago
The bigger problem is that I would have to automate this for every callback type in the Windows API, and there's no guarantee that all of them follow the same 2 or 3 patterns for passing the context pointer into the callback. This solution works great, even if it is a bit wasteful of the ctx ptr.
psychoslave•1mo ago
What’s the thing emulating so much activity around closures lately?

https://news.ycombinator.com/item?id=46228597

https://news.ycombinator.com/item?id=46259334

Also talking about the Knuth boy/man test: https://news.ycombinator.com/item?id=46020151

Not a bad thing, but that really question if there is some active micro-

shakna•1mo ago
Why VirtualAlloc?

Lua has its own allocator, which will also collect for you. lua_newuserdata. At the expense of having to set executable yourself, but without all the inbuilt inefficiencies the article points out.

publicdebates•1mo ago
Can you set arbitrary memory allocated by malloc (e.g. HeapAlloc in Windows) to executable, via VirtualProtect or something else? If so, that's news to me. I thought it had to be memory allocated by VirtualAlloc only.

That said, I'm not sure that solution beats out this one. I'm using a linked list on top of an arena allocator in practice, which means allocations happen once every 0x10000 bytes. (A single C closure of mine takes up exactly 16 bytes, which includes the pointer to the next linked list node. I'm very happy with how it's designed.)

shakna•1mo ago
Lua lets you set the allocator, so you don't have to manage the lifetime.

    void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
publicdebates•1mo ago
Two problems with that.

First, it would mean that all Lua objects would be allocated in memory that's potentially executable. That might not necessarily be more of a security issue than the app inherently allows, but at least it's wasteful.

Second, I'm not entirely sure it's a good idea to have C callbacks be collectable, which is why currently they aren't, and you have to free them manually via my winapi.freecallback function. This is part of the inherent issue in the fact that the Windows API has its own concept of lifetimes that are different than Lua's collection visibility. I would like to try to tie them together if possible one day, I'm just not entirely sure how yet.

ufo•1mo ago
I wonder if there would be a way to piggyback on top of GCC's nested function extension. It does something a little bit similar, with the dynamically generated functions.
halayli•1mo ago
I feel libffi is better suited and supports most platforms.
lkuty•1mo ago
Tsoding made a video about it : https://www.youtube.com/watch?v=0o8Ex8mXigU
rurban•1mo ago
The ffcall library even more
halayli•1mo ago
wasn't aware of ffcall, it's definitely a better fit
not_a9•1mo ago
Fun fact: LuaJIT FFI actually has a similar feature. You can do funky things like detour hooking with this functionality too.

https://luajit.org/ext_ffi_semantics.html