-
Notifications
You must be signed in to change notification settings - Fork 6
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
Create mutation APIs #230
Open
axmmisaka
wants to merge
10
commits into
master
Choose a base branch
from
mutation/create-reactor-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create mutation APIs #230
+531
−147
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0. `canConnect` doesn't experience situations where throwing Error is required. 1. `canConnect` is solely for testing and should not throw. 2. `connect` and `connectMulti` should throw. Simply return result from `canConnect` and throw in functions that calls them.
Most of them were achieved by a dirty hack: by changing `toBe(true)` to be `toBeFalsy()` and vice versa. The negation of truthiness is because if connection can be established, we return 0, which is falsy. Otherwise we return an error enum which is truthy. This is a bit C-esque and not JS-y, but let's keep it this way as of now. Throw-catch would technically work, but it's not technically an error because we are **testing** if a connection can be established. Returning an error would also technically work, and we can add some type matching to make it work more smoothly, but as of now I intend to keep it this way. One WIP would be to change `toBeTruthy` to the actual error code, but then some tests might break. We will need to investigate instead of coding tests based on the results.
1. Implemented ConnectablePort that can be used as `Variable` 2. Refactored ConnectablePort with function overloading at the same time to facilitate better type check (but due to TS limitation there's no type narrowing, see microsoft/TypeScript#22609) 3. Made tests conform to the new connection API
1. Adapt Sieve by simply using ConnectablePort 2. Adapt Online Facility Location by using ConnectablePort *and* making necessary changes to reflect the actual logic, as discussed with @lhstrh. In this case, two sources: an OutPort (port A), and a mutation, wants to write to an OutPort (port B), but at different times. The correct thing to do, then, will be to make the mutation have its own OutPort (port C) to write to, and when it wants to write to port B, it disconnects A->B, makes connection C->B, and write to C.
Specifically ones that are related to causality graph and `ConnectablePort` - that is, declaring `ConnectablePort` in a mutation should not create dependency between them, but connection between ports should.
…lways check against the global precedence graph.
…make connections 0. Added _addChild and _addSibling necessary for mutation APIs 1. Solved issues related to hierarchy and ownership.
axmmisaka
force-pushed
the
mutation/create-reactor-api
branch
from
October 18, 2023 00:41
5b53bf7
to
bd2290b
Compare
axmmisaka
changed the base branch from
master
to
mutation/sidetask/refactor-canconnect
October 25, 2023 20:23
axmmisaka
force-pushed
the
mutation/sidetask/refactor-canconnect
branch
2 times, most recently
from
December 13, 2023 01:04
286bc49
to
0e1f736
Compare
lhstrh
force-pushed
the
mutation/sidetask/refactor-canconnect
branch
from
October 12, 2024 22:05
0e1f736
to
d140fdc
Compare
Base automatically changed from
mutation/sidetask/refactor-canconnect
to
master
October 12, 2024 22:35
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Successor of #193 as it was too messy.
This PR:
TODO: