Speculation and such

Published September 10, 2013
Advertisement
Just fooling around.


//// Define an Epoch task that does some work//task Worker :{ // // This specifies a "message signature" which can be // used by and instance of this task to receive data // and commands from other code. // Work : integer a, integer b { // Do some computation integer result = a + b // Reply to the sender of the message with another // message, carrying the fact that we're done, and // the result of our computation. sender ~> Completed(result) }}//// Define another task, which is responsible// for generating work. It also must contain// the message response signature for taking// the results back from the worker.//task Requester :{ // // This message tells the requester to make up some work // Request : Worker ref worker { // Generate some data integer a = random() integer b = random() // Work on it! // This syntax directs the Work message to reply to this // task when it is done. The responses will be delivered // via Completed messages. worker ~> Work(a, b) ~> self } // // This message is received when the worker // is done doing its thing. It prints stuff // so work has some visible effect. // Completed : integer result { print(cast(string, result) ; " came from task!") }}//// Now we write a standard entrypoint procedure.// We're going to create a worker pool, and then// fire work at each worker a whole bunch.//entrypoint :{ // First our pool of workers... // This syntax allocates an object (task) which is garbage collected as necessary new Worker w1 new Worker w2 new Worker w3 new Worker w4 // Now a wrapper to handle requests... new Requester r // And now we get busy! integer workcount = 0 while((workcount++) < 1000) { r ~> Request(w1) // Asynchronously pass Request message with no reply expected r ~> Request(w2) r ~> Request(w3) r ~> Request(w4) }}
Voila - 4 core random number summation engine!
4 likes 10 comments

Comments

popsoftheyear

Hmm interesting. Eagerly anticipating more. Will parallel capabilities be part of the core language?

September 10, 2013 01:58 AM
ApochPiQ
Yes. Epoch has no object model; instead, everything is composed of tasks, communicating via message passing.
September 10, 2013 05:08 AM
3Ddreamer

That got my interest, big time.

Epoch seems to be a garbage collection language, but are there plans for threading and memory management extensions?

Yes. Epoch has no object model; instead, everything is composed of tasks, communicating via message passing.

Are you saying that Epoch is not an OO language? Are you saying that it will always lean toward logic coding?

Please pardon the provocative questions. ;)

Clinton

September 10, 2013 11:59 AM
jjd

Yes. Epoch has no object model; instead, everything is composed of tasks, communicating via message passing.

"// This syntax allocates an object (task)..."

A little confused by this. Do you mean there are a fixed set of objects/tasks that are a part of the language that can be created?

-Josh

September 10, 2013 12:25 PM
swiftcoder

Reading between the lines, 'has no object model' != 'has no objects'.

Objects are tasks, and they communicate via message passing.

September 10, 2013 02:20 PM
3Ddreamer

Yeah, but that doesn't necessarily mean that he doesn't have it in the works or that it is not supported. Communicating via message passing can have another explanation for it.

September 10, 2013 03:26 PM
ApochPiQ
Epoch is not an "OO language" in the sense of Java, no. It closely parallels the original idea of object orientation (message passing) but isn't really something you would think of as OO in the colloquial sense.

Concurrency is supported entirely via tasks, similar to Go, which leads to natural parallelization support. Explicit threading is unnecessary.

There may be some built-in tasks in the standard library but mostly they'd be things end-programmers create.
September 10, 2013 06:18 PM
3Ddreamer

That is exactly what I needed to know.

How are you going to license this language when it is ready? I am interested in using it someday.

Clinton

September 10, 2013 07:36 PM
ApochPiQ

The implementation is and has always been free open source under the New BSD license. Use of the toolchain to write software is completely free and without licensing restrictions.

September 10, 2013 08:32 PM
3Ddreamer

Thanks

September 11, 2013 01:45 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement