3 ms·
Synchronous: reactions run to completion, i.e., there's no implicit preemption or real parallelism Does this mean a program will hang if e.g. disk or network a
by jessaustin 10y ago
Synchronous: reactions run to completion, i.e., there's no implicit preemption or real parallelism
Does this mean a program will hang if e.g. disk or network access takes too long?
- hisham_hm 10y agoYes in theory. But in practice the language includes "async" support so you can guard these few operations that may take long. Like in a functional language you assume everything is pure unless marked to have side-effects, here you assume every reaction is instant unless is something that has to be explicitly "awaited" for. It's a pretty clean model.
- fsantanna 10y agoExternal calls in C require an underscore (e.g., "_printf") to be easily trackable as possibly unsafe. Also, at some point in the code (e.g., after you include your libraries), one can disable these calls with a directive. But typically, one will use bindings for asynchronous libraries, such as libuv (https://github.com/fsantanna/ceu-libuv https://github.com/fsantanna/ceu-libuv).
- vanderZwan 10y agoAnother way of thinking about this (also mentioned in the docs somewhere) is that Ceu "pretends" that any reactive code finishes infinitely fast, similar to how garbage collected languages "pretend" that computers have infinite memory. Neither truly does, of course, but the idea is that for the vast majority of situations where either type of language is used, that's a good enough approximation, letting you vastly simplify the problem that you're solving.