Spec
@Js
const mixin Spec : Dict
Xeto data specification.
Spec dict representation:
- id: Ref "lib:{qname}"
- spec: Ref "sys::Spec"
- base: Ref to base type (types only)
- type: Ref to slot type (slots only)
- effective meta
Parent spec which contains this spec definition and scopes name
Parent library for spec
Get all the effective globals including inherited
Does meta have maybe tag
Is this a slot or global under a parent
Convenience for slots.get
Type of this spec
Get a map with all the inherited slots and globals
Return fully qualified name of this spec
Convenience for members.get
Identifier for a spec is always its qualified name
Get the declared children slots
Is this a slot under a parent
Return if this is a spec that inherits from sys::Choice
Convenience for slotsOwn.get
Is the base sys::Enum
Globals declared by this spec
Return if this a function spec
Is this a top level mixin spec
Is this a top level type spec
Return enum item meta
Get a map with all the declared slots and globals
Get my own declared meta-data
Get the effective inherited children slots
Return function specific APIs
Return if this spec inherits from that from a nominal type perspective
Get my effective meta
Is this a global slot under a parent
Base spec from which this spec directly inherits its meta and slots
Call the given function on this spec and every spec that it inherits from up to sys::Obj
abstract Spec? base()
Base spec from which this spec directly inherits its meta and slots. Returns null if this is sys::Obj itself.
abstract Void eachInherited(|Spec| f)
Call the given function on this spec and every spec that it inherits from up to sys::Obj. Any sys::And compound types are iterated, but not sys::Or types. Note it is possible that the given function may be called on the same spec twice.
abstract SpecEnum enum()
Return enum item meta. Raise exception if isEnum is false.
abstract SpecFunc func()
Return function specific APIs. Raise exception if isFunc is false.
abstract SpecMap globals()
Get all the effective globals including inherited. Note that some of the globals may be hidden by slots.
abstract SpecMap globalsOwn()
Globals declared by this spec.
abstract Ref id()
Identifier for a spec is always its qualified name
abstract Bool isChoice()
Return if this is a spec that inherits from sys::Choice. If this spec inherits from a choice via a And/Or type then return false. See Namespace.choice to access SpecChoice API.
abstract Bool isEnum()
Is the base sys::Enum
abstract Bool isFunc()
Return if this a function spec
abstract Bool isGlobal()
Is this a global slot under a parent
abstract Bool isMaybe()
Does meta have maybe tag. Maybe slots are optional
abstract Bool isMember()
Is this a slot or global under a parent
abstract Bool isMixin()
Is this a top level mixin spec
abstract Bool isSlot()
Is this a slot under a parent
abstract Bool isType()
Is this a top level type spec
abstract Bool isa(Spec that)
Return if this spec inherits from that from a nominal type perspective. Nonimal typing matches any of the following conditions:
- if
thatmatches one ofthisinherited specs via base - if
thisis maybe and that isNone - if
thisisAndandthatmatches anythis.ofs - if
thisisOrandthatmatches allthis.ofs(common base) - if
thatisOrandthismatches any ofthat.ofs
abstract Lib lib()
Parent library for spec
abstract Spec? member(Str name, Bool checked)
Convenience for members.get.
abstract SpecMap members()
Get a map with all the inherited slots and globals.
abstract SpecMap membersOwn()
Get a map with all the declared slots and globals.
abstract Dict meta()
Get my effective meta; this does not include synthesized tags like spec
abstract Dict metaOwn()
Get my own declared meta-data
abstract Str name()
abstract Spec? parent()
Parent spec which contains this spec definition and scopes name. Returns null for top level specs in the library.
abstract Str qname()
Return fully qualified name of this spec:
- Type specs will return "foo.bar::Baz"
- Global slots will return "foo.bar::baz"
- Type slots will return "foo.bar::Baz.qux"
- Derived specs will return "derived123::{name}"
abstract Spec? slot(Str name, Bool checked)
Convenience for slots.get.
abstract Spec? slotOwn(Str name, Bool checked)
Convenience for slotsOwn.get.
abstract SpecMap slots()
Get the effective inherited children slots.
abstract SpecMap slotsOwn()
Get the declared children slots.
abstract Spec type()
Type of this spec. If this spec is a top level type then return self.