रेंडरिंगhi

प्रकार

Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.

Declares a type alias.

Aliases: type

Syntax: प्रकार <name> = <type>

Category#

type

Examples#

radix/corpus/typus/typus.fab (canonical · keyword)#

Declares a type alias.

# =============================================================================
# प्रकार — Declares a type alias.
# =============================================================================
#
# What this teaches:
#   • Type aliases — `प्रकार` for creating shorthand names for complex types
#   • Generic aliases — aliases can wrap generic types like `सूची<T>` and `तालिका<K,V>`
#
# Common mistakes:
#   • confusing प्रकार (type alias) with वर्ग (nominal type) — प्रकार creates a transparent alias, not a new type
#
# See also: वर्ग, अनुबन्ध, वस्तु, ∪
# =============================================================================




# Type aliases
#
# प्रकार Nomen = Typus
#
# GRAMMAR:
#   typeAliasDecl :← 'प्रकार' ident '=' typeExpr
#
# EXPECTED OUTPUT:
#   42, "Marcus", सत्य, ["Gaius", "Lucius", "Titus"], [100, 95, 87]

# --- Primitive type aliases ---

type Signum = int
type Cognomen = string
type Viget = bool

# --- Generic type aliases ---

type Nomina = list<string>
type Puncta = list<int>
type Index = map<string, int>

# Nullable type alias (canonical T ∪ शून्य_मान form)
type NomenOptivum = string ∪ none

main {
    # Using primitive aliases
    const Signum signum ← 42
    const Cognomen cognomen ← "Marcus"
    const Viget viget ← true

    print signum
    print cognomen
    print viget

    # Using generic aliases
    const Nomina sodales ← ["Gaius", "Lucius", "Titus"]
    print sodales

    const Puncta puncta ← [100, 95, 87]
    print puncta
}