Expand description
First-party standard adapters embedded in the toolchain (v0.17 §4.2).
The bynk conformance surface is shipped with the compiler rather than
authored by the user. When a project consumes bynk, the driver injects the
adapter source below as a synthetic unit and provides its binding for the
selected Platform. The bynk root namespace is reserved
(bynk.namespace.reserved) so user code can never collide with it.
Enums§
- Platform
- The deploy platform — a selection axis distinct from the
--target {bundle,workers}emit mode (§6.2). It chooses whichbynk-<platform>.tsbinding is linked for thebynksurface. v0.17 shippedcloudflare; v0.18 addsnode, making the axis observable (and giving v0.19’s platform-lock enforcement a second platform to fire against).
Constants§
- BYNK_
ADAPTER_ SRC - The reserved
bynkconformance-surface adapter (env-free core). It has nobindingclause — the toolchain supplies one per platform (seePlatform::bynk_binding_source). - BYNK_
LIST_ SRC bynk.list— combinators over theListkernel (fold,prepend,length,get,foldEff), written in ordinary Bynk (decision 0034): the first real consumer of v0.20a generics, lambdas, and effectful traversal. Order-preserving combinators build withfold+prependand a finalreverse— O(n) builds, neverappend(which would be O(n²) over the array lowering).- BYNK_
LOCALE_ SRC bynk.locale— the bundle-freerender/renderArghelpers and themessage/withText/withWhole/withNum/withMomentbuilder API (slice 1:renderformatscodeplus a deterministic sorted-by-key rendering ofparams; no lookup, no locale-dependent behaviour).uses bynk.locale.typesfor the types its own signatures name.- BYNK_
LOCALE_ TYPES_ SRC bynk.locale.types—LocaleTag,MessageArg,Message: a dependency-free leaf (nousesof its own) so any consumer, including thebynkadapter itself, can reach these types without also reachingbynk.locale’s value-level API.- BYNK_
MAP_ SRC bynk.map— combinators over theMapkernel (empty,insert,get,keys,length).fromListis deliberately absent: Bynk has no pair type to spell aList[(K, V)]with, so map construction isMap.empty()- BYNK_
STRING_ SRC bynk.string— Bynk-written helpers over the v0.22a string kernel (concat, theListfold, and theOptionkernel methods). The kernel itself is compiler built-in (ADR 0046); only derived helpers live here.joinfolds toOption[String]so empty-string elements are joined faithfully (a bare""accumulator could not tell “nothing yet” from “first element was empty”).- BYNK_
SURFACE_ CAPABILITIES - The capabilities the env-free
bynksurface exports (itsexports capability { … }line inbynk.bynk). First-party symbols live on synthetic files and are excluded from the binding index, so the unknown-name quick-fix (#852) offeringconsumes bynk { … }needs this explicit list. Kept in sync with the adapter source bybynk_surface_capabilities_match_the_adapter. - BYNK_
UNIT - The unit name of the reserved first-party surface adapter.
- CLOUDFLARE_
ADAPTER_ SRC - The first-party Cloudflare platform adapter (v0.19): the platform’s real
infrastructure capabilities, as they are — no portable intersection
(decision 0016). The v0.19 surface was the minimal, collection-free
Kv(decision 0023); v0.23 adds thelistdrain andputTtl(0050/0051); structured values are v0.22-codec composition, andQueueremains its own future increment. Like thebynksurface it has nobindingclause — the toolchain supplies the binding. - CLOUDFLARE_
BINDING_ FILENAME - The output path of the Cloudflare platform adapter’s binding module,
beside the adapter’s emitted
bynk/cloudflare.ts(distinct from thebynksurface’s per-platformbynk-cloudflare.ts). - CLOUDFLARE_
UNIT - The unit name of the first-party Cloudflare platform adapter (v0.19,
decision 0026): inside the reserved
bynk.*prefix, so no separate reservation rule is needed. The surface unitbynkstays the portability marker;bynk.<platform>units are the platform-locked ones. - FIRSTPARTY_
SOURCES - Every first-party
.bynksource, paired with its unit name — the single list every consumer iterates: hover (describe_firstparty_symbol), completion (EMBEDDED_UNITS), and the parse guard (every_first_party_source_parses). Before this list each consumer kept its own hand-maintained copy, andbynk.locale/bynk.locale.typeswere added to none of them — so the whole locale surface hovered as nothing and was absent from completion (#901). Add a first-party commons here once; thefirstparty_sources_cover_every_src_constdrift guard (bynkc/tests/firstparty_sources.rs) fails if a*_SRCconst is left out. - KV_
BINDING_ NAME - The fixed Worker binding name for the Kv namespace (decision C1, v0.19):
one namespace, one
[[kv_namespaces]]stanza, oneenv.KVfield. - LIST_
UNIT - The unit names of the first-party collection commons (v0.20b): the
Bynk-written combinator stdlib over the built-in
List/Mapkernel. Inside the reservedbynk.*prefix; injected whenuses-imported. - LOCALE_
TYPES_ UNIT - Inside the reserved
bynk.*prefix; injected whenuses-imported. Alsouses-imported by thebynkadapter itself, to givecapability Locale’scurrent() -> Effect[LocaleTag]a type to name (an adapter mayusesa commons; a commons cannot in turn reference an adapter). Split out ofbynk.locale(locale-negotiation-slice-2 follow-up, #886) specifically so a context can reachLocaleTagwithout also pulling inbynk.locale’s ownrender— which previously collided with a message-bundle commons’s own synthesisedrender(ADR 0272) the moment a context needed both. - LOCALE_
UNIT - Inside the reserved
bynk.*prefix; injected whenuses-imported by application code (a message-bundle commons, ADR 0272) — never directly by thebynkadapter itself any more (seeLOCALE_TYPES_UNIT). - MAP_
UNIT - STRING_
UNIT - Inside the reserved
bynk.*prefix; injected whenuses-imported.
Functions§
- cloudflare_
binding_ source - The toolchain-supplied binding for the Cloudflare platform adapter.
- platform_
of - v0.19 decision 0024: which first-party units are platform-native —
consuming one locks its deployment unit to the returned platform. This is
the metadata that drives effective-platform computation,
envresource typing, andwrangler.tomlstanza derivation; no user-facing marker syntax exists (additive later, when third-party platform adapters become a goal). - provider_
takes_ env - v0.18 decision 0021 / v0.19 decision 0025: which first-party provider
classes take the Worker
envas a constructor argument, keyed by (unit, provider class).SecretsProvideraccepts an optional env with aglobalThisprobe fallback;WorkersKvrequires env on use — KV namespaces exist only on the Workerenv, never onglobalThis.