cangjie-const

Explain Cangjie const variables, expressions, and functions with compile-time evaluation.

1|Updated Mar 14, 2026
One-click install
npx skills add https://github.com/SunriseSummer/CangjieDocValidator --skill cangjie-const
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-const
Source: https://github.com/SunriseSummer/CangjieDocValidator/tree/main/.github/skills/const
Command: npx skills add https://github.com/SunriseSummer/CangjieDocValidator --skill cangjie-const

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers understand and correctly implement Cangjie language's const variables, const expressions, and const functions, ensuring compile-time safety and performance optimizations.

Core Features & Use Cases

  • Const Variables: Learn how to declare and use compile-time constants with deep immutability.
  • Const Expressions: Understand which expressions can be evaluated at compile time.
  • Const Functions: Discover how to write functions that can be evaluated at compile time or runtime.
  • Const Init: Master the creation of immutable struct/class instances usable in compile-time contexts.
  • Use Case: Optimize performance-critical code sections by leveraging compile-time computations for constants and function calls.

Quick Start

Use the cangjie-const skill to learn about declaring a const variable in Cangjie.

Frequently Asked Questions about cangjie-const

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I declare a const variable in Cangjie for compile-time evaluation?

A const function in Cangjie is a function that can be evaluated at compile time or runtime. You write them to perform compile-time computations for constants, enabling performance optimizations in critical code sections.

What is the difference between const and let or var in Cangjie?

In Cangjie, const declares deeply immutable values evaluated at compile time, whereas let and var handle runtime immutability and mutability. Using const shifts computation to compile time, ensuring safety and optimization.

How do I create immutable struct or class instances for compile-time contexts in Cangjie?

You create immutable struct or class instances for compile-time contexts using Cangjie's const init constructors. This allows instances to be usable as constants in compile-time evaluations and static contexts.

Can Cangjie const functions implement interfaces and support overload resolution?

Yes, Cangjie const functions and const init constructors can participate in interface implementations and overload resolution. This allows compile-time evaluation logic to integrate with object-oriented design patterns.

What expressions can be evaluated at compile time as const expressions in Cangjie?

Cangjie const expressions include operations evaluated at compile time using const variables and const functions. They must adhere to specific language rules to ensure safe compile-time computation and initialization.