19:37
<snek>
what's up with the requirement that if the target is not extensible, proxy ownKeys can't return a different set of keys?
19:38
<snek>
like if i define the other traps to behave consistently, shouldn't it be fine
19:45
<nicolo-ribaudo>
I guess it's because otherwise there is no way to guarantee that it behaves as not extensible
19:53
<bakkot>
how could it know that the other traps behave consistently without calling them?
19:54
<bakkot>
or remembering their results, I suppose
19:56
<bakkot>

you should understand the target as serving as a witness, a proof-by-example that the behavior you are representing is consistent with the essential invariants (at least assuming that you don't already have something inconsistent to use as the target).

and one of the invariants is, if something is reported to be not-extensible, then it will never get new keys. the way this is enforced is, a proxy can only report being not-extensible if its target is not-extensible, and if the target is not-extensible then it must report having the same keys as the target. if either of these properties was not enforced then you could have behavior which is not consistent with the essential invariants.

20:02
<snek>
currently it checks if it's consistent by calling the mop methods on the target. it could call them on itself for example.
20:02
<snek>
but oh well
20:02
<bakkot>
how could it check that the ownKeys trap is consistent over time?
20:03
<bakkot>
other than by remembering the results, which gets expensive
20:03
<snek>
imo if its not consistent you just have to enjoy the cthulhu you have unleashed
20:04
<snek>
but i guess folks specifying proxies felt differently
20:04
<bakkot>
personally I like being able to reason about programs
20:04
<bakkot>
and write code which is robust even if other people are doing weird stuff
20:05
<bakkot>
on a normal business webpage there's code from like 20 different vendors interoperating and having some invariants actually enforced by the language is the only thing which makes that work at all
20:07
<bakkot>
(in fact I think proxies already make it far too hard to reason about code, and they should never have been added in the first place. but that ship has sailed.)
20:09
<kriskowal>
I saw Tom van Cutsem’s original Proxy presentation a long time ago. At lunch, Doug Crockford was behind me in line and asked “what do you think of Proxy” and it was obviously a personality test.
20:11
<kriskowal>
I would like to think that I said something clever like, “It’s obviously sharp on both ends.”.
20:13
<kriskowal>
At the same meeting, Doug also said “You should pick either import("specifier") or import "specifier". If you pick one or the other, half the room will hate it. If you pick neither, everyone will hate it.
20:13
<shu>
haha we did pick both
20:13
<kriskowal>
It hadn’t occurred to me yet that I should pick both.
20:14
<shu>
anyway i don't like to think
20:14
<shu>
the greatest disservice my college did me was to make me think i ought to enjoy thinking and strive to keep thinking
20:16
<kriskowal>
i’ve always assumed that people who can think get invited to better parties. but, i’ve also found that not going to parties is an effective work-around.
20:17
<shu>
agreed with you there
20:40
<Mathieu Hofman>
The only purpose of the Proxy target is to enforce invariants of the language. Proxies should not create a way to bypass these invariants, or as mentioned it makes it impossible to reason about the program (exotic behaviors already make it hard enough)
20:52
<shu>
i don't understand, proxies makes exotic behavior user-definable
20:53
<shu>
like sure, neither ordinary nor exotic behavior can violate the essential MOP invariants, but proxy's existence makes reasoning about the program much harder
21:27
<Mathieu Hofman>
I think I agreed with that? In particular the possibility of reentrancy or throwing when interacting with seemingly "plain" objects
21:28
<shu>
ah
21:29
<Mathieu Hofman>
Host and language exotic behavior is "well-behaved", but unfortunately proxies allow authors to create programs with surprising behaviors