6 ms·
'Concurrency-by-default' is similar to a notation I've been using to map out async service calls. It's just this: lines are terminated with "," or ";". A comma
by sixo 9y ago
'Concurrency-by-default' is similar to a notation I've been using to map out async service calls. It's just this: lines are terminated with "," or ";". A comma doesn't block and all comma-separated lines are executed in any order, while a semicolon blocks. Names are only usable when a semicolon is reached, and a semicolon unblocks flow when all preceding names are bound. Probably code is scoped into { } blocks. So a lambda is like "pyth_distance = {x, y; sqrt(x^2 + y^2)}". A series of async callbacks would be given by an inner block {x = call1(), y = call2(); pyth_distance(x,y)}, allowing you to do any manipulations you can do with normal code.
Might try making a toy language out of it eventually.
- aaron-lebo 9y agoThat's really cool. Would you build something like this from scratch or base it on another tech stack like the jvm?
- achamayou 9y agoThat's exactly what || (concurrent statements) and ; (sequential statements) do in Esterel.
- aaron-lebo 9y agoThanks, was totally unaware of that. For the lazy and ignorant like me: https://en.wikipedia.org/wiki/Esterel https://en.wikipedia.org/wiki/Esterel (if you'd like to throw a link in your comment, would be happy to delete this one)
- achamayou 9y agoNo need :) But I'll happily add this one, which is a nice short intro if you know nothing about it: http://www.embedded.com/design/prototyping-and-development/4024644/An-Introduction-to-Esterel http://www.embedded.com/design/prototyping-and-development/4... I came in contact with the language during my studies (one of my profs worked on it), found it interesting, but haven't really had a chance to apply it to anything I've done professionally since. It's a very neat language though, and if I got to do anything in the embedded field. I notice that there is now an open source compiler, which is great. The only implementation I was aware of so far was closed source.
- paulddraper 9y agoSee https://en.wikipedia.org/wiki/Dataflow https://en.wikipedia.org/wiki/Dataflow
- runT1ME 9y agoYou're close to inventing monads! I did this once too for async reasons also, and it's how I wandered into the world of Monads and functional programming. I would definitely take a look at Scala's futures and what it means to be a monad. This is probably the best way to internalize them. :)
- chubot 9y agoHm the terminators are much like shell, e.g. # synchronous sleep 1 ; sleep 2 ; # parallel sleep 1 & sleep 2 & wait wait The results have to be files... in shell you think of the file system as your "variables", so everything is somewhat global.
- nialv7 9y agoHDLs generally fit this paradigm. You might want to have a look at VHDL or Verilog.
- randomguy1254 9y agoInteresting concept. The article mentioned that other languages determine blocking automatically based on usage of the variables. So in your example, it could be determined that x and y must be calculated first before pyth_distance is called with x and y. Would you incorporate this kind of automatic detection into your language? Why or why not, and to what level? Would it perhaps be safer for the language to determine blocks for you?
- ebalit 9y agoUrbiscript is another spin on this idea, dedicated to robotics in this case. The development seems to have stalled but the ideas are really interesting.
- ksrm 9y agoThis reminds me of writing assembly for VLIW DSP chips,where each 'instruction' is actually several that run concurrently. https://en.m.wikipedia.org/wiki/Very_long_instruction_word https://en.m.wikipedia.org/wiki/Very_long_instruction_word