Skip to content

GWEB v0.10.5

Choose a tag to compare

@sjnam sjnam released this 23 Oct 16:12
· 5 commits to main since this release

GWEB v0.10.5 — a literate-programming system for Go, in the CWEB tradition.

This release completes the index's definition detection: gweave now underlines, without any @!, the names cweave underlines in C — structure fields, function parameters, and labels — along with Go's method names, named results, and type parameters.

Index: definitions found without @!

  • Struct fields are indexed as definitions, as cweave underlines a C structure's members. Embedded fields (sync.Mutex, *Node) name a type, not a field, and are left as uses.
  • Method names — the name after a method's receiver list — are definitions.
  • Function parameters, named results, and type parameters are definitions, in a function declaration, a function literal, or a func type: every name in func Map[T any](xs []T, fn func(T) T) (n int) is underlined. As in Go, a list names its entries only if some entry has a name and a type, so the types in func(Request, io.Reader) (Reply, error) are not taken for names.
  • Labels (done: heading a statement) are definitions; a case clause and a keyed composite element (Name: value) are not.
  • A method's receiver is deliberately left a use: it names the same value in every method of a type, and underlining it in each would say nothing.

Until now each of these needed an @! to be filed as a definition. Weaving 72 existing webs before and after changes nothing but index lines, adding over 1,500 underlined definitions and removing none.

Upgrading

  • Nothing to change in your webs. @! still works and is still needed for a definition the rules above cannot see, such as a parameter of an interface method. Reweave to see the fuller index.

Bootstrap is byte-for-byte reproducible (make bootstrap) and the full test suite passes.