HN user

herrington_d

80 karma
Posts7
Comments56
View on HN

There are researches backing some sort of "typed language is better for LLM". Like https://arxiv.org/abs/2504.09246, Type-Constrained Code Generation with Language Models, where LLM's output is constrainted by type checkers.

Also https://arxiv.org/abs/2406.03283, Enhancing Repository-Level Code Generation with Integrated Contextual Information, uses staic analyzers to produce prompts with more context info.

Yet, the argument does directly translate to the conclusion that typed language is rigorously better for LLM without external tools. However, typed language and its static analysis information do seem to help LLM.

The logic above can support exactly the opposite conclusion: LLM can do dynamic typed language better since it does not need to solve type errors and save several context tokens.

Practically, it was reported that LLM-backed coding agents just worked around type errors by using `any` in a gradually typed language like TypeScript. I also personally observed such usage multiple times.

I also tried using LLM agents with stronger languages like Rust. When complex type errors occured, the agents struggled to fix them and eventually just used `todo!()`

The experience above can be caused by insufficient training data. But it illustrates the importance of eval instead of ideological speculation.

AST-Grep [video] 1 year ago

Hi, ast-grep author here. thanks for sharing the video!

production quality is amazing! I also did some youtube video recently. It is not easy and end product is far from polished.

Really appreciate your help introducing the tool to more people, thanks!

One thing AE provides but not coroutines is type safety. More concretely AE can specify what a function can do and cannot do lexically in code. A generator/coroutine cannot.

For example, a function annotated with say `query_db(): User can Datebase` means the function can call database and the caller must provide a `Database` handler to call the `query_db`.

The constraint of what can do and not is pretty popular in other programming fields, most notably, NextJS. A server component CANNOT use client feature and a client component CANNOt access server db.

Better type information. Because the program is always in a valid state the type checker can always run and give meaningful feedback.

Note that programs can be syntactically well-formed but ill-typed. For example `let x = true + 1` has valid syntax but produces an "undefined" type for the variable `x`, if the type system does not support type error recovery.

A quote from the great paper from POPL 2024, https://hazel.org/papers/marking-popl24.pdf

If a type error appears _anywhere_, the program is formally meaningless _everywhere_

Since Skip is maintaining a reactive cache. How is the cached stored? I would speculate it would a distributed in-memory database so the computation service can scale. But I wonder how the system can recover and rebuild the cache if the cache is down.

The feature dates way back to perhaps 2006, per Jetbrains' PDF archive[1]. Jb also updated their structural search UI/UX in 2018[2]. It is possible that users do not buy in the idea of SSR. Alternatively, it may be caused by the fact that Jb SSR's mixed language support. [3][4][5]

[1] https://www.jetbrains.com/idea/docs/ssr.pdf [2] https://www.youtube.com/watch?v=YeGPO-UHTbs [3] https://www.jetbrains.com/help/idea/structural-search-and-re... [4] https://www.jetbrains.com/help/go/structural-search-and-repl... [5] https://www.jetbrains.com/help/pycharm/structural-search-and...

[dead] 2 years ago

This blog post delves into the design space of code search, with a particular focus on how queries are designed and used.

[dead] 2 years ago

We're thrilled to introduce typed AST in @ast-grep/napi, addressing a long-requested feature for AST manipulation from the early days of this project.

In this blog post, we will delve into the challenges addressed by this feature and explore the design that shaped its implementation. We also believe this post can serve as a general guide to crafting balanced TypeScript types.

Thank you for sharing this! While AI excels at providing general advice, it often falls short on delivering contextual insights specific to your code. I’m thrilled to see that ast-grep can be effectively used alongside AI to add more value for developers. Great job!

[dead] 2 years ago

New guide for ast-grep rewriters! A powerful construct to perform complex code transformation!

[dead] 2 years ago

A comprehensive guide explains why using code to search code can be more subtle than it looks.

[dead] 2 years ago

ast-grep is a structural code search tool that leverages syntax trees to find patterns in source code. But it was hard to extract a sub-language embedded inside a document.

ast-grep now supports a feature to handle language injection, allowing you to search for code written in one lanuage within documents of another language.

Glad to see Google employee still has 20% of their time to do side projects! Python UI is especially interesting for ML/LLM folks who can build demos without changing tech stack.

I appreciate OP's ideas about how this project is compared to Streamlit?

Authoring in DSL can improve efficiency and productivity, but in my experience DSL itself brings benefits to a limited extent. It can be easier to read and write, but these benefits require one to understand the business model behind the DSL, which is usually more time-consuming.

Having a strong validation and observation toolset based on the DSL brings more value than the language itself. DSL constrains its semantics so it is easier to build tools on it.