ansonmiu0214 / typescript-multiparty-sessions Goto Github PK
View Code? Open in Web Editor NEWA mono-repo for a session type API code generation toolchain for modern web programming.
License: MIT License
A mono-repo for a session type API code generation toolchain for modern web programming.
License: MIT License
global protocol Test(role S, role C, role A) {
login(number) from C to A;
pay(number) from C to S;
blah() from C to A;
acc(number) from S to C;
}
If S
sends acc(number)
before C
sends blah()
, then you get:
"C cancelled session: JSON.parse: unexpected character at line 1 column 2 of the JSON data"
This happens because of line 300 in codegen/generator/browser/templates/runtime.tsx.j2, which should use the data
variable instead of the message
variable, since message
has been parsed already, but then the handle
function in C
's receive state tries to parse it again.
I am gonna try and make a PR for this.
Codegen generates EFSM states that share the same actions, these should be collapsed.
I fixed this during my thesis but totally forgot about it until now. Gonna try and remember how scribble works...
global protocol ReceiverBug(role A, role B) {
rec Loop {
choice at A {
msg1() from A to B;
continue Loop;
} or {
msg2() from A to B;
continue Loop;
}
}
}
the handler registration of B is tied to componentDidMount, but if the state didn't change โ since there's just one state for B here โ then that method won't get called because the receiver component never has to mount again. Without checking for this, B stops being able to receive messages after the first message
associated PR: #52
Particularly useful for React APIs, since developers need to interpret the generated identifiers to know what component to inherit from.
const logic = new Implementation.Initial({ [Labels.S17.Destination]: async (dest) => { const result = await checkAvailable(dest); if (result.available) { return new Implementation.S19([ Labels.S19.Available, [result.price], ... ]); } else { return new Implementation.S19([ Labels.S19.Full, [], logic ]); } } });It should be possible to change the type definition for the async function to take one more argument before
dest
that offers two functions:available()
andfull()
. These take the next logic followed by the required messages (using the vararg pattern). With that, IDE users will get better guidance towards the correct implementation. For example, if I started my function likeasync (nextStep, dest) =>
then I could writenextStep.
and would get automatic completions for the choices I have.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.