White Paper
❱
Efficient Programming
❱
Multi-Paradigm
Type Extension
Type Inference
Other Modern Features and Syntactic Sugar
Security and Reliability
❱
Static Type and Garbage Collection
Null Reference Safety
Value Type
Immutability First
Closed by Default
try-with-resources
Dynamic Security Check
Obfuscation
Easy Concurrency
❱
Lightweight Thread Model
Lock-Free Concurrent Object
Excellent Performance
❱
Static Compilation Optimization
Value Type Optimization
Fully-Concurrent Sorting GC
Lightweight Runtime
Agile Expansion
❱
Native Syntax Extension Capability
Macros
Agile Extension Case: Declarative UI
Tool Support
❱
Package Manager
Debugger
Cangjie Testing Infrastructure
IDE Plug-in
Future Work Plan
❱
AI Native Application Development
DSL KIT
Actor and Distributed Programming
IDE AI Enablement
Visualized Concurrent and Parallel Program Tuning
Specification
❱
Lexical Structure
Types
Names, Scopes, Variables, and Modifiers
Expressions
Functions
Classes and Interfaces
Properties
Extensions
Generics
Overloading
Packages and Modules
Exceptions
Cross-Language Interoperability
Metaprogramming
Concurrency
Constant Evaluation
Annotation
Cangjie Syntax
Development Guide
❱
Getting Started with Cangjie
❱
Getting Started with Cangjie
Installing the Cangjie Toolchain
Running the First Cangjie Program
Basic Concepts
❱
Identifiers
Program Structure
Expressions
Functions
Basic Data Types
❱
Integer
Floating Point
Boolean
Character
String
Tuple
Array
Range
Unit
Nothing
Functions
❱
Function Definition
Function Call
Function Type
Nested Function
Lambda Expression
Closure
Syntactic Sugar in a Function Call
Function Overloading
Operator Overloading
const Function and Constant Evaluation
Structure Types
❱
Defining a struct Type
Creating a struct Instance
mut Function
Enum and Pattern Match
❱
Enum
Option Type
Pattern Overview
Refutability of Patterns
match Expression
if-let Expression
while-let Expression
Other Places to Use Patterns
Classes and Interfaces
❱
Classes
Interfaces
Properties
Subtype Relationships
Type Conversions
Generics
❱
Generic Overview
Generic Functions
Generic Interfaces
Generic Classes
Generic Structs
Generic Enums
Subtype Relationship of a Generic Type
Type Alias
Generic Constraints
Extensions
❱
Extension Overview
Direct Extensions
Interface Extensions
Access Rules
Collection Types
❱
Basic Collection Type Overview
ArrayList
HashSet
HashMap
Iterable and Collections
Packages
❱
Package Overview
Package Declaration
Visibility of Top-Level Declarations
Package Import
Program Entry
Exceptions
❱
Defining Exceptions
Throwing and Handling Exceptions
Common Runtime Exceptions
Using Options
Concurrent Programming
❱
Concurrency Overview
Creating a Thread
Accessing a Thread
Terminating a Thread
Synchronization Mechanism
Thread Sleep Duration
Basic I/O Operations
❱
I/O Stream Overview
I/O Node Streams
I/O Processing Streams
Network Programming
❱
Network Programming Overview
Socket Programming
HTTP Programming
WebSocket Programming
Macro
❱
Macro Overview
Token Types and quote Expressions
Syntax Nodes
Macro Implementation
Compiling, Error Reporting, and Debugging
Defining and Importing Macro Packages
Built-in Compilation Flags
Practical Cases
Reflections and Annotations
❱
Dynamic Features
Annotations
Cross-Language Interoperability
❱
Cangjie-C Interoperability
Cangjie–ArkTS Interoperability
Compilation and Building
❱
cjc Usage
Introduction to cjpm
Conditional Compilation
Appendix
❱
cjc Compilation Options
Installation and Support of Toolchain on Linux
Runtime Environment Variable User Guide
Keywords
Operators
Operator Functions
TokenKind Type
API Reference
❱
std Module
❱
std Module
std.core Package
❱
core Package
Function
Type Alias
Built-in Type
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Cangjie Concurrent Programming Example
Example of Interaction Between CString and C Language Code
std.argopt Package
❱
argopt Package
Class
Sample Tutorial
❱
Parsing Long Command Line Parameters
Parsing Short Command Line Parameters
std.ast Package
❱
ast Package
Function
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Macro With Context
Syntax Tree Node Print
AST Object Operation Example
Example of Parsing Cangjie Source Code into an AST Object
User-defined Error Reporting API
Example of Traversing AST Objects Using a User-defined Access Function
std.binary Package
❱
binary Package
Interface
std.collection Package
❱
collection Package
Function
Interface
Class
Struct
Exception Class
Sample Tutorial
❱
append and insert functions of ArrayList
get and set functions of ArrayList
remove, clear, and slice functions of ArrayList
get, put, and contains functions of HashMap
putAll, remove, and clear functions of HashMap
put, iterator, and remove functions of HashSet
Iterator Operation Function
std.collection.concurrent Package
❱
collection.concurrent Package
Interface
Class
Sample Tutorial
❱
ConcurrentHashMap Usage Example
NonBlockingQueue Usage Example
std.console Package
❱
console Package
Class
Sample Tutorial
❱
Console Example
std.convert Package
❱
convert Package
Interface
Sample Tutorial
❱
covert Usage Example
std.crypto.cipher Package
❱
crypto.cipher Package
Interface
std.crypto.digest Package
❱
crypto.digest Package
Function
Interface
std.database.sql Package
❱
database.sql Package
Interface
Class
Enumeration
Exception Class
Sample Tutorial
❱
Example of Implementing the Query Function for a Database Driver
Example of Obtaining Database Connection
Example of Deleting and Creating a Table
Example of Executing Database Operation Statements
Example of Executing Transaction Control Statements
std.ffi.python Package
❱
ffi.python Package
Constants and Variables
Interface
Class
Exception Class
std.format Package
❱
format Package
Interface
Sample Tutorial
❱
format Usage Example
std.fs Package
❱
fs Package
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Directory Example
File Example
FileInfo Example
Path Example
std.io Package
❱
io Package
Interface
Class
Enumeration
Exception Class
Sample Tutorial
❱
BufferedInputStream Example
BufferedOutputStream Example
ByteArrayStream Example
ChainedInputStream Example
MultiOutputStream Example
StringReader Example
StringWriter Example
std.log Package
❱
log Package
Interface
Class
Enumeration
Sample Tutorial
❱
Log Printing Example
std.math Package
❱
math Package
Function
Interface
Enumeration
Sample Tutorial
❱
Example of Basic Mathematical Operations
std.math.numeric Package
❱
math.numeric Package
Function
Enumeration
Struct
Sample Tutorial
❱
Example of Basic Mathematical Operations of BigInt
Example of Basic Attributes of BigInt
Example of Size Comparison of BigInt
Example of Basic Mathematical Operations of Decimal
Example of Basic Attributes of Decimal
Example of Size Comparison of Decimal
std.objectpool Package
❱
objectpool Package
Class
std.os Package
❱
os Package
Function
std.os.posix Package
❱
os.posix Package
Constants and Variables
Function
Sample Tutorial
❱
Operations Related to File Content
Operations Related to File Information
Obtaining System Information
Operations Related to Process Information
std.os.process Package
❱
os.process Package
Class
Enumeration
Exception Class
Sample Tutorial
❱
Operations Related to the Current Process
Deleting the Subprocess Executable File after the Subprocess Ends on Windows
Operations Related to Any Process
Operations Related to Subprocesses
std.overflow Package
❱
overflow Package
Interface
Exception Class
Sample Tutorial
❱
Example of the Returning Option Policy
Example of the Saturating Policy
Example of the Throwing Exception Policy
Example of the Most Significant Bit Truncation Policy
std.random Package
❱
random Package
Class
std.reflect Package
❱
reflect Package
Function
Class
Enumeration
Exception Class
Sample Tutorial
❱
Usage of Annotation
Usage of Dynamic Loading
Usage of Member Information
Usage of TypeInfo
std.regex Package
❱
regex Package
Class
Struct
Exception Class
Sample Tutorial
❱
Regex Example
std.runtime Package
❱
runtime Package
Function
Struct
std.socket Package
❱
socket Package
Constants and Variables
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Usage Cases of Attribute Configuration
TCP Usage Example
UDP Usage Example
UNIX Usage Example
UnixDatagram Usage Example
std.sort Package
❱
sort Package
Function
Interface
Sample Tutorial
❱
Sorting Arrays
std.sync Package
❱
sync Package
Constants and Variables
Function
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Usage of Atomic, Monitor, and Timer
std.time Package
❱
time Package
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
DateTime Comparison
Conversion Between DateTime and String
Obtaining the Date-Time Information
Local Time of a Time in Different Time Zones
Using MonoTime for Timing
std.unicode Package
❱
unicode Package
Interface
std.unittest Package
❱
unittest Package
Function
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Getting Started with Unittest
Basic Concepts and Usage of Unittest
Parameterized Test
Dynamic Test
std.unittest.mock Package
❱
unittest.mock Package
Function
Interface
Class
Enumeration
Exception Class
Sample Tutorial
❱
Getting Started with the Mock Framework
Basic Concepts and Usage of Mock
Guide to Stubs
Verification API of Mock Framework
std.unittest.mock.mockmacro Package
❱
unittest.mock.mockmacro Package
Macro
std.unittest.testmacro Package
❱
unittest.testmacro Package
Macro
std.unittest.common Package
❱
unittest.common Package
Function
Interface
Class
Enumeration
std.unittest.diff
❱
unittest.diff Package
Interface
std.unittest.prop_test
❱
unittest.prop_test Package
Function
Interface
Class
Struct
compress Module
❱
compress Module
compress.zlib Package
❱
zlib Package
Class
Enumeration
Exception Class
Sample Tutorial
❱
Compression and Decompression of Data in Deflate Format
Compression and Decompression of Data in Gzip Format
crypto Module
❱
crypto Module
crypto.crypto Package
❱
crypto Package
Class
Struct
Exception Class
Sample Tutorial
❱
SecureRandom Usage
SM4 Usage
crypto.digest Package
❱
digest Package
Class
Struct
Exception Class
Sample Tutorial
❱
digest Usage
crypto.keys Package
❱
keys Package
Class
Enumeration
Struct
Sample Tutorial
❱
Usage of keys
crypto.x509 Package
❱
x509 Package
Type Alias
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
x509 Usage
encoding Module
❱
encoding Module
encoding.base64 Package
❱
base64 Package
Function
Sample Tutorial
❱
Conversion Between Byte Arrays and Base64
encoding.hex Package
❱
hex Package
Function
Sample Tutorial
❱
Conversion Between Byte Arrays and Hex
encoding.json Package
❱
json Package
Interface
Class
Enumeration
Exception Class
Sample Tutorial
❱
JsonArray Usage Example
Conversion between JsonValue and String
Conversion Between JsonValue and DataModel
encoding.json.stream Package
❱
json.stream Package
Interface
Class
Enumeration
Struct
Sample Tutorial
❱
Deserialization Using Json Stream
Serialization Using Json Stream
WriteConfig Usage Example
encoding.url Package
❱
url Package
Class
Exception Class
Sample Tutorial
❱
Form Construction and Usage
Usage of the URL Parsing Function parse
fuzz Module
❱
fuzz Module
fuzz.fuzz Package
❱
fuzz Package
Constants and Variables
Class
Exception Class
Sample Tutorial
❱
Testing the Function of Guessing Characters
Usage of the cj-fuzz Function by CJVM
Testing by Using the DataProvider Function
Using FakeCoverage to Prevent Abnormal Termination of Fuzzing in DataProvider Mode
Printing the Usage of Fuzz
Experimental Feature - Coverage Information Printing
Solution to Missing Stack Backtracking
log Module
❱
log Module
log Package
❱
log Package
Type Alias
Function
Interface
Class
Struct
Exception Class
Sample Tutorial
❱
Log Printing Example
net Module
❱
net Module
net.http Package
❱
http Package
Function
Interface
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
client
cookie
log
server
webSocket
net.tls Package
❱
tls Package
Class
Enumeration
Struct
Exception Class
Sample Tutorial
❱
Certificate and Public Key on the Server Stored in the Same File
Client Example
Certificate Hot Update
Server Example
serialization Module
❱
serialization Module
serialization.serialization Package
❱
serialization Package
Function
Interface
Class
Exception Class
Sample Tutorial
❱
class Serialization and Deserialization
HashSet and HashMap Serialization
Tools Guide
❱
IDE Plug-in User Guide
Command Line Tool Usage Guide
❱
Package Manager
Debugging Tool
Formatting Tool
Coverage Statistics Tool
Performance Analyzer
Exception Stack Restoration Tool
Light
Rust
Coal
Navy
Ayu
I/O Processing Streams