With monomorphic BatakJava, we can easily make sure that hash values aren't mixed up with the wrong versions by specifying the versions.
However, the Dir class must have the ability to use different versions of Hash.
public class Dir ver 1 «V» {
public String[] getFiles() {
String[] files = new String[1];
files[0] = "a";
return files;
}
public boolean exists(HashValue#V# h) {
String[] fs = this.getFiles();
// we can also reinforce hash with a specific version
Hash#V# hash = new Hash#V#();
for (int i = 0; i < fs.length; i++) {
if (hash.match(fs[i], h)) {
return true;
}
}
return false;
}
}
With monomorphic BatakJava, we can easily make sure that hash values aren't mixed up with the wrong versions by specifying the versions.
However, the
Dir
class must have the ability to use different versions ofHash
.