Huawei opened the Cangjie programming language: how it surprised developers

Programming

Huawei continues to develop its own programming language Cangjie, which has been increasingly discussed in the professional community in recent months, writes xrust. The reason for a new wave of interest was a publication on the InfoQ portal, where the developers examined in detail the unusual features of the language — built-in effect processors and algebraic data types.

Despite the complex terms, experts believe that we are talking about a technology that in the future can significantly simplify the creation of programs and mobile applications. This is especially true for large projects, where developers have to manage a large number of errors, asynchronous operations and parallel processes.

Cangjie was introduced by Huawei as a modern general-purpose compiled language. It was created primarily for the HarmonyOS ecosystem, but gradually the project began to expand beyond one platform. Today the language supports Linux, Windows, macOS, Android and iOS, and the project itself is being developed as open source.

The developers position Cangjie as a universal language that combines elements of object-oriented, functional and declarative programming. According to experts, in spirit it resembles a mixture of Java, Swift, Go, TypeScript and Kotlin, but at the same time it tries to offer its own solutions to the complex problems of modern development.

One of the main features of the language is the so-called effect handlers. At first glance, the term seems too academic, but the idea is quite practical. Modern programs constantly deal with side effects: network requests, file reading, error handling, asynchronous tasks, and multithreading.

In traditional languages, such logic often leads to complex and confusing code. This is especially noticeable in large projects, where developers have to build long chains of try/catch, async/await and various error handlers.

In Cangjie, some of these tasks are proposed to be solved through the built-in effects system. It allows you to more clearly describe what actions the program performs and how exactly non-standard situations should be processed. Similar ideas have already been explored in academia and experimental languages ​​like Koka or Eff, but Huawei is trying to implement similar mechanisms into a more general industrial language.

Experts note that effect processors can be especially useful for cloud services, mobile applications and artificial intelligence systems, where a huge number of operations are performed in parallel and asynchronously.

The second important feature of Cangjie is its support for algebraic data types, or ADTs. For the average user, this means safer operation of the program with different data states.

For example, instead of a chaotic set of checks, the developer can pre-describe all acceptable behavior options. This reduces the likelihood of errors and makes the code more predictable. This approach has long been used in functional programming languages, including Haskell, Rust and F#, but it is still used to a limited extent in mainstream enterprise products.

Experts believe that Huawei is relying on reliability and scalability. In the era of AI and distributed computing, program stability becomes critical, and the cost of errors is constantly increasing.

Interest in Cangjie is also growing because China is actively developing its own technology ecosystem. Following US restrictions, Huawei began investing in independent software platforms, including HarmonyOS, development tools and proprietary programming languages.

Against this background, Cangjie is gradually turning into not just an experimental project, but part of a larger strategy of technological independence. Some analysts are already calling the language a potential competitor to Kotlin and Swift in mobile development, especially within the Chinese market.

At the same time, the language cannot yet be called mass. The Cangjie ecosystem is still significantly inferior in the number of libraries, documentation and ready-made tools to such giants as Python, Java or JavaScript.

In addition, many of the language's features look too complex for novice developers. Algebraic effects and ADT require some preparation and understanding of modern programming concepts.

Nevertheless, interest in the project is gradually growing. Works on automatic translation of Java code into Cangjie using large language models are already appearing in scientific publications. The researchers believe the language ecosystem is evolving quickly enough to attract the attention of the academic community.

Experts also note that the modern programming industry is going through a period of serious changes. Developers are increasingly faced with the need to write secure, parallel, and scalable code. That is why ideas that were considered purely academic just a few years ago are gradually beginning to penetrate into real commercial products.

In this sense, Cangjie turned out to be one of the most unusual new languages ​​of recent years. It attempts to combine high performance compiled code, modern error handling techniques, and support for complex computing scenarios.

Whether the project will become globally popular is still unknown. However, Cangjie is already showing what the next generation of programming languages, designed for the era of artificial intelligence, cloud services and distributed computing, might look like.

Based on materials from https://www.infoq.com

Xrust Huawei opened the Cangjie programming language: how did it surprise the developers

Оцените статью
Xrust.com
Добавить комментарий