7.6 Holes

Holes are Prolog variables that some Sweep commands use as placeholder for other terms.

When writing Prolog code in the usual way of typing in one character at a time, the buffer text is often found in a syntactically incorrect state while you edit it. This happens for example right after you insert an infix operator, before typing its expected right-hand side argument. Sweep provides an alternative method for inserting Prolog terms in a way that maintains the syntactic correctness of the buffer text while allowing the user to incrementally refine it by using placeholder terms, called simply holes. Holes indicate the location of missing terms that the user can later fill in, essentially they represent source-level unknown terms and their presence satisfies the Prolog parser. Holes are written in the buffer as regular Prolog variables, but they are annotated with a special text property that allows Sweep to recognize them as holes needed to be filled.

See Inserting Terms with Holes, for a command that uses holes to let you write syntactically correct Prolog terms incrementally. Several other Sweep commands insert holes in place of unknown terms, including C-M-i (see Code Completion), C-M-m (see Context-Based Term Insertion) and M-x sweeprolog-plunit-testset-skeleton (see Writing Tests).