-
Notifications
You must be signed in to change notification settings - Fork 74
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
refactor(daemon): Factor out internal facets #2208
refactor(daemon): Factor out internal facets #2208
Conversation
2c066d1
to
53a048a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some optional suggestions.
@@ -384,7 +384,7 @@ export const makeHostMaker = ({ | |||
* @param {import('./types.js').MakeHostOrGuestOptions} [opts] | |||
* @returns {Promise<{id: string, value: Promise<import('./types.js').EndoHost>}>} | |||
*/ | |||
const makeHost = async ( | |||
const makeChildHost = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -1011,7 +1011,7 @@ test('name and reuse inspector', async t => { | |||
}); | |||
|
|||
// Regression test for https://github.com/endojs/endo/issues/2021 | |||
test.failing('eval-mediated worker name', async t => { | |||
test('eval-mediated worker name', async t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
formula, | ||
context, | ||
) => { | ||
const evaluateFormula = async (id, formulaNumber, formula, context) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: makeFormula()
@@ -746,23 +687,25 @@ const makeDaemonCore = async ( | |||
* @param {string} id | |||
* @param {import('./types.js').Context} context | |||
*/ | |||
const makeControllerForId = async (id, context) => { | |||
const evaluateFormulaForId = async (id, context) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: makeFormulaForId()
or something along those lines. I'm not sold on the FormulaForId
suffix, which doesn't seem to illuminate what distinguishes this function from evaluateFormula
/ makeFormula
, since both take the id as an argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points all around.
The first name I considered was makeFormulaForId
(just removing the Controller
) and I hesitated because it makes a value and does not make a formula. It uses the formula to make a value, which struck me as indistinguishable from evaluating a node in any other abstract syntax, which led me to evaluateFormula
.
The distinction between evaluateFormula
vs evaluateFormulaForId
is going to haunt me. The latter presumes that it can find the formula for the identifier, and the former requires that to be spelled out, and all roads flow to evaluateFormula
.
I’m going to merge for now and continue to think and discuss this with you.
This is a simplifying refactor that reduces {internal, external} controller facets to just the (external) value. In preparation, removes the last vestiges of internal facets on worker and agent. Then mops up by collapsing the controller logic and structures.