Clearer presence support; towards remote interfaces and Una #5471
Replies: 16 comments
-
Step 3.a should also reject if |
Beta Was this translation helpful? Give feedback.
-
Step 6. I don't think the repl should test whether or not it is a remote. Instead, it should test whether or not it is a presence. It should print a main presence with the same logic with which it prints a remote presence. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Everything else looks exactly right. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I will reread this tomorrow when my environment doesn't contain various thought-disrupting audio activity (Janice is watching the news in the other room with the TV sound up), but my first cut take is that this seems like a fine start on the immediate problem. And I do endorse a tropism towards strongly typed interfaces. However, I'm unclear how this plan relates to a path towards a more general unum scheme (mind you, I'm not actually certain a general unum scheme is a thing we have a pressing need for, as cool as I think it would be), since a key idea -- to my sensibilities at least -- is that different presences can present different APIs to their local environments depending on those presences' respective roles within the unum they're part of, and managing this heterogeneity is a foundational concern (I have an intuition that whatever we might come up with for interface definitions for objects with multiple facets may be relevant, but that's possibly even more distant from our immediate concerns). |
Beta Was this translation helpful? Give feedback.
-
Yeah, I'm trying for something much less than that heterogeneity. More like the subset of the Unum vision I did in E. Frankly, I'm confused by the heterogeneity aspect. I don't understand how the differences in "environments" align with vat boundaries. Perhaps we need a different word than "Unum" for the trajectory we're on. But I love the word "presence" in any case. "Presence" is exactly right. |
Beta Was this translation helpful? Give feedback.
-
I'll make the other changes you noted. This one deserves more thought:
We can export return harden({
serialize,
unserialize,
convertRemoteToPresence,
getInterfaceOf(obj) { ... },
}); where Can you think about whether Bikeshedding on names would also be appreciated. |
Beta Was this translation helpful? Give feedback.
-
@erights, I updated the above comment. |
Beta Was this translation helpful? Give feedback.
-
I'm thinking that This prevents cross-contamination of different marshallers with different interface type semantics. |
Beta Was this translation helpful? Give feedback.
-
I like this direction. Seems right. Let's discuss on Monday. |
Beta Was this translation helpful? Give feedback.
-
Huh, neat. One thought so far: putting the Or.. maybe we might want the kernel involved in types? We talked a while ago about some sort of IDL registry, where adding a new Vat requires registering the types of all the objects it might expose, so the kernel object table can know the type of every entry, and method invocations that don't match could be detected by the kernel. Better error checking and all. |
Beta Was this translation helpful? Give feedback.
-
In further conversation with @erights:
|
Beta Was this translation helpful? Give feedback.
-
No opportunity. If a
Maybe this information will only be used by liveSlots, but yes, it should be forwarded via the kernel to other consumers of an exported vat object. |
Beta Was this translation helpful? Give feedback.
-
As far as the grand plan: once we retire the old sniffing of objects to see if they are presences, we can mix data properties with presences. Also, we can make function presences |
Beta Was this translation helpful? Give feedback.
-
Some progress at #2178 |
Beta Was this translation helpful? Give feedback.
-
For many parts of this, we're making progress in other issues and PRs. My sense is that for the remaining issues here that are not represented elsewhere, this can remain in the icebox for now. |
Beta Was this translation helpful? Give feedback.
-
In trying to address the underlying issues of #792 and take baby steps towards strongly-typed interfaces and general Una (looking at you @FUDCo), @erights and I came up with the following plan:
export function pureCopy(obj): pureObj
which provides a deep "pass-by-copy" independent of obj. The resulting object is both copied to be pure data and automatically hardened, thus cannot be a communications channel. If the new object contains any functions or property getters/setters,then
pureCopy
throws a TypeError.export function Remotable(iface = 'Remotable, props = {}, identity = {})
to@agoric/marshal
.a. Do
pureIface = pureCopy(iface)
to prevent proxy interference or non-pass-by-copy objects. For now, iface is just a string that is the alleged type name of the returned remotable, and if it is not a string, a "not implemented" error is thrown.b. if identity already exists in the WeakMap below, then throw
c. The identity's prototype is set to an object that contains only
toString()
and[Symbol.toStringTag]
that displays the iface'sallegedName
when debugging andconsole.log
ing the remotable.d. Object.defineProperties(identity, getOwnPropertyDescriptors(props))
e.
remotable = harden(identity)
and assert that the remotable is compatible with marshal rules for remotablesf. set the WeakMap entry for the remotable to
pureIface
to indicate to marshal that the remotable is intended to be pass-by-presence and not pass-by-copy.e. The ownProperties of
props
are defined on the remotable, then it is hardened and returned. Ifprops
is an empty object, then the returned remotable will also not have any ownProperties.@agoric/marshal
will calliface = getInterfaceOf(obj)
to detect remotables (iface is undefined for non-remotables), and add theiface
to the@qclass: "slot"
type to indicate to the remote side what interface the remotable handles.@agoric/captp
) will consume the slot'siface
and use their marshal'sRemotable
function to reconstitute it on the receiving side. We need to ensure backward/forward compatibility: that the iface portion of the slot does not cause problems with existing code that doesn't expect it, nor with new code when it isn't sent.getInterfaceOf(obj)
is not undefined, and then stringify the remotable in debug output. It need not be aware of the form of theiface
nor the two-level (own properties + prototype) layout of the remotable.That's the first part of the plan. Along the way to general Una, we can gradually make marshal stricter. We will first print a warning if an empty object to be marshalled wasn't created with Remotable('MyDescription'). After this warning has been eliminated from our (Agoric's) code, we can bump marshal's major version and change to marshalling empty objects as data.
As far as the grand plan:
once we retire the old sniffing of objects to see if they are remotables,we can mix data properties with presences. Also, we can make function remotables as first-class citizens with Remotable(iface, props, function() { return foo }), and use tildot to call them.Separately, we can evolve the
iface
argument so that it is a proper interface type descriptor that can be enforced by SwingSet to restrict the input and output types of the props.Beta Was this translation helpful? Give feedback.
All reactions