Re: An example of substituability test that is recursive

2019-01-31 Thread John Rose
On Jan 31, 2019, at 3:19 AM, Remi Forax wrote: > > here is an example that recurse to its death with the current prototype Fun fact: Change the Link to a Tree and you go from linear to exponential in the depth. *Just* a fun fact; it doesn't change Remi's point, which is that we can construct

Re: An example of substituability test that is recursive

2019-01-31 Thread forax
> De: "John Rose" > À: "Remi Forax" > Cc: "Karen Kinnear" , "valhalla-spec-experts" > > Envoyé: Jeudi 31 Janvier 2019 19:03:13 > Objet: Re: An example of substituability test that is recursive > On Jan 31, 2019, at 3:19 AM, Remi Forax < [ mailto:fo...@univ-mlv.fr | > fo...@univ-mlv.fr ] >

Re: An example of substituability test that is recursive

2019-01-31 Thread John Rose
On Jan 31, 2019, at 10:52 AM, Brian Goetz wrote: > > Let’s not do this to Java, shall we? > > https://twitter.com/seldo/status/1090931182227861508 > > >> solution 2: you claim it's too complex and you just let the user deal with >>

Re: An example of substituability test that is recursive

2019-01-31 Thread forax
> De: "John Rose" > À: "Remi Forax" > Cc: "Karen Kinnear" , "valhalla-spec-experts" > > Envoyé: Jeudi 31 Janvier 2019 20:43:33 > Objet: Re: An example of substituability test that is recursive > On Jan 31, 2019, at 10:41 AM, [ mailto:fo...@univ-mlv.fr | fo...@univ-mlv.fr ] > wrote: >> yes, i

Re: An example of substituability test that is recursive

2019-01-31 Thread John Rose
On Jan 31, 2019, at 6:34 AM, fo...@univ-mlv.fr wrote: > > The other solution is to say that == should do an upcall to equals (after the > null checking and the class checking), if equals throw a StackOverflow, it's > the expected behavior because the user is in control of that behavior. What

Re: An example of substituability test that is recursive

2019-01-31 Thread John Rose
On Jan 31, 2019, at 10:41 AM, fo...@univ-mlv.fr wrote: > > yes, i creates a DAG that will be too long to traverse :( > you basically, DDOS yourself if you do a ==. The complexity is exponential in depth, and can be more than linear in heap allocation, because of the risk of repeat traversals. A

Re: An example of substituability test that is recursive

2019-01-31 Thread Karen Kinnear
Actually - I was unclear - apologies. K > On Jan 31, 2019, at 3:54 PM, fo...@univ-mlv.fr wrote: > > > > De: "Karen Kinnear" > À: "Remi Forax" > Cc: "John Rose" , "valhalla-spec-experts" > > Envoyé: Jeudi 31 Janvier 2019 21:36:09 > Objet: Re: An example of substituability test that is

Re: An example of substituability test that is recursive

2019-01-31 Thread Brian Goetz
Let’s not do this to Java, shall we? https://twitter.com/seldo/status/1090931182227861508 > solution 2: you claim it's too complex and you just let the user deal with it > by calling equals() (and provide a way for a user to call the default subs).

Re: An example of substituability test that is recursive

2019-01-31 Thread forax
> De: "Karen Kinnear" > À: "Remi Forax" > Cc: "John Rose" , "valhalla-spec-experts" > > Envoyé: Jeudi 31 Janvier 2019 21:36:09 > Objet: Re: An example of substituability test that is recursive > Option #1 was what I was suggesting in the meeting two weeks ago - if this > starts > to recurse

Re: An example of substituability test that is recursive

2019-01-31 Thread forax
> De: "John Rose" > À: "Remi Forax" > Cc: "Karen Kinnear" , "valhalla-spec-experts" > > Envoyé: Jeudi 31 Janvier 2019 19:05:33 > Objet: Re: An example of substituability test that is recursive > On Jan 31, 2019, at 6:34 AM, [ mailto:fo...@univ-mlv.fr | fo...@univ-mlv.fr ] > wrote: >> The

Re: An example of substituability test that is recursive

2019-01-31 Thread Karen Kinnear
Option #1 was what I was suggesting in the meeting two weeks ago - if this starts to recurse too deeply, create a worklist - which should give you the same result. If you switch to .Equals - you might get a different result … thanks, Karen > On Jan 31, 2019, at 1:46 PM, fo...@univ-mlv.fr

An example of substituability test that is recursive

2019-01-31 Thread Remi Forax
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

Re: An example of substituability test that is recursive

2019-01-31 Thread Karen Kinnear
Remi, Thank you. So there were two kinds of “recurse to its death” we talked about 1) expected behavior 2) surprise This strikes me as the expected behavior - where we can set expectations. If we were to always return false - how would you make this kind of example work? thanks, Karen > On

Re: An example of substituability test that is recursive

2019-01-31 Thread Brian Goetz
Currently, `==` is almost useless on lambdas, as we disclaim nearly all promises. What this would mean is that `==` becomes slightly less useless and slightly more expensive. It’s not obvious this is a bad trade (or that it really matters, because people are discouraged from using `==` on

Re: An example of substituability test that is recursive

2019-01-31 Thread Remi Forax
Thinking a little more about this example, i think it will be more common if we retrofit lambdas to be value type because a series of composition of lambdas is a kind of linked list in term of data structure in memory. For the composition of lambdas, a stack overflow is unlikely because

Re: An example of substituability test that is recursive

2019-01-31 Thread forax
- Mail original - > De: "Brian Goetz" > À: "Remi Forax" > Cc: "Karen Kinnear" , "valhalla-spec-experts" > > Envoyé: Jeudi 31 Janvier 2019 17:56:47 > Objet: Re: An example of substituability test that is recursive > Currently, `==` is almost useless on lambdas, as we disclaim nearly