The core idea of GoMeta is to embed formalized meaning within all kinds of comments and provide Extensions with its interpretations so they can act on them.
So on the one hand, GoMeta is a domain-specific language for metadata and on the other a framework with facilities which Extensions can build on.
Language-agnostic, since the metadata remains “hidden” within the comments — the host file stays an ordinary file, and the host language sees nothing but a comment.
One source file, all kinds of output formats — and webs of atomic data units instead of hierarchies: a folder must place an item at a single position; labels weave a web.
GoMeta provides the means; Extensions serve the use cases.
And the safety posture is part of the idea: GoMeta evaluates metadata — it never executes the file it processes.
Any line starting with #~ is a metaLine — it will be processed as metadata. Contiguous metaLines constitute a metaBlock; positioned just above a block of code or text, it gets attached — similar to how docstrings get associated with Julia structures following them.
eval; more general parsing via Julia’s parser is strictly opt-in.Four seemingly unrelated use cases illustrate what GoMeta can be used for — but they are not GoMeta: Extensions serve them.
find_by_label.jl answers: which pieces of which files carry this label.Before GoMeta can absorb & evaluate the metadata, BLS reads the file, extracts features of interest and records them in a tree-like structure. Blocks, Lines and Segments are all Components at different levels in the hierarchy, in three Component flavors — Meta, Text, Code. And one record is crucial: is a Component attached to a metaComponent or not? That decides whether a metaStatement gets applied to it.
Once the BLS parsing has been conducted, we reach the heart of the GoMeta process: absorb the GoMeta data — i.e.: parse and interpret it — evaluate the altValues (Alterant values), and make them available to whatever Extension the user calls for.
GoMeta passes its evaluations on to Extensions, which act on them. Like languages, GoMeta by itself does not produce anything — it provides the means, the metadata-Blocks, to build something. Speedily retrieving a long-forgotten snippet, linking fragments across files, one source file for all kinds of output formats, automated removal of private passages before sharing: illustrations of what GoMeta can be used for — but they are not GoMeta. A web of atomic data units, for one, requires not only an Extension but also a database as a back end.
As a Julia Type declares a kind of value, an Alterant declares a kind of metadata — with its actions and rules. Visib, labels, id and heading ship built in. What GoMeta evaluates per Component are their values: the altValues.
It is essential to GoMeta. Any line starting with #~ is a metaLine — it will be processed as metadata. Contiguous metaLines constitute a metaBlock; positioned just above a block of code or text, the metaBlock gets attached — similar to how docstrings get associated with Julia structures following them. Three content flavors at 0.3.0: :julia for #, :c for //, :latex for % — selected explicitly, never inferred. The same principles are easily extended to other programming languages or project data in general.
For security reasons GoMeta provides its own little parser: condition text is parsed into a bounded AST and evaluated by GoMeta’s own closed interpreter — in a default-configured run, no condition text ever reaches Julia’s eval. More general parsing via Julia’s parser is allowed through opt-in. GoMeta does not execute the instructions inscribed in the metadata.
Status: alpha. GoMeta.jl 0.3.2 implements the v0 subset of the GoMeta language — a working, tested engine with a byte-exact example oracle: the seven committed example pairs render byte-identically, pinned by the shipped 1140-test suite. It’s alpha — the surface may still move before 1.0. GoMeta evaluates metadata; it never executes the file it processes.
GoMeta is Fair Source — licensed under the Functional Source License, Version 1.1, MIT Future License (FSL-1.1-MIT; source-available, not OSI-approved open source): free for everyone’s own use — at work, at university, in the public sector. Not licensed: offering GoMeta to others in a commercial product or service that competes with it or with the Licensor’s own GoMeta-based offerings. On the second anniversary of a version’s release, that version becomes available under the MIT license — irrevocably. See the repository for the license and details.