ArkTS

Last updated

ArkTS
Paradigm Multi-paradigm: functional, generic, imperative, object-oriented
Developer Huawei and OpenAtom Foundation open-source contributors
First appearedSeptember 30, 2021;2 years ago (2021-09-30)
Stable release
4.1.7.3 / March 30, 2024;20 days ago (2024-03-30)
Typing discipline Duck, gradual, structural
OS HarmonyOS, OpenHarmony, Oniro OS, macOS, Windows, Android, iOS
License Apache License
Proprietary (up to HarmonyOS 3.1)
Filename extensions .ets, .ts
Website
Influenced by
TypeScript, Swift, Objective-C, JavaScript, C#, F#, Java, ActionScript, AtScript, AssemblyScript

ArkTS is a high-level general-purpose, multi-paradigm, compiled 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 it's 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. [1] Since, OpenHarmony 4.0 release on October 26, 2023, ArkTS APIs has been added to the open source community to contribute. [2]

Contents

Huawei intended ArkTS to support many core concepts associated with extended TypeScript (eTS) based on TypeScript and in turn JavaScript from previous versions of HarmonyOS 3.0 with ArkUI declarative UI app development and 2.0 imperative app development alongside Java. ArkTS was introduced at Huawei's Developer Conference (HDC) 2022 in November 2022 on HarmonyOS 3.1 release. [3] [4]

It underwent an upgrade in HDC 2023 with HarmonyOS 4.0 API 10 and a major upgrade at January 18, 2024 HarmonyOS Ecology Developer Conference alongside, new Cangjie programming language announced by Huawei where both programming languages become the primary languages for HarmonyOS NEXT system of HarmonyOS operating system. [5] [6]

The current version of ArkTS, was released on October 26, 2023, for open source OpenHarmony 4.0 API 10 with new ArkTS APIs via DevEco Studio 4.0 Canary build after HarmonyOS 4.0 release on August 4, 2023. [7] Following current stable release, a preview released in January 2024, with OpenHarmony 4.1 Beta 1 API 11. Alongside, HarmonyOS NEXT Developer Preview 1 with latest API 11 preview based on latest version of OpenHarmony. [8]

History

Development of ArkTS started in 2015 by HarmonyOS founder Wang Chenglu, with the eventual collaboration of many other programmers at Huawei at that time began development of HarmonyOS after being incubated in the R&D labs for a few years as earlier as 2012 within the company. ArkTS was motivated by the need for a replacement for Huawei's earlier programming language Java that not only carried legal baggage but also performance issues, underdeveloped applications in a weaker SDK HarmonyOS 2.0 shipped with and improvements that still lacked in HarmonyOS 3.0 eTS/JS development for HarmonyOS app development that lacked modern features for the modern operating system. ArkTS took language ideas from the likes of TypeScript, Swift, Rust, JavaScript. On November 2022, Huawei revealed the programming language evolved from eTS on HarmonyOS 3.0 to ArkTS on HarmonyOS 3.1 update. A beta version of the programming language was released to registered Huawei developers at the conference and it was not open-sourced at that time until OpenHarmony 3.0 API 7 era under OpenAtom Foundation when Huawei contributed the ArkTS codes and APIs of HarmonyOS 3.0 which was previously called eTS in September 2021. [9]

During HDC 2021, in October 2021, Huawei announced ArkUI with DevEco Studio 3.0 for HarmonyOS 3.0 era, which provides a framework for declarative UI structure design across all Huawei devices for eTS development which evolved into ArkTS development by HDC 2022 for HarmonyOS 3.1. ArkTS first appeared on OpenAtom's OpenHarmony 3.1 Beta on December 31, 2021 alongside it's documentation. [10] Since December 2023, ArkUI is evolved into OpenHarmony 4.0, also Oniro OS with ArkTS programming language support and APIs. Also, Huawei announced it would evolve ArkUI into a cross-platform declarative UI called ArkUI-X to reduce app development time and costs by bringing it to multiple platforms on Android, iOS, Microsoft Windows and macOS etc. Including EulerOS in containers that shares HarmonyOS application software stack technologies making it easier for interoperability. [11] [12]

Version history

Version history of ArkTS releases with OpenHarmony (API 7) and HarmonyOS (API 8) convergence SDK.

VersionRelease date macOS Windows
ArkTS (eTS) LTS [Long Term Support] 3.0.0.0September 30, 2021YesYes
ArkTS (eTS) 3.1.13.6March 30, 2022YesYes
ArkTS 3.2.13.5April 9, 2023YesYes
ArkTS 4.0.9.6October 26, 2023YesYes
ArkTS 4.1.7.3March 30, 2024YesYes

[13]

Platforms

The platforms ArkTS supports are HarmonyOS, Linux, Windows, macOS, iOS and Android.

A key aspect of ArkTS design is its ability to interoperate with the huge body of existing eTS and JavaScript code developed for Huawei products over the previous versions of HarmonyOS, such as HarmonyOS Design language system, graphical user interface system. On Huawei devices running HarmonyOS, it links with the eTS runtime library, which allows Native APIs in DevEco Studio templates, C, C++ and ArkTS code to run within one program. [14]

Features

ArkTS is a general purpose programming language that employs modern programming-language theory concepts and strives to present a simple, yet powerful syntax. ArkTS incorporates innovations and conventions from various programming languages, with notable inspiration from TypeScript, which it replaced as the primary development language on HarmonyOS.

ArkTS was designed to be safe and friendly to new programmers while not sacrificing speed. By default ArkTS manages all memory automatically and ensures variables are always initialized before use. Array accesses are checked for out-of-bounds errors and integer operations are checked for overflow. Parameter names allow for the creation of clear APIs. Protocols define interfaces that types may adopt, while extensions allow developers to add functionality to existing types. ArkTS enables Object-Oriented Programming with the support for classes, subtyping, and method overriding. Optionals allow nil values to be handled explicitly and safely. Concurrent programs can be written using async/await syntax and actors isolate shared mutable state in order to eliminate data races. [15]

Examples

The following is an example of a simple Hello World program. It is standard practice in ArkUI with ArkTS programming language to separate the application struct and views into different structs, with the main view named Index. [16]

importArkTS// Index.etsimportrouterfrom'@ohos.router';@Entry@ComponentstructIndex{@Statemessage:string='Hello World'build(){Row(){Column(){Text(this.message).fontSize(50).fontWeight(FontWeight.Bold)// Add a button to respond to user clicks.Button(){Text('Next').fontSize(30).fontWeight(FontWeight.Bold)}.type(ButtonType.Capsule).margin({top:20}).backgroundColor('#0D9FFB').width('40%').height('5%')// Bind the onClick event to the Next button so that clicking the button redirects the user to the second page..onClick(()=>{router.pushUrl({url:'pages/Second'})})}.width('100%')}.height('100%')}}

ArkUI-X

ArkUI-X is an open-source UI software development kit which is extension of ArkUI for ArkTS development created by Huawei. It is used to develop cross platform applications from a single codebase for any platform such as Android, iOS, OpenHarmony, Oniro OS and HarmonyOS which was released on December 8, 2023, after Canary 1 build on August 4, 2023. [17] ArkUI replaces the older Interface Builder paradigm with a new declarative development paradigm.

Ark TypeScript Runtime

ARK TypeScript Runtime is a runtime used in ArkTS applications derived from former HarmonyOS 3.0/OpenHarmony 3.1 API 8 eTS (extendedTypeScript) on OpenHarmony as well as HarmonyOS apps taking advantage of custom OpenHarmony-based HarmonyOS NEXT core operating system. It contains an allocator and garbage collector (GC) for ArkTS/JS objects, a standard library that conforms to the ECMAScript specification, an interpreter for running the ARK Bytecode (abc) generated by ARK front-end components, an inline cache for acceleration, a statically typed compiler, a C++/C function interface for Native API (NAPI) application development at runtime, and other modules in Ahead-of-time compilation via DevEco Studio since version 3.1.1 on both HarmonyOS 3.1 SDK and OpenHarmony 3.2 SDK API 9. [18]

ets_frontend

The ets_frontend is a front-end tool in the ARK Runtime Subsystem which combines the ace-ets2bundle component that supports converting ETS programming language files into ARK bytecode files. They correspond with ArkTS app development in OpenHarmony and HarmonyOS development under HarmonyOS NEXT system. [19]

ArkCompiler Toolchain for Debugging

The ArkCompiler Toolchain provides developers with debugging tools for ArkTS application development, such as the Debugger, CPUProfiler, and HeapProfiler. The debugging and tuning capabilities provided by the Ark Toolchain is used through DevEco Studio IDE that relies on the ArkCompiler Runtime to provide runtime-related information to developers. [20]

Development tools

Compiler

With Ark Compiler, 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 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. [21]

IDE and editor support

DevEco Studio for HarmonyOS development using default declarative ArkUI, also other third-party UI frameworks on OpenHarmony SDK, ArkUI-X cross-platform development with Android and iOS support. [22]

See also

Related Research Articles

In computing, cross-platform software is computer software that is designed to work in several computing platforms. Some cross-platform software requires a separate build for each platform, but some can be directly run on any platform without special preparation, being written in an interpreted language or compiled to portable bytecode for which the interpreters or run-time packages are common or standard components of all supported platforms.

A computing platform, digital platform, or software platform is an environment in which software is executed. It may be the hardware or the operating system (OS), a web browser and associated application programming interfaces, or other underlying software, as long as the program code is executed using the services provided by the platform. Computing platforms have different abstraction levels, including a computer architecture, an OS, or runtime libraries. A computing platform is the stage on which computer programs can run.

<span class="mw-page-title-main">Adobe AIR</span> Cross-platform runtime system for building rich web applications

Adobe AIR is a cross-platform runtime system currently developed by Harman International, in collaboration with Adobe Inc., for building desktop applications and mobile applications, programmed using Adobe Animate, ActionScript, and optionally Apache Flex. It was originally released in 2008. The runtime supports installable applications on Windows, macOS, and mobile operating systems, including Android, iOS, and BlackBerry Tablet OS.

<span class="mw-page-title-main">JavaFX</span> Java software platform for GUI

JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications that can run across a wide variety of devices. JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linux, and macOS, as well as mobile devices running iOS and Android, through Gluon Mobile.

Titanium SDK is an open-source framework that allows the creation of native mobile applications on platforms iOS and Android from a single JavaScript codebase. It is presently developed by non-profit software foundation TiDev, Inc.

RemObjects Software is an American software company founded in 2002 by Alessandro Federici and Marc Hoffman. It develops and offers tools and libraries for software developers on a variety of development platforms, including Embarcadero Delphi, Microsoft .NET, Mono, and Apple's Xcode.

Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. It can be used to develop web and mobile apps as well as server and desktop applications.

Windows Runtime (WinRT) is a platform-agnostic component and application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. It is implemented in C++ and officially supports development in C++, Rust/WinRT, Python/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic (.NET) (VB.NET).

Flutter is an open-source UI software development kit created by Google. It can be used to develop cross platform applications from a single codebase for the web, Fuchsia, Android, iOS, Linux, macOS, and Windows. First described in 2015, Flutter was released in May 2017. Flutter is used internally by Google in apps such as Google Pay and Google Earth as well as by other software developers including ByteDance and Alibaba.

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 multikernel design with dual frameworks: the operating system selects suitable kernels from the abstraction layer in the case of devices that use diverse resources. The operating system was officially launched by Huawei in August 2019.

<span class="mw-page-title-main">AssemblyScript</span> Programming language, variant of TypeScript that compiles to WebAssembly

AssemblyScript is a TypeScript-based programming language that is optimized for, and statically compiled to, WebAssembly. Resembling ECMAScript and JavaScript, but with static types, the language is developed by the AssemblyScript Project with contributions from the AssemblyScript community.

<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 Huawei's SmartAssist designed specifically for HarmonyOS development. 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 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.

The HarmonyOS App Pack or the App file, identified with the file extension ".app", serves as the file format used by the HarmonyOS operating system. It functions as a native HarmonyOS app for distribution and installation through Huawei AppGallery, or for distribution through Huawei Ability Gallery in respect of installation-free apps under both current classic dual-framework and HarmonyOS NEXT system. The App file is also used by a number of other open source HarmonyOS-based operating systems such as OpenHarmony and Oniro OS-based operating systems for distribution and installation of applications, video games and middleware. Including non OpenHarmony-based operating systems, such as GNU Linux-based Unity Operating System that supports the app file format.

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 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 introduces and enhances multiple compilation optimization technologies and supports different programming languages, such as ArkTS, Cangjie, C, C++ and Fortran.

<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.

References

  1. Amit. "Breaking: Huawei HarmonyOS 3.1 timeline announced [Developer Preview Released]". Huawei Update. Huawei Update. Retrieved February 12, 2024.
  2. "Getting Started with ArkTS". OpenAtom OpenHarmony. OpenAtom OpenHarmony. Retrieved February 12, 2024.
  3. Balogun, Yusuf. "Huawei Enters Declarative Development with HarmonyOS 3.1 Version Announcement". techgenyz. techgenyz. Retrieved February 12, 2024.
  4. Amit. "Breaking: Huawei HarmonyOS 3.1 timeline announced [Developer Preview Released]". Huawei Update. Huawei Update. Retrieved February 12, 2024.
  5. NYAME, FREDERICK. "GET READY FOR HARMONYOS 4.0: OFFICIAL ANNOUNCEMENT COMING ON AUGUST 4". GIZMOCHINA. GIZMOCHINA. Retrieved February 12, 2024.
  6. Paul, Peter. "HarmonyOS NEXT unveiled: A standalone OS without reliance on Android APKs!". GIZGUIDE. GIZGUIDE. Retrieved February 12, 2024.
  7. Li, Deng. "OpenHarmony 4.0 release version launched with API 10". HC Newsroom. HC Newsroom. Retrieved February 12, 2024.
  8. Li, Deng. "Open source HarmonyOS 4.1 release beta 1 with API 11 interfaces". HC Newsroom. HC Newsroom. Retrieved February 12, 2024.
  9. Zhang, Phate Zhang. "Behind the birth of Huawei's HarmonyOS". CNTechPost. CNTechPost. Retrieved February 12, 2024.
  10. "OpenHarmony 3.1 Beta". OpenAtom OpenHarmony. OpenAtom OpenHarmony. Retrieved February 15, 2024.
  11. "DevEco Studio 3.0 for HarmonyOS 3.0 and OpenHarmony 3.1 beta releases are here". Develop Know. Develop Know. Retrieved February 12, 2024.
  12. Li, Deng. "Huawei DevEco Studio 3.1 Canary rolling out". HC Newsroom. HC Newsroom. Retrieved February 12, 2024.
  13. "zh-cn/release-notes/OpenHarmony-v4.1-release.md · OpenHarmony/docs". Gitee (in Chinese (China)). Retrieved March 31, 2024.
  14. "HarmonyOS 3.0.0 Developer Preview". HarmonyOS. HarmonyOS. Retrieved February 12, 2024.
  15. "ArkTS Tutorial" (PDF). OpenAtom Gitee. OpenAtom Gitee. Retrieved February 12, 2024.
  16. "Getting Started with ArkTS in Stage Model - Implementing Page Redirection". HarmonyOS. HarmonyOS. Retrieved February 12, 2024.
  17. "ArkUI-X Release Notes". ArkUI-X GitHub. ArkUI-X GitHub. Retrieved February 12, 2024.
  18. "ArkCompiler JS Runtime - ets Runtime". OpenAtom Gitee. OpenAtom Gitee. Retrieved February 12, 2024.
  19. "ets_frontend". OpenAtom Gitee. OpenAtom Gitee. Retrieved February 12, 2024.
  20. "Ark toolchain components". OpenAtom Gitee. OpenAtom Gitee. Retrieved February 12, 2024.
  21. "ArkCompiler Runtime". OpenAtom Gitee. OpenAtom Gitee. Retrieved February 12, 2024.
  22. "ArkUI-X SDK". ArkUI-X GitHub. ArkUI-X GitHub. Retrieved February 12, 2024.