Skip to content

Commit

Permalink
Tolerate unbound variables
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTaelin committed Oct 23, 2018
1 parent 4616744 commit 1e74be3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "symmetric-interaction-calculus"
version = "0.1.6"
version = "0.1.8"
description = "A programming language and model of computation that matches the abstract algorithm perfectly."
license = "MIT"
authors = ["Victor Maia <srvictormaia@gmail.com>"]
Expand Down
8 changes: 5 additions & 3 deletions src/term.rs
Expand Up @@ -401,10 +401,12 @@ pub fn to_net(term : &Term) -> Net {
}
}

// Checks if all variables are bound
for (nam,addr) in scope {
// Connects unbound variables to erase nodes
for (_, addr) in scope {
if enter(&net, addr) == addr {
println!("Variable never used: {}. Explicitly erase by renaming it to a hyphen (-).", std::str::from_utf8(&nam).unwrap());
let era = new_node(&mut net, ERA);
link(&mut net, port(era, 1), port(era, 2));
link(&mut net, addr, port(era, 0));
}
}

Expand Down

0 comments on commit 1e74be3

Please sign in to comment.