GoSuda

Comparing Language Design in LLM Code Generation Environments: Abstraction Costs and Go's Explicitness

By Rabbit Princess views ...

Modern Languages

Modern languages refer to languages that provide higher productivity, stability, security, and maintainability compared to earlier languages. These languages actively adopt the latest techniques and concepts, and they offer developers more efficient and safer development tools. Representative modern languages include Java, Rust, Python, and TypeScript, and they have the following characteristics.

1. Object-Oriented Design ( OOP )

Modern languages are mostly designed on the basis of object-oriented concepts. Object-orientation supports principles such as encapsulation, inheritance, and polymorphism, and by dividing a complex system into objects of small units and managing them, it makes the structure of a program clear and flexible. This is particularly effective in large-scale software development for controlling development costs and effort and reducing problems that may arise during maintenance.

2. Syntactic Sugar and Expression-Based Syntax

Modern languages provide various syntactic sugar and expression-based syntax to enhance code readability and development productivity. Features such as the ternary operator, lambda expressions, and pattern matching reduce boilerplate code, make code predictable, and improve developer productivity.

3. Module System

Modern languages allow programs to be separated into multiple units and managed through a module system. This facilitates code reuse and dependency management, and makes maintenance manageable even as project scale grows. Representative examples include Maven/Gradle for Java, Cargo for Rust, and npm/yarn for TypeScript.

4. Intermediate Languages and Virtual Machines

Modern languages introduce intermediate languages and virtual machines to achieve platform independence, performance optimization, and security. Representative examples include the JVM, LLVM, WASM, and GraalVM.

Development in the AI Era and the Limitations of Modern Languages

Modern languages emerged on the premise that humans write most of the code. Naturally, the purpose of modern languages is to reduce repetitive work, increase productivity, and effectively implement large-scale software through structures that allow developers to collaborate. However, in the AI era, this premise is gradually collapsing. AI-based tools such as Copilot and Cody are automating much of code writing, and the amount of code that a single developer can produce is increasing dramatically. As a result, features of modern languages that were once perceived as advantages are gradually turning into outdated disadvantages.

Object-Oriented Design

AI can analyze quickly and accurately a structure in which all information is explicit within a single function or module. On the other hand, as the context increases, the range to be inferred expands, so the productivity and accuracy of AI decrease. Code written in OOP distributes logic across multiple objects rather than managing it in one place, which consequently requires AI to handle a larger context. Consider the code below.

 1public class AnimalHandler {
 2    public void handle(Animal animal) {
 3        animal.speak();
 4    }
 5}
 6
 7public class Main {
 8    public static void main(String[] args) {
 9        AnimalHandler handler = new AnimalHandler();
10
11        Animal a1 = new Dog();
12        Animal a2 = new Cat();
13        Animal a3 = new Horse();
14
15        handler.handle(a1);
16        handler.handle(a2);
17        handler.handle(a3);
18    }
19}

In the code above, to determine what the speak() method actually does, AI must repeat the following inferences:

  1. Which concrete class is the instance of animal?
  2. Where is the overridden speak() method defined in that class?
  3. Where are the definitions of the Dog and Cat classes, and what are their internal behaviors?
  4. Is there a possibility that the Dog and Cat classes are overridden in other classes?

Such information is not gathered in one file or one function, and it can only be understood by following the relationships between class files and the inheritance structure. Furthermore, elements determined at runtime, such as reflection or dynamic loading, are like black boxes to AI, making analysis practically impossible.

Syntactic Sugar and Expression-Based Syntax

AI prefers explicit behavior over implicit behavior, and rather than taking complex structures, it prefers combining simple structures to produce a single correct answer. In contrast, syntactic sugar allows diverse expressions while its internal behavior is often identical or similar. AI must learn the meaning of these diverse expressions one by one, and it may become difficult to determine which syntax should be recommended in a given situation or what priority should be assigned.

Intermediate Languages and Virtual Machines

AI is mostly trained on source code. In contrast, intermediate languages (bytecode) lose meaning such as variable names during the compilation process, and must be reinterpreted by a virtual machine at execution time. This is a task that is very difficult for AI to understand or transform. For example, transforming TypeScript into Go is possible for AI, but converting V8 engine bytecode into JVM bytecode or machine code is practically close to impossible.

The Truly Modern Language for the AI Era

From the above, we can see that the characteristics of modern languages are, in fact, outdated elements that are not suited to the AI era. Then, which language can become the most suitable modern language for the AI era? This can be gleaned from the elements that past modern languages rejected. The modern language of the AI era should:

  1. Have explicit syntax and a natural flow.
  2. Move beyond excessive OOP structures and have a flat, simple structure.
  3. Rather than unnecessary syntactic sugar or implicit patterns, build multiple features using only a limited set of basic keywords.
  4. Have a simple and predictable build system rather than a complex one.

The language that best meets these criteria is Golang. The Go language is designed so that most practical functionality can be implemented with only a minimal set of core keywords and simple syntactic combinations, and it thoroughly excludes unnecessary abstraction and implicit behavior. This is a structure advantageous not only for developers but also for AI in interpreting and generating code.

As such, Go's characteristics of pursuing a predictable and flat structure, explicit flow, and consistent syntax are better suited to a development environment in which AI actively participates, unlike existing modern languages designed around human developers. The conservative design philosophy of Go, once considered outdated, becomes instead the most advanced choice in the AI era.