News for hackers. Stuff that matters.
Re:The Concurnas Programming Language by smithza on Wednesday May 27, 2020 @05:05PM (#23329972)
Never seen anything like this before in a programming language (VHDL/Verilog supports this sort of stuff of course):

  onchange(x){ doSomething()}//on change of x, perform an action
  every(x){ doSomething(x)}//as above but including initial value
  await(x; x > 2)//pause execution until the condition is met
  trans{//a transaction acting upon two references
    a -= 10
    b += 10
  }
  z <= a+b//shorthand for every
  z <- a+b//shorthand for onchange
Is this novel to abstract languages? Would something like this work in a language without a VM like C++?

I imagine needing registrations of these conditionals in the VM to watch and execute.

Re:The Concurnas Programming Language by dkersten on Wednesday May 27, 2020 @05:37PM (#23330359)
There are some languages that do this, especially reactive languages and there are some libraries for other languages that work kinda like this, for example Rx[1] works kinda like this or maybe Clojure's Javelin[2]. You could make an Rx-like system that works somewhat like that in C++, or you could use coroutines or a task-based system like Intel TBB to implement something kinda like this. It of course wouldn't be a first-class thing like in Concurnas, but I reckon you could implement the basic idea.

As far as languages go, the ideas you showed look similar to how Esterel[3] works, or perhaps Occam[4].

[1] http://reactivex.io/

[2] https://github.com/hoplon/javelin

[3] https://en.wikipedia.org/wiki/Esterel

[4] https://en.wikipedia.org/wiki/Occam_(programming_language)

Re:The Concurnas Programming Language by fulafel on Thursday May 28, 2020 @01:18AM (#23333642)
Also https://en.wikipedia.org/wiki/Dataflow_programming has a list of 30+ languages.
Re:The Concurnas Programming Language by smithza on Wednesday May 27, 2020 @05:51PM (#23330521)
Thanks for these. Looks like Esterel commonly compiles to C and I would imagine uses some features of pthreads along with task-based scheduling as you mentioned.
Re:The Concurnas Programming Language by jcelerier on Thursday May 28, 2020 @02:29AM (#23334114)
That's partly how Qt's QML works (which makes it a breeze for UI): https://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html
Re:The Concurnas Programming Language by willtim on Thursday May 28, 2020 @02:45AM (#23334223)
In a language that supports Monads (e.g. Haskell or Scala), the above could be implemented as a library.
Re:The Concurnas Programming Language by artemonster on Thursday May 28, 2020 @11:25AM (#23338411)
can you recommend something to read to be able to understand more parctically HOW to implement those with monads? thank you
Re:The Concurnas Programming Language by willtim on Thursday May 28, 2020 @12:38PM (#23339340)
Monads are a pattern for sequential composition of effectful computations (i.e. statements). Some expessive languages, such as F#, Haskell and Scala support a special overloadable syntax for any arbitrary monad, therefore giving a fully programmable notion of statements.

For background reading in this area, perhaps start with "A poor man's concurrency Monad" by Claessen, it's a very easy read and shows how green threads can be written as a user library allowing pluggable schedulers. F# also implements its asynchronous workflows using essentially this technique, see "The F# Asynchronous Programming Model". LINQ and the reactive library Rx from C# are also great examples of Monads.

Re:The Concurnas Programming Language by edem on Thursday May 28, 2020 @04:13AM (#23334796)
You can do this in Kotlin if you want to. It comes with coroutines support out of the box. With things like Channel and select you could implement trans as well.
Re:The Concurnas Programming Language by fluffything on Thursday May 28, 2020 @10:16AM (#23337500)
Most languages implement these as a library.