Jump to content
  • Advertisement
  • entries
    628
  • comments
    1454
  • views
    1011768

Speculation and such

Sign in to follow this  
ApochPiQ

997 views

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!
Sign in to follow this  


10 Comments


Recommended Comments

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

Share this comment


Link to comment

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

Share this comment


Link to comment

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

Share this comment


Link to comment

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

 

Objects are tasks, and they communicate via message passing.

Share this comment


Link to comment

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.

Share this comment


Link to comment
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.

Share this comment


Link to comment

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

Share this comment


Link to comment

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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!