cangjie-type-system

Analyze Cangjie type systems for subtyping, variance, and conversions.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers understand and reason about the Cangjie language's type system, including subtyping, variance, and explicit conversions, to write safer, more robust code.

Core Features & Use Cases

  • Understand subtype relations (class inheritance, interface implementation, tuple and function types) and fundamental type relations (Nothing, Any, Object).
  • Learn and apply variance rules for built-in types and generics, including covariance for tuples and contravariance for function parameters.
  • Master explicit type conversions with is and as operators, and use type aliases to simplify complex type signatures.
  • Use cases include designing type hierarchies, implementing interfaces, and performing type-safe casts in static languages with a Cangjie-like type system.

Quick Start

Create a small function that demonstrates checking a Derived instance with is and safely casting with as.

Frequently Asked Questions about cangjie-type-system

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

FAQPage Schema
How do I check type relations and perform safe casts in Cangjie?

Cangjie type checking and safe casting use the is and as operators. The is operator checks subtype relations for class inheritance and interface implementation, while as performs explicit type conversions to ensure type-safe casts.

What are the variance rules for generics and function types in the Cangjie type system?

Variance rules in the Cangjie type system define covariance for tuples and contravariance for function parameters. Applying these variance behaviors ensures correct generic constructs and type hierarchies during static analysis.

How do I simplify complex type signatures in Cangjie?

Cangjie simplifies complex type signatures using type aliases. Defining type aliases creates alternate names for intricate types, reducing code verbosity and clarifying generic constructs.

What fundamental type relations exist in Cangjie for static analysis?

Fundamental type relations in Cangjie include Nothing, Any, and Object. Understanding these base relations and subtype rules for tuples and function types is required for accurate compiler design and static analysis.

Can I analyze Cangjie subtyping rules for custom class hierarchies and interfaces?

Yes, Cangjie subtyping rules apply to custom class inheritance and interface implementation. Reasoning about these subtype relations ensures that type hierarchies and generic constructs remain type-safe during static analysis.

When should I review variance behavior before implementing generic constructs in Cangjie?

Review variance behavior before implementing generic constructs when mixing tuples and function types. Checking covariance and contravariance rules prevents invalid subtyping and ensures type-safe compiler design.