[Forgot the list.]
---------- Forwarded message ---------- From: Andreas Rossberg <rossb...@google.com> Date: 16 September 2011 15:35 Subject: Re: {Weak|}{Map|Set} To: David Bruant <david.bru...@labri.fr> On 16 September 2011 15:17, David Bruant <david.bru...@labri.fr> wrote: >> Well yes, but that's part of programming. In practice, all resources >> are finite. And the difference between finite and infinite space usage >> is a correctness criterium. >> >> Consider writing a server. If I cannot rely on tail call optimization >> then writing its message loop as a recursive function (e.g. actors >> style) would be incorrect. If I cannot rely on GC, then allocating an >> object for each received message would be incorrect. If I cannot rely >> on weak maps, then, say, mapping every message object to a return IP >> would be incorrect. > > You are making a connection between program correctness and implementation > consideration of what you use to write these programs. It doesn't sound > right. > > "If I cannot rely on tail call optimization then writing its message loop as > a recursive function (e.g. actors style) would be incorrect." > => This is not true. If your server ever receives only one message, you > should be fine. Obviously, I was talking about a server that is expected to get an unbounded number of messages during its uptime. > The problem is in implementation limitation, not correctness > of your program. It turns out your programming style with nowadays > reasonable use cases (size of input, number of messages...) makes current > implementations fail. I agree that it is annoying, but it doesn't make your > program incorrect. > If we start considering implementation limitations as sources of program > incorrectness, then some ECMAScript programs will always be incorrect. The difference is, this limitation would be hit for the _normal_ use case of the server. If my program cannot deal with its expected use case, then it is incorrect. > Regarding tail call optimization, as far as I'm concerned, an agreement > between implementors sounds like a more reasonable approach. There is no way > in the language to test this feature. In this video [1], David Herman > explains that a test can be written (at 40:40), but the test relies on > implementation limitations rather than the language by itself (unlike all > tests that can currently be found on test262). That is true, but whether some property can be observed from within the language itself, or only by its environment, is not relevant. There is no test that you can reliably write for a 'print' function. Still you want to be able to rely on it printing what you gave it. Or consider a sleep(secs) function. How would you test it? > "If I cannot rely on GC, then allocating an object for each received message > would be incorrect." > => Can you refine this point? I don't understand the connection between > garbage collection and correctness of your program. > I allocate objects on a daily basis and have never /relied/ on garbage > collection. I think you implicitly do, all the time. Just try turning off GC and see whether your programs still work reliably. /Andreas _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss