Skip to content
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

A one-method object is added to the redemption object when exit is onDemand #818

Closed
DavidBruant opened this issue Mar 31, 2020 · 4 comments
Labels
Zoe package: Zoe

Comments

@DavidBruant
Copy link
Contributor

} else if (exitKind === 'onDemand') {
redemptionResult.cancelObj = {
cancel: () =>
completeOffers(instanceHandle, harden([offerHandle])),
};

I feel this could be simplified into:

redemptionResult.cancel = () => completeOffers(instanceHandle, harden([offerHandle])),

.cancelObj.cancel() feels a bit awkward

@katelynsills
Copy link
Contributor

Yeah, agreed that redemptionResult.cancel() would be the best way to design this. However, our infrastructure below Zoe (@agoric/marshal) doesn't allow for this option. In marshal:

// objects can only be passed in one of two/three forms:
// 1: pass-by-presence: all properties (own and inherited) are methods,
// the object itself is of type object, not function
// 2: pass-by-copy: all string-named own properties are data, not methods
// the object must inherit from Object.prototype or null
// 3: the empty object is pass-by-presence, for identity comparison

Because the redemption result is a record already with seat and payout, we can't have a method as well.

@katelynsills
Copy link
Contributor

I'm going to close this, but we should probably document this design decision someplace so it doesn't always look so dumb :)

@erights
Copy link
Member

erights commented Apr 1, 2020

we should probably document this design decision someplace so it doesn't always look so dumb

#804 (comment) refers to the new grand plan @michaelfig and I settled today, that would fix this. It introduces a better way to express presences, that solve a large number of problems. Eventually (not soon) we can make function presences that can be remotely invoked with tildot. If we were first designing Zoe after this transition, cancel may very well have been such a function presence.

History dependent design is always painful, but is an inevitable price of success.

@DavidBruant
Copy link
Contributor Author

However, our infrastructure below Zoe (@agoric/marshal) doesn't allow for this option.

Yeah, now i remember, we've already had this discussion and i had forgotten
Sorry about that
and thanks for the details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Zoe package: Zoe
Projects
None yet
Development

No branches or pull requests

3 participants