Skip to content

Commit

Permalink
rename peel to naked
Browse files Browse the repository at this point in the history
  • Loading branch information
shumbo committed Aug 5, 2024
1 parent e72311b commit 8e2dcc1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export type Dependencies<L extends Location> = {
multicast: Multicast<L>;
broadcast: Broadcast<L>;
call: Call<L>;
peel: Peel<L>;
naked: Naked<L>;
};

/**
Expand Down Expand Up @@ -106,7 +106,7 @@ export type Colocally<L extends Location> = <
args: Args,
) => Promise<Return>;

export type Peel<L extends Location> = <LL extends L, T>(
export type Naked<L extends Location> = <LL extends L, T>(
mlv: MultiplyLocated<T, LL>,
) => T;

Expand Down Expand Up @@ -385,7 +385,7 @@ export class Projector<L extends Location, L1 extends L> {
multicast: multicast(childTag),
broadcast: broadcast(childTag),
call: call(childTag),
peel: (v) => v.getValue(key),
naked: (v) => v.getValue(key),
}),
args,
);
Expand Down Expand Up @@ -489,7 +489,7 @@ export class Projector<L extends Location, L1 extends L> {
}
};

const peel: Peel<L> = <LL extends L, T>(cv: MultiplyLocated<T, LL>) =>
const naked: Naked<L> = <LL extends L, T>(cv: MultiplyLocated<T, LL>) =>
cv.getValue(key);

const call: (t: Tag) => Call<L> =
Expand All @@ -511,7 +511,7 @@ export class Projector<L extends Location, L1 extends L> {
call: call(childTag),
multicast: multicast(childTag),
colocally: colocally(childTag),
peel: peel,
naked: naked,
}),
a,
);
Expand All @@ -525,7 +525,7 @@ export class Projector<L extends Location, L1 extends L> {
call: call(tag),
multicast: multicast(tag),
colocally: colocally(tag),
peel: peel,
naked: naked,
}),
args.map((x) => new Located(x, key)) as any,
);
Expand Down Expand Up @@ -621,7 +621,7 @@ export class Runner {
multicast: multicast,
broadcast: broadcast,
call: call,
peel: peel,
naked: naked,
}),
args,
);
Expand Down Expand Up @@ -660,13 +660,13 @@ export class Runner {
call: call,
multicast: multicast,
colocally: colocally,
peel: peel,
naked: naked,
}),
a,
);
return ret;
};
const peel: Peel<L> = <LL extends L, T>(cv: MultiplyLocated<T, LL>) =>
const naked: Naked<L> = <LL extends L, T>(cv: MultiplyLocated<T, LL>) =>
cv.getValue(key);

const ret = await choreography(
Expand All @@ -677,7 +677,7 @@ export class Runner {
call: call,
multicast: multicast,
colocally: colocally,
peel: peel,
naked: naked,
},
args.map((x) => new Located(x, key)) as any,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type {
Locally,
Comm,
Colocally,
Peel,
Naked,
Multicast,
Broadcast,
Call,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ts from "typescript";

type MessageIDs = "error" | "suggestion";

const operators = /^(locally|colocally|multicast|broadcast|comm|call|peel)$/;
const operators = /^(locally|colocally|multicast|broadcast|comm|call|naked)$/;

const choreographySelector = `VariableDeclaration[kind = "const"] > VariableDeclarator`;
const functionSelector = `${choreographySelector} > :matches(ArrowFunctionExpression, FunctionExpression)`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
}) => {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({ locally, comm, peel }) => {
const sharedDecision = peel(decision);
async ({ locally, comm, naked }) => {
const sharedDecision = naked(decision);
if (sharedDecision) {
const deliveryDateAtSeller = await locally(
"seller",
Expand Down Expand Up @@ -102,7 +102,7 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async (arg) => {
const sharedDecision = peel(decision);
const sharedDecision = naked(decision);
if (sharedDecision) {
const deliveryDateAtSeller = await locally(
"seller",
Expand All @@ -115,7 +115,7 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
output: null, // assert that no autofix is suggested
errors: [
{
// error for missing `peel` operator, with no suggestions
// error for missing `naked` operator, with no suggestions
messageId: "error",
suggestions: null,
},
Expand All @@ -142,7 +142,7 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
await colocally(
["buyer1", "seller"],
async function (arg) {
const sharedDecision = peel(decision);
const sharedDecision = naked(decision);
await locally("seller", () => sharedDecision);
return [];
},
Expand Down Expand Up @@ -172,8 +172,8 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
}) => {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({ peel }) => {
const sharedDecision = peel(decision);
async ({ naked }) => {
const sharedDecision = naked(decision);
if (sharedDecision) {
const deliveryDateAtSeller = await locally(
"seller",
Expand All @@ -191,8 +191,8 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
}) => {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({ peel, locally }) => {
const sharedDecision = peel(decision);
async ({ naked, locally }) => {
const sharedDecision = naked(decision);
if (sharedDecision) {
const deliveryDateAtSeller = await locally(
"seller",
Expand All @@ -216,8 +216,8 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
}) => {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({ peel, locally }) => {
const sharedDecision = peel(decision);
async ({ naked, locally }) => {
const sharedDecision = naked(decision);
if (sharedDecision) {
const deliveryDateAtSeller = await locally(
"seller",
Expand All @@ -244,7 +244,7 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({}) => {
const sharedDecision = peel(decision);
const sharedDecision = naked(decision);
}
)
};`,
Expand All @@ -256,8 +256,8 @@ ruleTester.run("no-outside-choreographic-operator", noOutsideOperatorRule, {
}) => {
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({ peel }) => {
const sharedDecision = peel(decision);
async ({ naked }) => {
const sharedDecision = naked(decision);
}
)
};`,
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/bookseller2/bookseller2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const bookseller: (
const decision = await multicast("buyer1", ["seller"], decisionAtBuyer);
const [deliveryDateAtBuyer] = await colocally(
["buyer1", "seller"],
async ({ locally, comm, peel }) => {
const sharedDecision = peel(decision);
async ({ locally, comm, naked }) => {
const sharedDecision = naked(decision);
if (sharedDecision) {
const deliveryDateAtSeller = await locally(
"seller",
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/kvs/kvs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export const primaryBackupReplicationStrategy: ReplicationStrategy<
// forward request to backup if mutating
await colocally(
["primary", "backup"],
async ({ locally, comm, peel }) => {
if (peel(isPut)) {
async ({ locally, comm, naked }) => {
if (naked(isPut)) {
const requestAtBackup = await comm(
"primary",
"backup",
Expand Down

0 comments on commit 8e2dcc1

Please sign in to comment.