cangjie-const

Explain const variable and function declarations in the Cangjie language.

4|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-const-junjiechen0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-const
Source: https://github.com/JunjieChen0/NJUST/tree/main/.njust-ai/skills/cangjie-const
Command: npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-const-junjiechen0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers and students understand and apply const constructs in the Cangjie language, clarifying when and how to declare const variables and const functions, and how compile-time evaluation works.

Core Features & Use Cases

  • Clarifies const declaration syntax for variables and functions in Cangjie.
  • Demonstrates compile-time evaluation rules and const init usage with examples.
  • Provides practical guidance for integrating const constructs in real-world projects.

Quick Start

Show a minimal const Point example in Cangjie with x and y fields and a const initializer.

Frequently Asked Questions about cangjie-const

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

FAQPage Schema
How do I declare const variables and const functions in the Cangjie language?

To declare const variables and const functions in the Cangjie language, you use specific syntax rules that enforce compile-time evaluation and immutability. This Skill demonstrates the exact declaration syntax and provides minimal examples like a const Point initializer.

How does compile-time evaluation work for const init usage in Cangjie?

Compile-time evaluation for const init usage in Cangjie calculates variable and function values during the compilation process rather than at runtime. This mechanism ensures true immutability and optimizes performance by resolving constants before execution.

When should I apply const constructs in real Cangjie projects?

You should apply const constructs in real Cangjie projects when you need guaranteed immutability and compile-time evaluation. Using const is ideal for fixed configuration values and pure functions that do not rely on runtime state.

What is the difference between const variables and regular immutable variables in Cangjie?

Const variables in Cangjie differ from regular immutable variables because their values must be fully evaluable at compile time. Regular immutable variables are fixed at runtime, whereas const variables are resolved entirely during compilation.

Can I use Cangjie const functions for complex compile-time calculations?

Cangjie const functions support compile-time evaluation, but they must adhere to specific language syntax rules. They are suitable for pure calculations like initializing a const Point with x and y fields, though complex runtime-dependent logic remains restricted.