Comments (2)
Idea for message matching:
- Messages in a tasks INBOX will be (
sender-task
,key
,message
) tuples. message-send
will take two or three arguments:destination-task
andmessage
as it does now.destination-task
,message
andkey
.key
will be assumed to beNone
if omitted.
message-wait
always returnssender-task
,key
andmessage
.sender-task
will beNone
for messages sent by the kernel, with:key
will be the request-id returned by the async trap call.message
will be the async trap result.
sender-task
will otherwise be the task that calledmessage-send
.
message-wait
will take zero, one or two arguments:- Zero arguments: returns the first message in the INBOX if any, otherwise blocks.
sender
: returns the first message in the INBOX from the given sender, otherwise blocks.sender
andkey
: returns the first message in the INBOX from the given sender with the given key, otherwise blocks.
This provides good support for async traps as in:
def task():
request_id = yield ('sleep', 5)
_sender, _key, _discard = yield ('message-wait', None, request_id)
# _sender is guaranteed to be None, per the sender passed to message-wait: meaning the kernel
# _key is guaranteed to be request id, per the key passed to message-wait: meaning the sleep trap
# _discard is whatever the sleep trap returns which is actually None.
...which, given none of the returning values are actually useful, could be written as:
def task():
request_id = yield ('sleep', 5)
yield ('message-wait', None, request_id)
from ppytty.
This issue stems from the potential need to wait/block on multiple things:
- Timers.
- Keyboard reads.
- Child task termination.
- etc...
With the current task-wait
and message-wait
traps that is already possible, even though it needs to be done at a higher level: current solution depend on a task spawning a child task for each of the "things" it wants to wait/block on. Then either task-wait
or message-wait
will handle any of the child tasks results or messages.
Given this, I'll be deferring this interesting but maybe non-fundamental issue into TBD.
from ppytty.
Related Issues (20)
- Complete the Text widget HOT 1
- Complete the Slide widget HOT 6
- Complete the SlideDeck widget HOT 1
- Focus highlight not visible.
- Make sure tests pass on Linux
- Make Thing more generic, maybe rename it.
- Review library and implement color support.
- Python: Improve generator/coroutine .throw docs.
- Python: Open issue around curses.setupterm limitation.
- Allow tasks to track cursor movement in Process windows HOT 1
- Widget in Slide rendering failure. HOT 2
- Avoid double-rendering on Slide startup
- Optimize Window rendering when "leaving uncovered space".
- Slide multi-launch/cleanup limitation.
- Slide crashing: SlideDeck 'next' while MovableText moving. HOT 1
- Widget cleanup messaging/task wait order bug.
- Create a Code Widget
- Improve Task logging.
- Improve Bullet Widget truncation code. HOT 1
- Code Widget line numbering limitation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ppytty.