cangjie-enum

Define Cangjie enums with named constructors, recursion, and Equatable integration.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Understanding and implementing Cangjie-based enums with robust features like multiple constructors, non-exhaustive variants, recursion, and Equatable integration can be error-prone. This Skill consolidates rules and patterns to enable correct, maintainable enum definitions.

Core Features & Use Cases

  • Enum definition with named constructors (with and without parameters) and support for recursive types.
  • Handling conflicting constructor names and reserved keywords via escaping or renaming.
  • Non-exhaustive enums using a final ... constructor, and ensuring type-safe usage with pattern matching.
  • Inclusion of member functions, operators, and properties, plus optional Equatable derivation guidance.
  • Real-world scenarios include designing a type-safe expression tree or a color enum with runtime checks.

Quick Start

Define a new Cangjie enum with named constructors and demonstrate one recursive usage example.

Frequently Asked Questions about cangjie-enum

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

FAQPage Schema
How do I define recursive enums in Cangjie programming language?

Cangjie enums support recursive types by defining named constructors that reference the enum type itself. This allows you to safely model complex recursive data structures like expression trees using pattern matching.

How do I handle conflicting constructor names and reserved keywords in Cangjie enums?

Cangjie enums handle conflicting constructor names and reserved keywords via escaping or renaming. This ensures your enum definitions remain valid and maintainable without encountering syntax conflicts.

Can I use pattern matching with non-exhaustive Cangjie enums?

Cangjie enums support non-exhaustive variants using a final `...` constructor. This ensures type-safe usage with pattern matching by allowing your code to gracefully handle unforeseen variants added in the future.

How do I implement Equatable integration for Cangjie enums?

Cangjie enums support optional Equatable derivation guidance. This allows you to implement equality checks for enum instances, enabling runtime comparisons for use cases like color enums with runtime checks.

What is the best way to overload constructors in Cangjie enums?

Cangjie enums specify constructor overloading rules to define multiple named constructors with or without parameters. Adhering to these construct validity rules ensures correct, maintainable enum definitions.

Do Cangjie enums support member functions and properties?

Cangjie enums allow the inclusion of member functions, operators, and properties. This enables you to attach behavior directly to enum types and document their functionality clearly within your codebase.