The new Command and Complex Types

SOP Lang Pipeline extends beyond simple variable declarations and commands through its support for Complex Types, instantiated using the new command. These Complex Types represent more structured entities and support both data fields and methods.

Conceptual Role

Complex Types serve a dual role: they organise related commands and data into logical namespaces, and they function similarly to instances in object-oriented paradigms. Internally, these objects can possess fields and methods scoped to the instance.

In runtime terms, object methods are invoked through dot syntax and participate in the same dependency graph model as any other command execution.

Current Type Families

Complex Types represent SOP-Lang Pipeline entities that are both data carriers and behaviour containers. This dual role allows object-like modelling while preserving reactive dependency semantics.

  • Document Type: document metadata and chapter/paragraph command APIs.
  • Table Type: tabular rows, computed columns, upsert and exwipe flows.
  • Set Type: variable collections with map/filter/reduce methods.
  • Workflow Type: multi-form question/answer orchestration.
  • Chat Type: context and history driven conversation orchestration.
  • Form Type: structured field definitions for workflow interactions.
  • Folder Type: path resolution and filesystem change detection through newer.

Object-Style Invocation

Complex-type methods are invoked with dot syntax, such as @result table.upsert ... or @value set.getAt 0. This style preserves the same dependency-driven execution model while offering a more structured interaction layer.

@t1 new Table "c1" "c2" "c3"
@row t1.upsert "a" 2 5

@world0 := "World 0"
@world1 := "World 1"
@worldSet new Set world0 world1
@firstWorld worldSet.first

@specsFolder new Folder "./specs"
@specsChanged !specsFolder.newer "./specs"

new and lookup

Complex Type instances are created with new. Existing persistent instances can be resolved with lookup when the type implements lookup semantics. This pairing allows SOP-Lang Pipeline code to work both with newly instantiated entities and with previously stored entities.

@agent1 new FakeAgent 007Agent
@agent2 lookup FakeAgent Einstein
@resp1 agent1.ask "What is your name?"
@resp2 agent2.ask "What is your name?"

Because these objects live in the same graph, method calls, aliases, and downstream assignments still follow the same recomputation rules as primitive variables and expression commands. Detailed command-level semantics for new and lookup are documented in runtime command chapter.