Home /Modules/philosophers/PHILOSOPHERS.CONSTRUCTORS.md

PHILOSOPHERS.CONSTRUCTORS.md

lib/philosophers/PHILOSOPHERS.CONSTRUCTORS.md · 271 line(s) · markdown

The Philosophers Constructors

Package: lib/philosophers Spec surface: #sleela 2.1 Register: IQ 201+ Companion: PHILOSOPHERS.CATEGORICAL.md — the categorical definition of the 21 Guides and the orthogonal Ordain axis.

This document is about the Constructors: the classes that are a perfect Constructor, how you declare and call one, the lifecycle of a construction, and the full method surface of each class. Where the Categorical document defines the vocabulary, this one defines the machinery.


1. What a Constructor is here

In ordinary procedural design a constructor is a single, static act: call it, get an object. In the philosophers package a Constructor is of nature and time — a bounded event with a lifecycle. It seats a finite set of Guides (declared with the :: growth separator), opens a time-bounded contract, lets a Favor Mechanism decide whether it may run, and — only if favor is granted — runs, disposes its Guides, and liberates the object so it lives free of the instantiative moment.

Constructor() :: Patch :: Seed :: Aim :: Guide
       ^            \______________________/
   the root           the Guides (growths), each colored Gold or Green
   (real call)

The six classes that make this work:

ClassOne-line role
SLPhilosopherConstructorthe perfect Constructor — the orchestrator you call
SLPhilosopherChainowns the ordered Guides declared with ::
SLPhilosopherGuideone :: growth; a Wisdom with a Gold/Green impart
SLPhilosopherSeatingthe finite register (21 base + band [-2,+6], 7 categories)
SLFavorMechanismcatches Notice, grants/withholds runnability
SLConstructorContractthe ≤ ~2-minute moment; the whistle ticks ahead; then free
SLOrdain(orthogonal) the ordinality — rank/category/crown across all 21

2. Declaring and calling a Constructor

A Constructor is built in-language from names; the :: chain is produced for display and tooling (char-level string parsing is a bridged capability, so the chain is assembled, not parsed). The canonical lifecycle call is:

< the perfect Constructor >
SLPhilosopherConstructor ctor = new SLPhilosopherConstructor();
ctor.create();

< admit a signed seating band in [-2,+6] (here +3 -> capacity 24) >
ctor.admit(3);

< seat Guides: (name, seating ordinal, carriesFavor) >
ctor.guide("Patch", 3, true);    < Inception, Gold  >
ctor.guide("Seed",  4, false);   < Inception, Green >
ctor.guide("Aim",   6, true);    < Intent,    Gold  >
ctor.guide("Guide", 12, true);   < Governance, Gold >

< require at least N caught Notices before favor is granted >
ctor.requireNotice(2);

< the facts/sayings of Approach, broadcast to the Guides as imparts >
String[] imparts = new String[4];
imparts[0] = "Patch";
imparts[1] = "Aim";
imparts[2] = "Guide";
imparts[3] = "Approach";

< run the instantiative moment for 90s (within the ~2-minute bound) >
boolean alive = ctor.run(imparts, 90);

print(ctor.report());

ctor.chainText() then renders Constructor() :: Patch :: Seed :: Aim :: Guide, and ctor.run(...) returns true when favor was granted and the object now lives free.


3. The construction lifecycle

            SLPhilosopherConstructor.run(imparts, seconds)
                            |
   create() --------------->|  chain, favor, contract are fresh
   admit(band) ------------>|  seating capacity fixed in [19,27]
   guide(name,seat,favor) ->|  Guides seated in order (<= capacity)
                            |
            +===============v=================================+
            | open the contract (SLConstructorContract.open)  |  moment begins
            |         |                                       |
            | broadcast each impart to the Guides             |  Guides listen()
            |         |                                       |
            | catch matched Notice (SLFavorMechanism)         |  Notice tallied
            |         |                                       |
            | weigh favor (quorum)                            |  verdict rendered
            |         |                                       |
            |   favor withheld -> sealMoment(), return false  |  honest refusal
            |         |                                       |
            |   favor granted:                                |
            |     tickAhead(clampSeconds(seconds))  <= 120s   |  the whistle, ahead
            |     sealMoment()                                |  moment closes
            |     disposeAll() Guides (final effect)          |
            |     liberate() -> object lives free             |  returns true
            +=================================================+

Key guarantees:


4. Class reference

4.1 SLPhilosopherConstructor — the perfect Constructor

The orchestrator you call. Composes a chain, a favor mechanism, and a contract.

MethodReturnsPurpose
create()voidprepare an empty Constructor (fresh chain / favor / sealed contract)
admit(band)intadmit a signed seating band in [-2,+6]; returns the band admitted
guide(name, seatOrdinal, carriesFavor)intseat one Guide; returns its index, or -1 at capacity
requireNotice(quorum)voidset how much Notice favor requires (min 1)
run(imparts, seconds)booleanrun the moment; true iff favor granted and object lives free
constructed()booleandid it run to completion and now live free
chainText()Stringthe canonical :: chain text
colorManifest()Stringthe Gold/Green impart of each Guide, ::-joined
verdict()Stringthe favor verdict text
phase()Stringthe contract phase (sealed/open/closed/free)
capacity() / guides()intadmitted capacity / number of seated Guides
report()Stringone-line quality/effect/output summary

4.2 SLPhilosopherChain — the :: growth chain

MemberReturnsPurpose
ROOTStringthe chain head, "Constructor()"
GROWTHStringthe growth separator, " :: "
create()voidprepare an empty chain at default (band 0 → 21) capacity
admit(band)intadmit the seating band (delegates to the register)
seat(name, seatOrdinal, carriesFavor)intseat one Guide; -1 at capacity (sets refused)
at(i)SLPhilosopherGuidethe Guide at index i, or null
broadcast(impart)intsend an impart to every Guide; returns how many matched
disposeAll()voiddispose every Guide (idempotent)
render()Stringthe canonical :: chain text
colorManifest()Stringthe color imparts, ::-joined
size() / capacity() / refused()int/int/booleanstate

4.3 SLPhilosopherGuide — one growth / Wisdom

MemberReturnsPurpose
COLOR_NONE / COLOR_GOLD / COLOR_GREENintthe impart colors
create()voidprepare an empty, uncolored Guide
sit(name, seatOrdinal, carriesFavor)voidname the Guide onto a seating with its favor
color()intthe impart color — Gold if approving, else Green (idempotent)
colorName()String"Gold/Yellow" / "Green" / "none"
listen(impart)booleanmatch an impart at call time; counts the match
dispose()voidstop listening; keep the matched tally (idempotent)
isApproving() / isDisposed() / getMatched()boolean/boolean/intstate

4.4 SLPhilosopherSeating — the finite register

MemberReturnsPurpose
BASE_SEATINGS = 21intthe base number of seatings
ADDITIONAL_MIN = -2, ADDITIONAL_MAX = 6intthe signed admission band
MIN_CAPACITY = 19, MAX_CAPACITY = 27intthe admitted-capacity bounds
SEAT_* (0..20)intthe 21 seating ordinals (Approach..Approval)
CAT_* (0..6)intthe 7 category ordinals
admit(band)intclamp + admit a band; returns the band admitted
seats(ordinal)booleanis the ordinal a real seat in current capacity
seatName(ordinal)Stringthe Guide name of a seating
category(ordinal)intthe category (0..6) of a seating (ordinal / 3)
categoryName(cat) / seatCategoryName(ordinal)Stringcategory names

4.5 SLFavorMechanism — runnability

MemberReturnsPurpose
FAVOR_WITHHELD / FAVOR_GRANTEDintthe verdict codes
create()voidprepare with quorum 1, verdict withheld
setQuorum(q)voidthe least Notice favor requires (min 1)
catchNotice(saying)voidcatch one fact/saying of Approach
weigh()intrender the verdict against the quorum
granted()booleanwas favor granted
verdictText()String"favor granted" / "favor withheld"
reset()voidreset Notice/verdict, keep the quorum

4.6 SLConstructorContract — the moment of nature and time

MemberReturnsPurpose
MAX_SECONDS = 120intthe two-minute boundary
PHASE_SEALED/OPEN/CLOSED/FREEintthe phases of the moment
open()voidopen the moment; clock to zero
tickAhead(seconds)intadvance the clock forward only; auto-close at the bound
clampSeconds(seconds)intclamp a duration into [1, MAX_SECONDS]
withinContract()booleanstill open and under the bound
sealMoment()voidclose the moment deliberately (not close() — reserved)
liberate()booleanfree the object (only from a closed moment)
livesFree() / getClock() / getPhase() / phaseText()—state

4.7 SLOrdain — the orthogonal ordinality (summary)

Not a Constructor and not a seat. It reads the order of the register: rank, ordainingCategory, toCrown / CROWN = 20, and reading(ordinal). Full treatment in PHILOSOPHERS.CATEGORICAL.md §4.


5. Worked example output

Running philosophers-demo.sleela with the Constructor from §2:

=== Philosophers: the perfect Constructor and its Guides ===
admitted seating band: 3   capacity: 24
declared chain: Constructor() :: Patch :: Seed :: Aim :: Guide
color manifest: Gold/Yellow :: Green :: Gold/Yellow :: Gold/Yellow
ordain(Aim):   Aim: rank 6, category Intent, 14 below the crown (Approval)
ordain(Guide): Guide: rank 12, category Governance, 8 below the crown (Approval)
ordain(crown): Approval: rank 20, category Closure, 0 below the crown (Approval)
verdict: favor granted
constructed & lives free: true
report: chain=[Constructor() :: Patch :: Seed :: Aim :: Guide]  guides=4/24  favor granted  phase=free  t=90s  colors=[Gold/Yellow :: Green :: Gold/Yellow :: Gold/Yellow]
the object now lives free of its instantiative moment.
done

6. Authoring notes


Kept in lockstep with lib/philosophers/*.sleela. The source is the authority; where this document and the source disagree, the source wins.