AutolangDocs

Magic Constants

Autolang provides compile-time constants resolved directly by the compiler. Because they are substituted during compilation, they carry zero runtime overhead and provide deterministic audit and diagnostic data.

Available Constants

ConstantTypeDescription
__LINE__IntThe current line number in the source file.
__FILE__StringThe name of the current source file being compiled.
__FUNC__StringThe name of the enclosing function, or an empty string at file top-level.
__CLASS__StringThe name of the enclosing class, or an empty string outside a class.

Audit Logging & Diagnostics

Combine magic constants with string interpolation to emit structured diagnostics that identify the exact source location of a business workflow step.

class PaymentAuditor { fun recordStep(stepName: String) { println("[${__FILE__}:${__LINE__}] ${__CLASS__}.${__FUNC__}() -> Step: " + stepName) } } val auditor = PaymentAuditor() auditor.recordStep("AUTHORIZE_SETTLEMENT")

Assertions with Location Metadata

Magic constants pair with the global assert() function to produce actionable failure reports when invariant conditions fail.

fun validateTransactionLimit(amount: Int): Bool { assert(amount > 0, "Invalid amount at ${__FILE__}:${__LINE__}") return amount <= 50000 } println("Limit checked: " + validateTransactionLimit(1500))