العرضar

forma

Translation status: العربية reader-locale proof. Code fences render through the ar pipeline; prose is canonical Latin.

Captured backtick templates for bound payloads.

Syntax: template(args)

Category#

template

Examples#

radix/corpus/literalia/forma.fab (canonical · literal)#

Captured backtick templates for bound payloads.

# =============================================================================
# forma — Captured backtick templates for bound payloads.
# =============================================================================
#
# What this teaches:
#   • backtick template syntax `template`(args) — captures template text and parameters into the builtin `forma` genus
#   • indexed placeholders `§0` for repeated parameter references
#   • templates without holes for static text
#
# Common mistakes:
#   • Expecting template application to render the string inline — \`...\`(args) captures into a forma genus, it does not interpolate into a textus.
#
# See also: scriptum, textus, valor
# =============================================================================

# Captured `forma` templates
#
# Backtick template application captures template text and parameters into the
# builtin `forma` genus. It does not render holes into the template string.
#
# EXPECTED OUTPUT:
#   Raw template text lines showing preserved § holes.

main {
    const string tenantId  "tenant-42"
    const string plan  "pro"

    const _ q  `
        select id, email, plan
        from accounts
        where tenant_id = §
          and plan = §
    `(tenantId, plan)

    print q.template

    const _ indexed  `where tenant_id = §0 or parent_tenant_id = §0`(tenantId)
    print indexed.template

    const _ bare  `select 1`
    print bare.template
}

Expected output:

        select id, email, plan
        from accounts
        where tenant_id = §
          and plan = §

where tenant_id = §0 or parent_tenant_id = §0
select 1