-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presences should not have ownProperties #792
Comments
Curious where we're encountering this? Where do we look at the own properties of a presence? |
If we do something like |
I have a better solution using a symbol registered with |
@erights are you ok with that? I'm all on board with empty records showing up as empty records. And I'm still happy with our decision to represent empty records as pass-by-reference marker objects (which arrive as Presences). And I'm happy to to have Presences lose their properties, as long as they retain debugability. The thing that feels weird to me is to pass a data record in and get a Presence out. If Alice sends a record to Bob, and Bob sends it back, and Alice does OTOH, if the recipient is expecting a data record, then they'll never think to do an identity check on it, and they'll never notice that the thing they received was pass-by-reference rather than pass-by-copy. So practically speaking, it could be just fine. |
I have the same discomfort and would like to find a better solution. Let's talk tomorrow. |
Maybe we should choose to marshal empty records as pass-by-copy, and have an explicit That would help satisfy the Principle of Least Suprise. |
I like that direction. |
Close in favor of #804 ? |
Currently, if you pass an empty object across SwingSet vats, it is marshalled as a Presence (or a Device), and has a
.toString
ownProperty added to it. This makes for a surprise on the other end, where an ownProperty is not expected. This has bitten us in several cases where an empty object is a desirable feature of an interface that takes 0 or more ownProperties.If instead we set the presence's prototype to have the .toString then it won't have any .keys() or .getOwnPropertyNames(), so it will be handled correctly as an empty object!
@warner I'll work out a PR for this.
The text was updated successfully, but these errors were encountered: