Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

extend type

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Purpose

extend type is the normative mechanism for adding members to an existing type. It replaces prior impl-block extension patterns for user and generated code.

Syntax

extend type Account
{
pub unit Deposit(f32 amount)
{
account.balance += amount;
}
}

The extended type name (Account) must refer to an in-scope type declaration. The body may declare methods and other members allowed by the type system for that target.

Access rules

  • Members inside extend type may access public members of the extended type only.
  • Private member access is forbidden inside extend type bodies.
  • extend type does not bypass module visibility; extension sites must satisfy normal import and visibility rules.

Compiler mods

Generator contracts may emit extend type blocks as typed AST contributions. Generated extensions follow the same access and visibility rules as hand-authored extensions.