An example of substituability test that is recursive
Remi Forax
forax at univ-mlv.fr
Thu Jan 31 11:19:32 UTC 2019
Hi Karen,
here is an example that recurse to its death with the current prototype
import java.lang.invoke.ValueBootstrapMethods;
import java.util.stream.IntStream;
public class Substituable {
static value class Link {
private final int value;
private final Object next;
public Link(int value, Object next) {
this.value = value;
this.next = next;
}
static Object times(int count) {
return IntStream.range(0, count).boxed().reduce(null, (acc, index) -> new Link(index, acc), (l1, l2) -> { throw null; });
}
}
public static void main(String[] args) {
var l = Link.times(1_000);
//System.out.println(l == l);
System.out.println(ValueBootstrapMethods.isSubstitutable(l, l));
}
}
Rémi
More information about the valhalla-spec-observers
mailing list