Explore Cangjie – Huawei’s New Multi‑Paradigm Programming Language
This article introduces Huawei's newly announced Cangjie programming language, walks through a simple "Hello, Cangjie" program, explains its syntax and coding conventions, and highlights its native intelligence, high performance, strong security, and cross‑language interoperability features for modern software development.
Hello, Cangjie – First Program
The Cangjie language was announced at the 2024 Huawei HDC conference and is now available for developer preview. After obtaining the Cangjie compiler (cjc 0.51.4) on Debian GNU/Linux 11, a new file hello.cj is created with the following code:
main {
println("Hello, Cangjie");
}Compiling and running the program prints the greeting to the terminal.
The code is easy to understand: main is the entry point, the string literal "Hello, Cangjie" is printed by the println function, and comments start with // or are enclosed in /* … */.
Coding Style Guidelines
Place a line break after the opening brace.
Indent the code inside braces by one level (typically four spaces; two spaces for deeply nested UI code).
Place the closing brace on its own line.
Key Language Features
Native Intelligence
Cangjie embeds the AgentDSL framework, allowing natural‑language‑driven programming and multi‑Agent collaboration, which simplifies symbolic expression and supports intelligent application development.
High Performance
The language uses a fully concurrent garbage collector and lightweight thread design, resulting in smoother execution and faster response times. Threads are created with the spawn keyword and a lambda expression defining the thread’s work.
Strong Security
Cangjie integrates security principles into its design, helping developers focus on business logic while reducing the risk of vulnerabilities, embodying a "code is secure" philosophy.
Cross‑Language Interoperability
The language supports seamless interoperation with C, ArkTS/JS, Python and other ecosystems. External functions are declared with the foreign keyword and invoked inside an unsafe block, enabling reuse of existing libraries.
Learning Resources
A comprehensive guide titled "Cangjie Programming Quick Start" covers 15 chapters, ranging from basic syntax and object‑oriented concepts to advanced topics such as generics, collections, and high‑order functions, providing practical code examples and accompanying video tutorials.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
