logoalt Hacker News

win311fwg • today at 2:56 PM • 2 replies • view on HN

> Only if they have the context of every part of the code though.

Why?

> You can compile and test code as a part of CICD, and having something doing a static type check is a good quality gate.

Nothing about separating concerns precludes that, of course. Most serious validation languages already avoid the intertwinement. It's not exactly a new concept. The trouble is that humans often find it hard to keep track of both at the same time, so we trick them into thinking it is one language to get around that (typically at the cost of lesser validation). But LLMs do not have the same trouble.


Replies

onion2k • today at 4:46 PM

Why?

A type hint says "only accept things that look like this" and a compiling or a type checker can statically analyse the code to make sure that's valid everywhere. If you don't have that then the LLM would need to track back through the call tree to the originating point that defines the shape of the thing being passed to understand if it's valid all the way through the app in order to know that the data is correct. As it can't know where the originating call starts, it needs context of everything. It might only read the code it needs to read, and that can be done easily with an agent driving a small model, but it still needs complete access to every part of the app in order to trace what it needs to. With type hints it can just run the type checker to validate the code is OK and then trust the type hints.

➕ show 1 reply
AnimalMuppet • today at 5:09 PM

LLMs have a limited context window. They also have trouble keeping track of what's going on "elsewhere", at least if there's enough of it.