Docs@skmtc/core

Projections and snippets

TYPE

LangSnippetConstructor

@skmtc/core 0.63.4

The constructor contract a language's snippet base class must satisfy to be used as the base of a projection-base factory (toModelProjectionBase(TsSnippet, …)). It is where language enters the DSL class hierarchy; SnippetBase itself stays language-blind.

lang is static-only: its reader is the Drivers, which need the peer's language before constructing the value (cache-hit path) and read it ephemerally at each use site (projection.lang). Statics inherit through class expressions, so every projection class built on the base exposes it with no re-declaration. There is no instance slot - the register paths delegate to the language package's register function, which names its own classes directly.

The INSTANCE type stays the concrete SnippetBase: a core factory generic over the base's instance type cannot type-safely extend it (TS2415/TS2545 - see the scratch in notes/lang/14), and the price would be that language-specific instance members are type-erased on projection classes. The static lang is the neutral Lang - the engine reads it language-blind; each lang package's concrete declaration-type vocabulary is a fixed fact of that package, never recovered through this type.

Signature

import type { LangSnippetConstructor } from '@skmtc/core'

type LangSnippetConstructor = (new (args: SnippetBaseArgs) => SnippetBase) & { ... }

Properties

lang, Lang required