Draft:Cangjie (programming language)

Cangjie
ParadigmMulti-paradigm: functional, generic, imperative, declarative, object-oriented
DeveloperHuawei
First appearedJune 21, 2024; 23 days ago (2024-06-21)
Preview release
1.0 (Beta) / June 21, 2024; 23 days ago (2024-06-21)
Typing disciplineDuck, gradual, structural, Static, strong, safe, nominative, manifest, strong, inferred
OSHarmonyOS, Linux, Windows, macOS
LicenseProprietary (HarmonyOS)
Filename extensions.cj
Website
Influenced by
ArkTS, TypeScript, JavaScript, Swift, C#, F#, Java, C++, Go, Python

Cangjie is a high-level, statically typed, general-purpose, multi-paradigm, compiled imperative and declarative programming language developed by Huawei which was first released on June 21, 2024, as a beta recruitment of the developer preview version of the HarmonyOS NEXT app development for HarmonyOS operating system. It is also referred to as CangjieLang or CJ but its proper name is Cangjie.[1]

History

edit

Development of Cangjie started in 2019 by chief architect of Huawei's in-house programming language by Xinyu Feng, professor at the Department of Computer Science and Technology of Nanjing University alongside Tianjin University and Beihang University in its five-year development,[2] with the eventual collaboration of many other software programmers and engineers at Huawei at that time during the development initial release of HarmonyOS that same year, after being incubated in the R&D labs.[3]

In 2020, Huawei registered “Cangjie Language” trademark, which was classified as a “scientific instrument” and “web service” intellectual property in China. At that time, there were also rumors that Huawei was developing a new independent programming language Cangjie.[4]

During HDC 2021, in October 2021, HarmonyOS 3 Developer Preview was officially released as the OS was moving towards declarative programming software development. Huawei also announced that at that time that it would introduce the self-developed programming language for HarmonyOS in the future.[5]

It has also been reported between 2021 and 2022 that Huawei's programming language originally supposed to launch in 2022 or sometime around second half of 2022 which was pushed back due to ongoing development of HarmonyOS operating system internally.[6][7]

On May 17, 2024, Cangjie programming language was internally added into OpenHarmony source code through its foreign function interface (FFI) mechanism.[8]

On June 17, 2024, four days before HDC 2024, Huawei renamed it's programming language lab to Cangjie programming language and announces the developer sessions of the new programming language for the event.[9]

On June 21, 2024, at HDC 2024, Cangjie developer recruitment that is running throughout June 21, 2024 until October 21, 2024, first landed for Huawei Mate60 Pro devices first with expansions of more devices going into 2025 rollout of HarmonyOS Next version.[10] Silicon Valley-based LeetCode, ICBC bank, China Mobile, Kelan Software, became one of the first local app developer companies recruited by Huawei using the new programming language to test and showcase to other developers and industry with the release of commercial apps in the initial Chinese market launch of the new HarmonyOS Next version platform.[11]

On July 5 to July 7, 2024, ACM China Turing Conference 2024 held with the Huawei Cangjie Programming Language Forum showcasing the new in-house domestic programming language across universities in China for Cangjie development integrated into academia.[12][13]

Version history

edit

Version history of Cangjie releases with HarmonyOS with OpenHarmony core API Level 12 SDK via DevEco Studio IDE.

Version Release date macOS Windows
Cangjie 1.0 Beta[14] June 21, 2024 Yes Yes

Platforms

edit

The platforms Cangjie supports are HarmonyOS, Linux, Windows and macOS for app development.

A key aspect of Cangjie design is its ability to attach with or without ArkTS code developed for HarmonyOS development. On Huawei devices running HarmonyOS, it allows Native APIs in DevEco Studio templates alternative to traditional Native APIs of C, C++ alongside ArkTS code to run within one program.[15]

Features

edit

Cangjie is a general purpose programming language which is 'autonomous and controllable' which is not based on any existing programming languages in superset unlike ArkTS which replaced previous existing legacy programming languages as the primary development language on HarmonyOS platform alongside ArkTS. The programming language employs modern programming-language theory concepts of other existing programming languages of its category that influences it such as Java with simple and advanced syntax features like Typescript-centric ArkTS language, in declarative programming development by complementing it with efficiency.[16]

Cangjie features an embedded AgentDSL programming framework, natural language & programming language organic integration; Multi-agent collaboration, simplified symbolic expression, free combination of modes, and support for the development of various intelligent applications. It has a lightweight and scalable runtime, modular and hierarchical design, with Full-scenario domain extension, metaprogramming, and eDSL technologies support domain-oriented declarative development. In its first all-concurrent GC in the terminal scenario, for faster application threads. The lightweight threads with better concurrency performance and less overhead for programs on HarmonyOS development compared with Kotlin and Java on Android development in controlled benchmark brute force tests.[17][18]

It is reported that applications that have already been developed on existing ArkTS do not need to be redeveloped into the Cangjie version on HarmonyOS Next version. HarmonyOS supports high-performance interoperability between the Cangjie language and the ArkTS language. In the future, developers can choose between Cangjie programming language or ArkTS for incremental development for developer needs. For high-throughput to high-frequency read/write data processing scenarios, high-frequency interaction and high-load scenarios, and scenarios sensitive to startup latency, it is recommended to preferably choose the Cangjie language that fills the gaps of ArkTS bottlenecks.[19][20]

Cangjie also integrates 'Security DNA' into language design to help developers focus on app development functions over security functions around it that avoids vulnerabilities where it offers a static type system and automatic memory management to ensure application stability. That also includes runtime checks of detecting errors and cross-language security.[21] Cangjie also supports various toolchains for app development, including language services such as highlighting and association, debugging with cross-language debugging and thread-level visual debugging, static checking, performance analysis, package management, document generation, Mock tools, testing frameworks, coverage tools, Fuzz tools, and intelligent assisted programming tools.[22]

Examples

edit

The following is an example of a simple AI Native application development program with Cangjie programming language on HarmonyOS.[23]

Definition of Agent
@agent class Planner {
 @prompt[pattern=APE] (
   action: "Help users make travel routes",
   purpose: "Let users visit more attractions and get enough rest in the planned time",
   expectation: "Generate a reasonable route to a tourist attraction with information such as time, attractions, commute, etc."
   )
}
Use of the agent
let agent = Planner()
let  result = agent. chat("我想前往上海")

STD module runtime

edit

STD module runtime, known as Std.runtime is a module runtime package for Cangjie Standard Library via Cangjie Programming Language Library API that interacts with the program's runtime environment, with varaibles of controlling, managing and monitoring the program's execution. Cangjie languages uses automatic garbage collection mechanism in order to manage memory, and manual triggers around garbage collection with collection thresholds, obtaining memory statistics that regulate and monitor the garbage collection.[24][25]

Development tools

edit

Compiler

edit

With Ark Compiler, it supports a variety of dynamic and static programming languages such as JS, TS, and ArkTS as well as Cangjie. It is the compilation and runtime base that enables OpenHarmony alongside HarmonyOS based on the same platform to run on multiple device forms such as smart devices, mobile phones, PCs, tablets, TVs, automobiles, and wearables. ArkCompiler consists of two parts, compiler toolchain and runtime.[26]

IDE and editor support

edit

Cangjie uses DevEco Studio plug-in for HarmonyOS native development as Cangjie SDK using default declarative ArkUI, also other third-party UI frameworks on HarmonyOS NEXT version and OpenHarmony SDK with future cross-platform ArkUI-X support.[27]

See also

edit

References

edit
  1. ^ Matsui, Emiko (June 21, 2024). "Huawei programming language to make official debut at HDC 2024". Huawei Central. Retrieved July 6, 2024.
  2. ^ "天津大学、北航深度参与华为"仓颉",推出首个基于国产编程语言的 AI 智能体编程框架"苍穹" - IT之家". www.ithome.com. Retrieved July 6, 2024.
  3. ^ "华为下一代编程语言"仓颉"首席架构师揭晓:南京大学冯新宇教授 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  4. ^ Amit (September 25, 2021). "Huawei to launch a self-developed programming language Cangjie next year". HU. Retrieved July 6, 2024.
  5. ^ Benjie, Joshua (March 17, 2022). "Huawei testing own programming language registration". RPRNA. Retrieved July 6, 2024.
  6. ^ Li, Deng (June 16, 2022). "Huawei's programing language will launch in the second half of this year". Huawei Central. Retrieved July 6, 2024.
  7. ^ Walker, Elyssa (February 2, 2020). "Huawei is developing its own programming language - it will be presented in 2022". CodeBug'22. Retrieved July 6, 2024.
  8. ^ Benjamin (May 14, 2024). "Huawei's self developed programming language Cangjie (CJ) could be coming later this month closer than expected". HarmonyOSHub. Retrieved July 6, 2024.
  9. ^ Nick (June 17, 2024). "Huawei Renames Programming Language Lab to 'Cangjie Programming Language' and Announces Insights at HDC 2024". HarmonyOSHub. Retrieved July 6, 2024.
  10. ^ "华为开启鸿蒙 HarmonyOS NEXT 仓颉编程语言开发者预览版 Beta 招募 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  11. ^ "华为仓颉编程语言首批合作企业亮相:中国工商银行、中国移动、科蓝软件等在列 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  12. ^ "ACM 中国图灵大会 2024 将于 7 月 5 日举行,设华为仓颉编程语言论坛 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  13. ^ Nick (July 7, 2024). "The Cangjie Programming Language Unveiled at ACM China Turing Conference". HarmonyOSHub. Retrieved July 7, 2024.
  14. ^ Matsui, Emiko (June 21, 2024). "Huawei begins Cangjie programming language beta recruitment". Huawei Central. Retrieved July 6, 2024.
  15. ^ "华为仓颉编程语言首批合作企业亮相:中国工商银行、中国移动、科蓝软件等在列 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  16. ^ "华为:仓颉编程语言自主可控,没有基于任何现有的编程语言演进 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  17. ^ Living In Harmony (June 23, 2024). Cangjie language compared with Java and Kotlin language on app scrolling. Retrieved July 6, 2024 – via YouTube.
  18. ^ "华为自研仓颉编程语言官网和开发文档上线,首次融入鸿蒙生态 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  19. ^ "Huawei has announced its own programming language Cangjie". ITC.ua. June 21, 2024. Retrieved July 6, 2024.
  20. ^ "华为开启鸿蒙 HarmonyOS NEXT 仓颉编程语言开发者预览版 Beta 招募 - IT之家". www.ithome.com. Retrieved July 6, 2024.
  21. ^ "Huawei Reveals New Programming Language, Promising Native Intelligence and Strong Security". June 23, 2024. Retrieved July 6, 2024.
  22. ^ Bates, Kryzt (June 21, 2024). "Huawei Releases Next-Generation Programming Language "Cangjie" After 5 Years of Research". GAMINGDEPUTY. Retrieved July 6, 2024.
  23. ^ "AI Native application development". Huawei Developer (HarmonyOS Developer). Huawei. Retrieved July 6, 2024.
  24. ^ "std.runtime 包". Huawei Developer (HarmonyOS Developer). Huawei. Retrieved July 6, 2024.
  25. ^ "Cangjie Programming Language Library API". Huawei Developer (HarmonyOS Developer). Huawei. Retrieved July 6, 2024.
  26. ^ "ArkCompiler Runtime". OpenAtom Gitee. OpenAtom Gitee. Retrieved February 12, 2024.
  27. ^ "HarmonyOS NEXT Cangjie Language Developer Preview Beta Recruitment". Huawei Developer (HarmonyOS Developer). Huawei. Retrieved July 6, 2024.
edit