Skip to content

Implement the anonymous variable (_) #1

@bzaar

Description

@bzaar

Currently one has to use unique variables if a value is to be ignored.

The benefits of having the anonymous variable include:

  1. Better readability of prolog code.
  2. Removal of runtime overhead: there is no need to bind the anonymous variable; it unifies with anything (including other anonymous variables) without causing any variables to become bound. Binding imposes some runtime cost and avoiding it removes this (possibly small) overhead.

What many other Prolog implementations do, they just generate unique names such is _G145 for each occurrence of the anonymous variable. This is undesirable because the code becomes less readable when viewed in the debugger and doing so does not remove the runtime overhead of binding those variables.

The AnonymousVariable will be another inheritor to IValue, alongside Variable and IConcreteValue.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions