Antra

Standardbibliothek

Antra::Meta

import Antra::Meta

Metadata introspection for Antra packages and functions.

Überblick#

Zum Lesen von Doku und Attribut-Metadaten.

Referenz#

Meta.doc(x)
Meta.doc_lines(x)
Meta.attrs(x)

Funktionen#

fn attrs(subject)

Returns the attribute metadata attached to a package or function.

Parseable values such as strings, numbers, keyword arrays and maps are returned as normal runtime values. Their expressions are materialized lazily when read, so package self-references like @returns(Person) inside package Person { ... } work as expected. More free-form metadata stays in its raw syntax representation.

fn doc(subject)

Returns the attached documentation block joined by newlines.

fn doc_lines(subject)

Returns the attached documentation lines as an array.

@todo("Sollte vielleicht eine Map zurückgeben, mit noch mehr Informationen zu der Funktion")
fn functions(subject)

Returns the exported function names of a package.

fn get_subject(subject, name)

Returns a named child subject from a package or map-like value.

Example:

Meta.doc(Meta.get_subject(List, "min"))
fn require_subject(subject, name)

Returns a named child subject and fails if it does not exist.

Example:

Meta.doc(Meta.require_subject(List, "min"))

Quelle dieser Seite