Generate code for declarative language instead of programming language

QueensGambit | 18 points

I think this is heading in the right direction. I had a similar idea about a year ago and spent three months thinking about it because creating a new programming language seemed crazy.

In September, I began the development, and about a month ago, I released a new programming language called Plang (short for pseudo language). It embodies what is describe as intent programming. You can find the repository here: https://github.com/plangHQ

It’s remarkable how much less code is required, and there are significant security benefits as well.

ingigauti | 10 days ago

Exactly, generate Haskell. It's declarative and a programming language

habitue | 11 days ago

> So, why do AI companies generate code like this?

The question of why AI is used to generate imperative or functional code instead of declarative code … is “So, why do programmers write code like this?”

It is the same issue, with essentially the same pros and cons.

Declarative is the best approach to code - when it works the best. But today declarative languages tend to be more domain specific, so not the best for a large proportion of code.

And also are not really purely declarative. Serious performance improvements still accrue to tuning the “declarative” code to the details of specific implementation models. I.e. to knowledge of specific databases.

In a way, AI language models have become the most general, if not the most reliable, declarative tools of all time.

Archiving LLM code generation conversations along with related code is helpful. Easy informal way to document intention.

In a few years a lot of source for casual and non-critical code may be natural language defined entities along side traditional source.

Nevermark | 10 days ago

Intent following is flawed when it comes to hard novel schemes or impossible asks because LLMs can't distinguish them and always oblige in ways that seem to satisfy. But if you know it knows what to do then why not just ask for code directly? A declarative language for LLMs feels like a way to polish the turds that come out of legacy LLMs as if LLMs won't ever get better.

We don't really need a declarative language to be in the same position as asking for high-level description, fewer lines means more places to hide hallucinations. We need an hallucination alarm to show where difficult but legitimate requirements are being squirmed out of without reason.

unraveller | 10 days ago

I’m not sure I buy that Excel is a declarative language. Sure it looks different from your traditional imperative language, but still Excel doesn’t have much wiggle room to interpret your instructions.

two_handfuls | 11 days ago

Presumably you would use AI to generate code for the problem you are solving. If you are working on a React project, you would want it to create JavaScript, not Excel formula.

bazoom42 | 10 days ago