Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the anonymous variable (_) #1

Open
bzaar opened this issue Apr 4, 2013 · 0 comments
Open

Implement the anonymous variable (_) #1

bzaar opened this issue Apr 4, 2013 · 0 comments

Comments

@bzaar
Copy link
Owner

bzaar commented Apr 4, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant