phino-0.0.166: test-resources/evaluate-packs/joins-a-side-that-raises-through-a-terminator.yaml
# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
# The right side is a copy of 'throw', whose Ī» function 'L_throw' the entry
# names under 'terminators', the way EO raises its 'T' with a message. The
# side goes through the 'evaluate', 'stay', 'symbolize' and 'defer' lines
# untouched, so 'L_throw' is never fired and its message is never turned
# into a symbol. The join takes it for a side that raises, the way it takes
# ā„: it keeps the left side, mints š3 to stand for the raise and names the
# copy of 'throw' in the comment of the 'joined' line (#2263).
symbolic: |
- Ī»: L_fork
terminators: [L_throw]
dataize:
šæ1: $.onšµ
morph:
š1: $.leftšµ
š2: $.rightšµ
evaluate:
š3: š1
š4: š2
stay:
š5: š3
š6: š4
symbolize:
š7: š5
š8: š6
defer:
š9: š7
š10: š8
join:
on: šæ1
left: š9
right: š10
otherwise: L_fork
location: 'Q.x'
input: '⦠throw(message) ⦠⦠λ ⤠L_throw ā§, x ⦠⦠λ ⤠L_fork, onšµ ⦠⦠λ ⤠š1 ā§, leftšµ ⦠⦠k ⦠ā¦ā§, Ļ ā¦ ā¦ Ī» ⤠š2 ā§ ā§, rightšµ ⦠Φ.throw( "bad" ) ā§.Ļ ā§'
result: 'š4:Ī»'
protocol: |
š(Φ.x):
š¼(L_fork):
š»(ξ.onšµ):
šæĀ·1Ā·1 := š»(š1:Ī»)
šæ1Ā·1 := šæĀ·1Ā·1 # š»(ξ.onšµ)
š(ξ.leftšµ):
morphed šĀ·1Ā·1 := ⦠k ⦠ā¦ā§, Ļ ā¦ š2:Ī» ā§
š1Ā·1 := šĀ·1Ā·1 # š(ξ.leftšµ)
š(ξ.rightšµ):
remembered šĀ·1Ā·2 ┠Φ.throw # ⦠message ⦠ā
, Ī» ⤠L_throw ā§
šĀ·1Ā·3 := Φ.throw( message ⦠"bad" )
šĀ·1Ā·4 := ⦠message ⦠"bad", Ī» ⤠L_throw ā§
remembered šĀ·1Ā·4 ā” šĀ·1Ā·2( message ⦠"bad" )
morphed šĀ·1Ā·5 := šĀ·1Ā·4
š2Ā·1 := šĀ·1Ā·4 # š(ξ.rightšµ)
joined š4 := šæ1Ā·1 ? š2 : š3 # where š3 is ā„ raised by šĀ·1Ā·4
šĀ·1Ā·6 := ⦠k ⦠ā¦ā§, Ļ ā¦ š4:Ī» ā§
evaluated šĀ·1Ā·7 := šĀ·1Ā·6 # ⦠λ ⤠L_fork, onšµ ⦠š1:Ī», leftšµ ⦠šĀ·1Ā·1, rightšµ ⦠Φ.throw( "bad" ) ā§
normalized šĀ·0Ā·1 := š4:Ī» # šĀ·1Ā·7.Ļ
morphed šĀ·0Ā·2 := šĀ·0Ā·1