Marker: astichi_hole¶
Form¶
astichi_hole(slot) # scalar expression hole (in expr position)
*astichi_hole(args) # positional variadic
**astichi_hole(kwargs) # keyword variadic
with astichi_hole(body) as astichi_fallback:
return None # default block body
slot, args, kwargs, and body are identifiers, not string
literals.
Clause targets are separate from ordinary holes. Use
astichi_elif(name) when the target is an additive elif branch slot inside
an existing if / elif chain.
Semantics¶
- The argument names the hole for builder wiring and internal emitted insert metadata.
- It does not select hole “kind”; position in the tree selects shape:
- ordinary expression position → scalar expression demand
*/**positions → variadic demands- standalone statement expression in a block → block insertion site
with astichi_hole(body) as astichi_fallback:declares a defaulted block hole. The wholewithstatement is the hole. If builder inserts targetbody, those inserts replace the fallback suite; if no insert targets that site, the fallback suite is lowered in place duringmaterialize().astichi_fallbackis a required sentinel name, not an application variable. Use exactlyas astichi_fallbackso Astichi can distinguish the marker form from ordinary context-manager code.- Fallback contents are branch-inactive until selected. Markers inside a discarded fallback do not create demands; markers inside a selected fallback are recognized and validated during materialization.
- Defaulted block holes are additive like ordinary statement block holes.
describe()exposes them as holes withhas_default=True.
Requirements¶
- Source must parse as valid Python for your target Python version(s).
- Unsupported
*/**placements → error (fail early). - Defaulted block holes must use one context manager, exactly
astichi_hole(name), exactlyas astichi_fallback, and a non-empty fallback suite. astichi_pyimport(...)is not valid inside a defaulted fallback suite.
Examples¶
- Unfilled defaulted block hole: defaulted_block_hole_empty/root.py → defaulted_block_hole_empty_generated.py
- Filled defaulted block hole: defaulted_block_hole_filled/root.py → defaulted_block_hole_filled_generated.py