Message from JavaScript discussions
December 2018
— The actual equation itself executes identically to regular JS code
When a yield happens, another function gets a chance to run a chunk of work, then control is returned to the first function
— If you wanted to run specific parts concurrently, you do:
spawn chunkOne();
spawn chunkTwo();
— Read what I wrote man
— Otherwise,
chunkOne();run as normally expected
chunkTwo();
— ^ does this look simultaneous?
— Indeed without the use of spawn
, there is no concurrency in an hz program, and it runs with the same execution style as it was before it was compiled
— Okay, let's go back. i asked for an "real-world" example, running two "prepared" functions simultaeously is okay, but if you call them synchroneous, then they generally are not prepared
— Let's say you abstract:f = n => n + n * n;
Now you can calculate different numbers simultaneously:
spawn f(2);
spawn f(4);
— What does "prepared" mean?
— Assuming "prepared" means async / interruptible:
HertzScript makes EVERY function "prepared"
— Will not collide, may be run in any order, etc