Conversation
|
Note that it's not necessary for Ir.LetD to return values, since that is taken care fo by desugaring. After FuncD is replaced with FuncE in the IR, all non-ExpD decs should have type () there. |
|
Hello from above the Caribbeans. We might have a race going on with #189 now :-) |
|
Although, this seems to be only affecting the front-end until IR. Nice decoupling :-) |
Are you sure we will be able to support that? My current implementation strategy for closed actors is “serialize upon actor initialization”, which means that everything needs to be defined, with a special case for actors. |
nomeata
left a comment
There was a problem hiding this comment.
I have qualms about the changes to the definedness checker. In any case, instead of deleting test cases, just move them to run if they ought to work now.
|
I suggest you leave in your change to I will then deal with it together with AST-49 (closing over values in actors). |
|
Ah, you raised that point on JIRA. Let’s continue here, ok? You wrote
|
|
So, the design I had in my mind would
This design does not allow actors to capture values that are defined later other than actorrefs (and I expect that you have no great sympathy for such discontinuities). But the bigger problem is: This only works with So the only alternative I see right now is:
By that time, all definitions from any recursive declaration group have been filled in. This has the problem that in the case of
|
What's the difference, given that they are interchangeable modulo an auxiliary BlockE or LetD?
Yes, that was my conclusion as well. Especially since you can create a dynamic number of actors, e.g., in a loop. (Though in this case I couldn't find an example where either the actor is never used, or there is a local eager use in that loop.)
I'm not sure "end of current message" is late enough for async. Consider:
Right. I think the more uniform approach is to invoke init right before the point where the actor is first "eagerfied", either directly or transitively. The definedness check should imply that at this point (1) all references are available, while (2) nobody has used it yet. This requires no RTS-managed queue, only some syntactic transformations to make the necessary values accessible at the right point -- e.g. as a closure build locally but invoked at the aforementioned point. It should be compatible with both async and with dynamically created actors. Unused actors (that are never eagerified) would never be initialised, but that's fine because they are dead code.
Yeah, would be great if we could avoid such a special mechanism in the OS.
Maybe I'm misunderstanding this, but isn't that the Dfn semantics already? Just for the sake of concrete example of the message ordering problem, let's take this minimal piece: At point (*), A would implicitly send the init message to B. It would then send a message to C passing along B. After that, C could send f to B. The problem is that there is no guarantee that B receives init before f. This is exactly the transitive message ordering problem. We'd need some kind of barrier mechanism. Would it work to make the init message return an async (), so that we can synchronise on it? Then the above could be transformed into s.th like Of course, when meth sends multiple messages this gets slightly more tricky, since we still need to maintain their order, so they cannot be put into separate asyncs. Hm... |
With With I cannot instantiate Note that you cannot express that code directly with
Ugh, async. I don’t think about async, it seems, it has been translated away already when I start to come in :-)
That sounds promising. Will think about it on the next flight.
Is that sound? Actors can have side-effects (e.g. call further actors during their initialization).
Precisely, but currently the hypervisor maintains that queue; with this change we might have to maintain another queue in the RTS. Also, we could then re-order the message to put all init calls first.
Would this restrict actor creation to contexts where an Boarding flight to Zurich now. |
I don't see why not. How would be any different?
Ah, good point. So there would need to be a special case for actors that are never forced explicitly.
But why would this be necessary?
No, see my example. Only message sends would need async, but you can always locally introduce async expressions. That's not observable for (individual) message sends, since they are async anyway (though the message ordering guarantee with multiple sends remains trickier). I should also mention that we probably don't need to solve the general problem for the pre release. For that, only actors need to work. |
Ah, I see: I was not considering the nested-block scenario, and the solution in the back of my head would look at tl;dr: You are right, that should be equivalent.
If we hold off sending the I still hope we can do something better than such a heavy synchronization protocol. How about the variant where the receiving actor queues incoming message until it has seen the |
|
Even with local actors out-of-scope for the preview release, this is still useful (and the only pain points are around local actors). And we should also not waste work, so I propose we invest enough work to merge this (and #189) without breaking too much existing support for actors. With Andreas being away for a while, I suggest I take over this PR, address my own concerns, and then get it merged. |
and just accept the current output (which is the backend complaining about a non-closed actor).
|
I also did the corresponding |
| at = no_region; | ||
| note = { S.note_typ = T.unit; (* ! *) | ||
| S.note_eff = eff exp; } | ||
| note = exp.note; |
There was a problem hiding this comment.
Is this deliberate? Joachim, have you changed the IR letD to also return the value of rhs?This contradics Andreas first comment on the PR:
" Note that it's not necessary for Ir.LetD to return values, since that is taken care fo by desugaring. After FuncD is replaced with FuncE in the IR, all non-ExpD decs should have type () there"
There was a problem hiding this comment.
Oh, I guess I was confused when I wrote that. But I am fixing this in #196 in any case (including Check_ir), so it’s fine for now if we merge both.
In fact, I want to refactor BlockE further to (dec list * exp), and then declarations have no type at all (which means less to check in Check_ir and worry about in Construct).
| if Type.is_unit note.S.note_typ && not (is_expD (Lib.List.last ds')) | ||
| then I.BlockE (ds' @ [expD (tupE [])]) | ||
| else I.BlockE (ds') | ||
| let prefix, last = Lib.List.split_last ds' in |
There was a problem hiding this comment.
What if ds is [], won't split_last fail? Do we rule out empty blocks earlier? Even if so, maybe add an assert...
There was a problem hiding this comment.
Never mind - the diff just doesn't show a previous S.Block [] case...
There was a problem hiding this comment.
In fact, in #196 Check_ir asserts that the list is non-empty, the afore-mentioned refactoring will make that explicit on the type level.
| @@ -1,4 +1,13 @@ | |||
| (unknown location): internal error, Env.Make(X).Clash("test") | |||
There was a problem hiding this comment.
do we know that is going on here?
There was a problem hiding this comment.
Yes, this is unrelated to this change (just the error message looks different now).
| func(5 or _ : Nat) {}; | ||
| func(_ or 6 : Nat) {}; | ||
| func((_ or _) : Nat) {}; | ||
| func f1(_ : Nat) {}; |
There was a problem hiding this comment.
are anonymous functions not allowed anymore? Or is this just a trivial change?
There was a problem hiding this comment.
This was done by Andreas, I don’t know why.
Branch: master Commits: [dfinity/candid@25fb8470...322ea4a2](dfinity/candid@25fb847...322ea4a) * [`ea2c72f5`](dfinity/candid@ea2c72f) support reference types ([dfinity/candid#153](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/153)) * [`d48bc04c`](dfinity/candid@d48bc04) fix record_nesting_depth for native Rust types ([dfinity/candid#155](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/155)) * [`e54d3e4a`](dfinity/candid@e54d3e4) support more Rust built-in types ([dfinity/candid#156](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/156)) * [`3b3637e1`](dfinity/candid@3b3637e) release ([dfinity/candid#157](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/157)) * [`98d73586`](dfinity/candid@98d7358) debug print for values ([dfinity/candid#159](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/159)) * [`620ad802`](dfinity/candid@620ad80) fix debug print * [`01d23d61`](dfinity/candid@01d23d6) Candid test suite: More tests related to references ([dfinity/candid#160](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/160)) * [`c59c2fd1`](dfinity/candid@c59c2fd) release * [`3ac7e9d3`](dfinity/candid@3ac7e9d) fix type annotation in parser ([dfinity/candid#162](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/162)) * [`432c4289`](dfinity/candid@432c428) A Candid users’s guide ([dfinity/candid#158](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/158)) * [`315cb991`](dfinity/candid@315cb99) Coq: MiniCandid ([dfinity/candid#147](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/147)) * [`83fdff28`](dfinity/candid@83fdff2) Improve wording for type mismatches ([dfinity/candid#167](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/167)) * [`3028f5ed`](dfinity/candid@3028f5e) Lg/candid rev pre split ([dfinity/candid#169](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/169)) * [`6c8d4e39`](dfinity/candid@6c8d4e3) Lg/candid users guide ([dfinity/candid#170](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/170)) * [`0c2205fc`](dfinity/candid@0c2205f) FIx typo toll>tool ([dfinity/candid#172](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/172)) * [`63d9f6fd`](dfinity/candid@63d9f6f) Test suite: A test that invalid unicode in method names is rejected ([dfinity/candid#174](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/174)) * [`dad82102`](dfinity/candid@dad8210) generate random candid values ([dfinity/candid#166](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/166)) * [`2720d995`](dfinity/candid@2720d99) Release ([dfinity/candid#176](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/176)) * [`9fbffdcc`](dfinity/candid@9fbffdc) Meta-Theory: Clarify transitive coherence ([dfinity/candid#173](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/173)) * [`8acbbd47`](dfinity/candid@8acbbd4) Update README.md * [`05ff9f82`](dfinity/candid@05ff9f8) Fix RUSTSEC-2020-0122 by upgrading logos which upgrades beef ([dfinity/candid#179](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/179)) * [`b65c0859`](dfinity/candid@b65c085) Candid test suite: Method sorting test ([dfinity/candid#177](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/177)) * [`8df6e6c0`](dfinity/candid@8df6e6c) bump ui * [`1977fdb3`](dfinity/candid@1977fdb) Typescript binding for Candid ([dfinity/candid#181](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/181)) * [`0c988a9a`](dfinity/candid@0c988a9) Lg/rust js type mapping ([dfinity/candid#180](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/180)) * [`b80a2389`](dfinity/candid@b80a238) Doc typo ([dfinity/candid#182](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/182)) * [`b4a73dea`](dfinity/candid@b4a73de) support more Rust types for serialization ([dfinity/candid#185](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/185)) * [`14f50bc6`](dfinity/candid@14f50bc) fix typescript binding for references ([dfinity/candid#184](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/184)) * [`6e35c0e2`](dfinity/candid@6e35c0e) Release ([dfinity/candid#186](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/186)) * [`05df9eb3`](dfinity/candid@05df9eb) Candid users guide: Linebreak example pretty printing ([dfinity/candid#188](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/188)) * [`322ea4a2`](dfinity/candid@322ea4a) [rust] Fix reserved subtyping
## Changelog for candid: Branch: master Commits: [dfinity/candid@0c2205fc...322ea4a2](dfinity/candid@0c2205f...322ea4a) * [`63d9f6fd`](dfinity/candid@63d9f6f) Test suite: A test that invalid unicode in method names is rejected ([dfinity/candid#174](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/174)) * [`dad82102`](dfinity/candid@dad8210) generate random candid values ([dfinity/candid#166](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/166)) * [`2720d995`](dfinity/candid@2720d99) Release ([dfinity/candid#176](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/176)) * [`9fbffdcc`](dfinity/candid@9fbffdc) Meta-Theory: Clarify transitive coherence ([dfinity/candid#173](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/173)) * [`8acbbd47`](dfinity/candid@8acbbd4) Update README.md * [`05ff9f82`](dfinity/candid@05ff9f8) Fix RUSTSEC-2020-0122 by upgrading logos which upgrades beef ([dfinity/candid#179](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/179)) * [`b65c0859`](dfinity/candid@b65c085) Candid test suite: Method sorting test ([dfinity/candid#177](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/177)) * [`8df6e6c0`](dfinity/candid@8df6e6c) bump ui * [`1977fdb3`](dfinity/candid@1977fdb) Typescript binding for Candid ([dfinity/candid#181](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/181)) * [`0c988a9a`](dfinity/candid@0c988a9) Lg/rust js type mapping ([dfinity/candid#180](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/180)) * [`b80a2389`](dfinity/candid@b80a238) Doc typo ([dfinity/candid#182](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/182)) * [`b4a73dea`](dfinity/candid@b4a73de) support more Rust types for serialization ([dfinity/candid#185](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/185)) * [`14f50bc6`](dfinity/candid@14f50bc) fix typescript binding for references ([dfinity/candid#184](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/184)) * [`6e35c0e2`](dfinity/candid@6e35c0e) Release ([dfinity/candid#186](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/186)) * [`05df9eb3`](dfinity/candid@05df9eb) Candid users guide: Linebreak example pretty printing ([dfinity/candid#188](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/188)) * [`322ea4a2`](dfinity/candid@322ea4a) [rust] Fix reserved subtyping
## Changelog for candid: Branch: master Commits: [dfinity/candid@0c2205fc...322ea4a2](dfinity/candid@0c2205f...322ea4a) * [`63d9f6fd`](dfinity/candid@63d9f6f) Test suite: A test that invalid unicode in method names is rejected ([dfinity/candid#174](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/174)) * [`dad82102`](dfinity/candid@dad8210) generate random candid values ([dfinity/candid#166](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/166)) * [`2720d995`](dfinity/candid@2720d99) Release ([dfinity/candid#176](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/176)) * [`9fbffdcc`](dfinity/candid@9fbffdc) Meta-Theory: Clarify transitive coherence ([dfinity/candid#173](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/173)) * [`8acbbd47`](dfinity/candid@8acbbd4) Update README.md * [`05ff9f82`](dfinity/candid@05ff9f8) Fix RUSTSEC-2020-0122 by upgrading logos which upgrades beef ([dfinity/candid#179](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/179)) * [`b65c0859`](dfinity/candid@b65c085) Candid test suite: Method sorting test ([dfinity/candid#177](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/177)) * [`8df6e6c0`](dfinity/candid@8df6e6c) bump ui * [`1977fdb3`](dfinity/candid@1977fdb) Typescript binding for Candid ([dfinity/candid#181](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/181)) * [`0c988a9a`](dfinity/candid@0c988a9) Lg/rust js type mapping ([dfinity/candid#180](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/180)) * [`b80a2389`](dfinity/candid@b80a238) Doc typo ([dfinity/candid#182](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/182)) * [`b4a73dea`](dfinity/candid@b4a73de) support more Rust types for serialization ([dfinity/candid#185](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/185)) * [`14f50bc6`](dfinity/candid@14f50bc) fix typescript binding for references ([dfinity/candid#184](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/184)) * [`6e35c0e2`](dfinity/candid@6e35c0e) Release ([dfinity/candid#186](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/186)) * [`05df9eb3`](dfinity/candid@05df9eb) Candid users guide: Linebreak example pretty printing ([dfinity/candid#188](http://r.duckduckgo.com/l/?uddg=https://github.com/dfinity/candid/issues/188)) * [`322ea4a2`](dfinity/candid@322ea4a) [rust] Fix reserved subtyping
## Changelog for ic-hs: Branch: master Commits: [dfinity/ic-hs@406decfa...9152a0ff](dfinity/ic-hs@406decf...9152a0f) * [`d4db8d07`](dfinity/ic-hs@d4db8d0) bump nixpkgs to 7c786944f801745310578d1cfc019923396f830c ([dfinity/ic-hs#163](https://github.com/dfinity/ic-hs/issues/163)) * [`31d535d2`](dfinity/ic-hs@31d535d) increase the number of allowed delegations in a request from 4 to 20 ([dfinity/ic-hs#166](https://github.com/dfinity/ic-hs/issues/166)) * [`4a310c0d`](dfinity/ic-hs@4a310c0) support ic0.is_controller ([dfinity/ic-hs#169](https://github.com/dfinity/ic-hs/issues/169)) * [`5fc27bdc`](dfinity/ic-hs@5fc27bd) do not include keep-alive header in httpbin response ([dfinity/ic-hs#170](https://github.com/dfinity/ic-hs/issues/170)) * [`96448083`](dfinity/ic-hs@9644808) drop nix-build-uncached ([dfinity/ic-hs#175](https://github.com/dfinity/ic-hs/issues/175)) * [`c6fbe1f7`](dfinity/ic-hs@c6fbe1f) increase ingress_expiry in reference test suite ([dfinity/ic-hs#176](https://github.com/dfinity/ic-hs/issues/176)) * [`a1b3f670`](dfinity/ic-hs@a1b3f67) add Connection: close header to httpbin ([dfinity/ic-hs#178](https://github.com/dfinity/ic-hs/issues/178)) * [`d3812ffc`](dfinity/ic-hs@d3812ff) increase delegation expiry in tests ([dfinity/ic-hs#182](https://github.com/dfinity/ic-hs/issues/182)) * [`40a46e2f`](dfinity/ic-hs@40a46e2) sync universal-canister with IC repo ([dfinity/ic-hs#177](https://github.com/dfinity/ic-hs/issues/177)) * [`7a6259c2`](dfinity/ic-hs@7a6259c) decrease number of threads and request submission latency ([dfinity/ic-hs#179](https://github.com/dfinity/ic-hs/issues/179)) * [`a9f73dba`](dfinity/ic-hs@a9f73db) fix decoding compressed WASM modules during snapshotting ([dfinity/ic-hs#184](https://github.com/dfinity/ic-hs/issues/184)) * [`64c19a95`](dfinity/ic-hs@64c19a9) bump nixpkgs to eaf03591711b46d21abc7082a8ebee4681f9dbeb ([dfinity/ic-hs#189](https://github.com/dfinity/ic-hs/issues/189)) * [`9152a0ff`](dfinity/ic-hs@9152a0f) add date header to httpbin responses and make http header names lower-case ([dfinity/ic-hs#188](https://github.com/dfinity/ic-hs/issues/188)) Includes and closes #3915. Reason: `ic-hs` and `nixpkgs` must be in sync, so that the artefact caching can work.
Remove binding identifiers from Obj and Func forms and desugar them into lets:
letreturn its RHS valuelet x = actorback intoactor xin IRFuncE still carries a name, but this is only used for tracing outputs, it is no longer semantically relevant.
TODO(joachim): replace FuncD with FuncE in IR and compiler (I tried, but did not understand code generation well enough)
TODO(joachim): handle free and forward references in actors