Title: python-csp syntax overhall · Issue #17 · futurecore/python-csp · GitHub
Open Graph Title: python-csp syntax overhall · Issue #17 · futurecore/python-csp
X Title: python-csp syntax overhall · Issue #17 · futurecore/python-csp
Description: From old Google Code repo: Think about whether python-csp "syntax" is optimal. The thoughts below are from an ancient email thread, never implemented: One is that I would like to see Processes, Pars, Seqs and Alts (and Barriers / Buckets...
Open Graph Description: From old Google Code repo: Think about whether python-csp "syntax" is optimal. The thoughts below are from an ancient email thread, never implemented: One is that I would like to see Processes, Par...
X Description: From old Google Code repo: Think about whether python-csp "syntax" is optimal. The thoughts below are from an ancient email thread, never implemented: One is that I would like to see Proc...
Opengraph URL: https://github.com/futurecore/python-csp/issues/17
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"python-csp syntax overhall","articleBody":"From old Google Code repo:\n\nThink about whether python-csp \"syntax\" is optimal. The thoughts below are from an ancient email thread, never implemented:\n\nOne is that I would like to see `Process`es, `Par`s, `Seq`s and `Alt`s (and `Barrier`s / `Bucket`s / ... if possible) as combinators in python-csp that are all \"first-class\" and can all take one another as arguments to their constructors. It would be nice and elegant to avoid special cases here. So we could say things like:\n\n``` python\nmyProc() // [myAlt(), mySeq(), myPar(), myChannel()]\n```\n\nand all of those would run in parallel.\n\nClunky syntax, the issue now is that we're close to this in python-csp, by having only two sorts of base classes in the library: processes and guards. `Guard`s are for synchronising on and processes\nare for computation, but a guard cannot be \"run\" like a process can and a process does not implement `read` / `write` / `select` like a guard does. Python works by duck typing, so the real difference between `Guard` and `Process` types is that the latter implements a `start` method which starts a process running, and `Guard`s can \"read\" and \"write\". Barriers break this model entirely because we have used `Channels()` as being the default sort of guard, which I'm now beginning to question.\n\nA very simple way to unify guards and processes would be for an `Alt`, when it \"runs\" to have an infinite loop which repeatedly calls `Alt.select()` (and variants of that for priority selection, etc). Equally, we could have `ReadChannel()` and `WriteChannel()` classes which `read()` and `write()` indefinitely, and so on. I'm not sure how the converse would work by allowing processes to be synchronised on, but the answer could be to make `Barrier`s the base class for guards, and\nhave `Channel`s extend the `Barrier` class and change round all the method names to suit.\n\nThis is relatively simple to implement, but I'm not entirely sold on it as a way forward. Firstly, when synchronisation primitives get more complicated I'm not sure if the model will break down. `Bucket`s are something we'll want to have for our own work on pervasive computing and no doubt there will be other useful primitives too. Secondly, I haven't (yet) written a nice CSP model of all of these ideas, but i think it's worth doing, not so much to check deadlocks as the scheme is quite simple, but really to get a better idea of the style of programs which might result.\n","author":{"url":"https://github.com/snim2","@type":"Person","name":"snim2"},"datePublished":"2012-10-03T18:57:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/17/python-csp/issues/17"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:86ed9814-8d12-fd9c-b196-a7abb3576870 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BFF8:1C418C:D0C4BA:12D33AB:6A4CC4A0 |
| html-safe-nonce | ddab1f99643d2afb8c312ade8c739fc6037cfd6144ef01987c112afbf38449ac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRkY4OjFDNDE4QzpEMEM0QkE6MTJEMzNBQjo2QTRDQzRBMCIsInZpc2l0b3JfaWQiOiI1MTQ1ODEwNjkxNDY3MDM1ODA4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e9167643df4b100dea7c23d06d8e764dabb248d50fc47a75aa760fc669da23d6 |
| hovercard-subject-tag | issue:7331034 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/futurecore/python-csp/17/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0160449c97d093e6cd73b2adf525a69086c8d550627a788566c5646b7c206d8c/futurecore/python-csp/issues/17 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0160449c97d093e6cd73b2adf525a69086c8d550627a788566c5646b7c206d8c/futurecore/python-csp/issues/17 |
| og:image:alt | From old Google Code repo: Think about whether python-csp "syntax" is optimal. The thoughts below are from an ancient email thread, never implemented: One is that I would like to see Processes, Par... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | snim2 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/futurecore/python-csp git https://github.com/futurecore/python-csp.git |
| octolytics-dimension-user_id | 8041718 |
| octolytics-dimension-user_login | futurecore |
| octolytics-dimension-repository_id | 6064533 |
| octolytics-dimension-repository_nwo | futurecore/python-csp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 6064533 |
| octolytics-dimension-repository_network_root_nwo | futurecore/python-csp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d0da0eb92994395299ed4450bf67b0373005be36 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width