cangjie-type-system

Explain Cangjie type system rules for subtyping, variance, conversions, and aliases.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill clarifies the intricacies of the Cangjie programming language's type system, helping developers understand how types relate, transform, and are defined.

Core Features & Use Cases

  • Subtyping: Explains class inheritance, interface implementation, and how tuple/function types form subtype relationships.
  • Variance: Details covariance, contravariance, and invariance in generic and built-in types.
  • Type Conversion: Covers explicit conversions for numeric types, Runes, and safe casting using is and as operators.
  • Type Aliases: Demonstrates how to create aliases for existing types to improve code readability.
  • Use Case: When encountering complex generic type definitions or needing to perform safe type checks and conversions in Cangjie, this Skill provides the necessary rules and examples.

Quick Start

Explain the subtyping rules for function types in Cangjie.

Frequently Asked Questions about cangjie-type-system

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

FAQPage Schema
How does subtyping work for function and tuple types in Cangjie?

Subtyping in Cangjie defines relationships through class inheritance and interface implementation, extending to tuple and function types. It establishes how derived types substitute base types, ensuring safe static type assignments during compilation.

How do I perform safe type conversions and casting in Cangjie?

Safe type conversions in Cangjie use the `is` operator for type checking and the `as` operator for explicit casting. This mechanism handles numeric types, Runes, and generic objects securely.

What are the variance rules for generic types in Cangjie?

Variance rules in Cangjie dictate covariance, contravariance, and invariance behaviors for generic and built-in types. These rules determine valid subtyping relationships between complex parameterized types.

Can I create type aliases to improve code readability in Cangjie?

Type aliases in Cangjie allow developers to create alternative names for existing types. This improves code readability and simplifies complex generic type definitions without creating new types.

Why does my generic type definition fail type checking in Cangjie?

Generic type checking failures often stem from violating Cangjie's variance rules or subtyping constraints. Ensure your generic parameters correctly apply covariance or contravariance rules for interface implementations.

Do I need prior static typing knowledge to use the Cangjie type system?

Understanding the Cangjie type system requires foundational knowledge of static typing principles and language-specific syntax. This background is necessary for manipulating generic definitions and explicit type casting.