Huawei Unveils Cangjie (.cj) – A New Programming Language for HarmonyOS NEXT
At the Huawei Developer Conference on June 21, 2024, Huawei announced its self‑developed Cangjie programming language with a .cj file extension, presented a starter "Hello, Cangjie" example, and detailed the language's historical inspiration, core features, and a step‑by‑step introductory tutorial for developers.
Language Overview
Cangjie is a new programming language announced by Huawei for HarmonyOS NEXT. Source files use the .cj extension. The first program prints “你好,仓颉”.
Development Background
The project began in 2019 and underwent five years of research and optimization. It integrates modern language features, provides full compilation and runtime optimizations, and includes an out‑of‑the‑box IDE toolchain for a streamlined development experience.
Core Language Features
Hello, Cangjie – basic output.
Identifiers – naming rules.
Variables – declaration and assignment.
Types – primitive and composite types.
Expressions – arithmetic and logical expressions.
Program Structure – organization of source files.
Function Definitions – syntax for defining functions.
Enums – enumeration types.
Structs – composite data structures.
Classes – object‑oriented constructs.
Interfaces and Extensions – defining contracts and extending functionality.
Exception Handling – error detection and recovery.
Concurrent Programming – primitives for parallel execution.
Cross‑Language Interoperability – calling and being called from other languages.
Macros – compile‑time code generation.
Example
// hello.cj
print("你好,仓颉");References
Official Cangjie page: https://developer.huawei.com/consumer/cn/cangjie/
Getting‑started tutorial: https://developer.huawei.com/consumer/cn/training/course/slightMooc/C101718903607800132
Whitepaper: https://developer.huawei.com/consumer/cn/doc/openharmony-cangjie/cj-wp-abstract
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
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.
