Cangjie (programming language)

Last updated

Cangjie
Paradigm Multi-paradigm: functional, generic, imperative, declarative, object-oriented
Developer Huawei
First appearedJune 21, 2024;18 days ago (2024-06-21)
Preview release
1.0 (Beta) / June 21, 2024;18 days ago (2024-06-21)
Typing discipline Duck, gradual, structural, Static, strong, safe, nominative, manifest, strong, inferred
OS HarmonyOS, Linux, Windows, macOS
License Proprietary (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]

Contents

History

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

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

VersionRelease date macOS Windows
Cangjie 1.0 Beta [14] June 21, 2024YesYes

Platforms

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

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

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

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

Compiler

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

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

Related Research Articles

A computing platform, digital platform, or software platform is the infrastructure on which software is executed. While the individual components of a computing platform may be obfuscated under layers of abstraction, the summation of the required components comprise the computing platform.

The Android Package with the file extension apk is the file format used by the Android operating system, and a number of other Android-based operating systems for distribution and installation of mobile apps, mobile games and middleware. A file using this format can be built from source code written in either Java or Kotlin.

<span class="mw-page-title-main">EMUI</span> Mobile operating system by Huawei

EMUI is an interface based on Android developed by Chinese technology company Huawei. Used on the company's smartphones primarily globally.

HarmonyOS (HMOS) is a distributed operating system developed by Huawei for smartphones, tablets, smart TVs, smart watches, personal computers and other smart devices. It has a multi-kernel design with dual frameworks: the operating system selects suitable kernels from the abstraction layer in the case of devices that use diverse resources.

<span class="mw-page-title-main">Huawei Mobile Services</span> Proprietary software service

Huawei Mobile Services (HMS) is a collection of proprietary services and high level application programming interfaces (APIs) developed by Huawei Technologies Co., Ltd. Its hub known as HMS Core serves as a toolkit for app development on Huawei devices. HMS is typically installed on Huawei devices on top of running HarmonyOS operating system, and on its earlier devices running the Android operating system with EMUI including devices already distributed with Google Mobile Services. Alongside, HMS Core Wear Engine for Android phones with lightweight based LiteOS wearable middleware app framework integration connectivity like notifications, status etc.

<span class="mw-page-title-main">Huawei AppGallery</span> Mobile app distribution platform developed by Huawei for the HarmonyOS operating system

Huawei AppGallery is a package manager and application distribution platform, or marketplace 'app store', developed by Huawei Technologies Co., Ltd. It serves as the official app store for the devices running on Huawei HarmonyOS, and is also available for Huawei EMUI and Microsoft Windows via the Mobile Engine emulator.

<span class="mw-page-title-main">DevEco Studio</span> Integrated development environment for the HarmonyOS platform

DevEco Studio is the official integrated development environment (IDE) for Huawei's HarmonyOS operating system, built on JetBrains' IntelliJ IDEA software and formerly Huawei's SmartAssist designed specifically for HarmonyOS development built by Huawei. It is available for download on Microsoft Windows and macOS based operating systems.

The version history of the HarmonyOS distributed operating system began with the public release of the HarmonyOS 1.0 for Honor Vision smart TVs on August 9, 2019. The first expanded commercial version of the Embedded, IoT AI, Edge computing based operating system, HarmonyOS 2.0, was released on June 2, 2021, for phones, tablets, smartwatches, smart speakers, routers, and internet of things. Beforehand, DevEco Studio, the HarmonyOS app development IDE, was released in September 2020 together with the HarmonyOS 2.0 Beta. HarmonyOS is developed by Huawei. New major releases are announced at the Huawei Developers Conference (HDC) in the fourth quarter of each year together with the first public beta version of the operating system's next major version. The next major stable version is then released in the third to fourth quarter of the following year.

<span class="mw-page-title-main">OpenHarmony</span> Family of open-source operating systems based on OpenHarmony

OpenAtom OpenHarmony, or abbreviated as OpenHarmony (OHOS), is a family of open-source distributed operating systems based on HarmonyOS derived from LiteOS, donated the L0-L2 branch source code by Huawei to the OpenAtom Foundation. Similar to HarmonyOS, the open-source distributed operating system is designed with a layered architecture, which consists of four layers from the bottom to the top, i.e., the kernel layer, system service layer, framework layer, and application layer. It is also an extensive collection of free software, which can be used as an operating system or can be used in parts with other operating systems via Kernel Abstraction Layer subsystems.

<span class="mw-page-title-main">AITO (marque)</span> Chinese automotive marque

AITO is a Chinese electric vehicle marque of Chinese vehicle manufacturer Seres Group and multinational technology corporation Huawei in 2021. The marque offers electric cars with autonomous driving systems and the HarmonyOS operating system.

Harmony Intelligent Mobility Alliance trading as HIMA is an automotive alliance initiated by Chinese technology company Huawei. Under HIMA, Huawei participates in product definition, design, marketing, user experience, quality control and provides intelligent vehicle software and hardware for traditional automobile manufacturers.

HarmonyOS NEXT is a proprietary distributed operating system and an iteration of HarmonyOS, developed by Huawei to support only HarmonyOS native apps. The operating system is primarily aimed at software and hardware developers that deal directly with Huawei. It does not include Android's AOSP core and is incompatible with Android applications.

ArkUI is a declarative based user interface framework for building user interfaces on native HarmonyOS, OpenHarmony alongside Oniro OS applications developed by Huawei for the ArkTS and Cangjie programming language.

Ark Compiler, also known as ArkCompiler, is a unified compilation and runtime platform that supports joint compilation and running across programming languages and chip platforms, also operating systems of open-source OpenHarmony, Oniro OS, alongside proprietary HarmonyOS with single core system HarmonyOS NEXT included on native APP in Event-driven programming in a unified development environment and formerly built for Android-based EMUI for Huawei smartphones and tablets with HMS-enabled apk apps on AppGallery that improves app performance. It supports a variety of dynamic and static programming languages such as JS, TS, and ArkTS. It is the compilation and runtime base that enables OpenHarmony, Oniro OS alongside HarmonyOS NEXT 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.

BiSheng Compiler is an open-source compiler toolchain developed by Huawei for general-purpose processor architectures, such as Kunpeng within HiSilicon domain. It is based on LLVM, and introduces and enhances multiple compilation optimization technologies and supports different programming languages, such as ArkTS, Cangjie, C, C++ and Fortran.

ArkTS is a high-level general-purpose, multi-paradigm, compiled, declarative programming language developed by Huawei which is a superset of open-source TypeScript, in turn a superset of JavaScript formerly used in July 2022 HarmonyOS 3.0 version, alongside its evolved percussor, extended TypeScript (eTS) built for HarmonyOS development as a shift towards Declarative programming. ArkTS compiles to machine code via its ahead-of-time compilation Ark Compiler. ArkTS was first released in September 30, 2021 on OpenHarmony, and the ArkTS toolchain has shipped in DevEco Studio since version 3.1, released in 2022. Since, OpenHarmony 4.0 release on October 26, 2023, ArkTS APIs has been added to the open source community to contribute.

<span class="mw-page-title-main">MindSpore</span> Machine learning software library

MindSpore is a open-source software framework for deep learning, machine learning and artificial intelligence developed by Huawei.

<span class="mw-page-title-main">Hvigor</span> Free software build automation tool

Hvigor is a build automation tool for multi-language software development built on TypeScript. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing of a number of programming languages such as JS, eTS on older versions, ArkTS app development for DevEco Studio IDE.

<span class="mw-page-title-main">HarmonyOS Sans</span> Geometric sans-serif typeface

HarmonyOS Sans is a sans-serif typeface created by Huawei. It was first made available to developers on June 9, 2021, and is utilized within the HarmonyOS and OpenHarmony operating systems. It represents Huawei's second typeface following its corporate Huawei Sans sans-serif typeface.

HarmonyOS Kernel, sometimes mentioned as Harmony kernel is the computer operating system (OS) kernel developed at Huawei since August 2023 for use in the HarmonyOS NEXT iterative versions of HarmonyOS proprietary operating system replacing previous versions of HarmonyOS with AOSP compatibility, Linux kernel and LiteOS kernel legacies.

References

  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.