Comments (6)
I haven't checked the syntax against the current interpreter, but that should work.
To get the value you would do something like
var r = Fib.fib(9);
when (r) {
// do something with r.v
f(r.v)
}
Now this will run the function f with the value that the parallel computation has calculated.
from verona.
I haven't checked the syntax against the current interpreter, but that should work.
To get the value you would do something like
var r = Fib.fib(9); when (r) { // do something with r.v f(r.v) }
Now this will run the function f with the value that the parallel computation has calculated.
thanks mjp41. I want to concurrent execution Fib.fib(x - 1) and Fib.fib(x - 2), then get their result ,like this:
when ()
{
p1 = Fib.fib(x - 1);
};
when () {
p2 = Fib.fib(x - 2);
};
when (p1, p2) {
var r = U64Obj.create(p1.v + p2.v);
...
};
I found it is hard to written.
from verona.
In the final syntax, this should end up looking something like:
p1 = when ()
{
Fib.fib(x - 1);
};
p2 = when () {
Fib.fib(x - 2);
};
when (p1, p2) {
var r = U64(p1.v + p2.v);
...
};
We don't yet have an implementation that is at a state where we can write things like this yet. Hopefully soon...
from verona.
In the final syntax, this should end up looking something like:
p1 = when () { Fib.fib(x - 1); }; p2 = when () { Fib.fib(x - 2); }; when (p1, p2) { var r = U64(p1.v + p2.v); ... };
We don't yet have an implementation that is at a state where we can write things like this yet. Hopefully soon...
thanks davidchisnall. I want to know, whether p1 and p2 types are promise[cown[U64Obj]&imm] above example? or p1 and p2 types are are cown[U64Obj]&imm ?
- if type is promise[cown[U64Obj]&imm], can it be the args of
when
? - if type is cown, so cowns p1 and p2 Indicate asynchronous tasks here?
from verona.
So in the prototype, Promises are derived from cowns. This was to get things quickly working for a few examples. We have a few ideas of making them a first class concept. Either way we would intend them to be used in when
.
from verona.
I want to know, whether p1 and p2 types are promise[cown[U64Obj]&imm] above example? or p1 and p2 types are are cown[U64Obj]&imm ?
Specifically on this, you definitely won't have a promise[cown[T]]
for something like this (unless you explicitly want to return a cown[T]
from a promise. It's still an open question whether promise[T]
will be a subtype of cown[T]
, or whether promise[T]
and cown[T]
will be subtypes of some whenable[T]
(and, if so, whether that's an explicit thing in the type system).
from verona.
Related Issues (20)
- check for failure in Library.alloc
- Problem about iso type class field HOT 1
- Why not use a more C/C++ like syntax? HOT 2
- verona develop progress , any compare with google carbon language. HOT 2
- Is this project dead? HOT 2
- Move to later version of Mac OS HOT 1
- so it has eventualy dead? HOT 1
- Fuzzing failure
- Shadowing of Self type name leads to looping in structure pass
- Looping in validtypeargs pass HOT 1
- Write language specification
- Write Lexical Elements section of Language Spec
- Write Program Structure section of Language Spec
- Write Expression Structure section of Language Spec
- Write Region Model section of Language Spec
- Write Types section of Language Spec
- Write Type Inference and Checking section of Language Spec
- Write Region section of Language Spec
- Write Concurrency section of Language Spec
- Default args do not correctly report error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from verona.