IRC channel logs
2025-02-27.log
back to list of logs
<dckc>I think I transcribed it to idris at some point... <dckc>my browser says it needs its diaper changed. likewise my OS says it needs to reboot. <dckc>I kinda like the way the browser cries louder and louder as time goes by <dckc>ok... back on top... Agoric support for OCapN... <dckc>or... compiling MontE using guile macros... <dckc>darn it; spent all that time swapping in monte but didn't find a "works in one case" target to aim at. <andreas-e>Hello! Excuse me if I am going to ask what sounds more or less like the same question I asked yesterday; it is about scheduling and interleaving of $ and <-. <andreas-e>Do I understand that (with-vat is blocking, in the sense of not letting incoming <- messages through? <andreas-e>So with a cell actor, say we have the following code: <andreas-e>(with-vat vat ($ cell 2) ($ cell (* 2 ($ cell)))) <andreas-e>and also an "external" message "(<- cell 3)" from some other actor. <andreas-e>Then my understanding is that either in the end, cell contains 4 (if <- is handled before the (with-vat block); or it contains 3 (if <- is handled after the block). <andreas-e>But it is never 6, which could happen if the <- were treated in between two ($ cell calls inside the (with-vat block. <andreas-e>This would also be consistent with a deadlock I observed when I put the with-vat too generously around a larger code block, because I found it tedious to write many fine-grained with-vat. <tsyesika>yep that's correct. the cell would either be 3 or 4 but never 6. <andreas-e>Okay, thanks! I wonder if this could be documented somehow. Probably not easily... Or is it in some Goblins/OcapN design document? Or maybe it is just me who is slow in understanding the difference between $ and <- and the meaning of with-vat. <tsyesika>it can take a little bit to get the hand of but $ you can think of as basically an immediate invocation, it's a function call to an actor with the goblins machinery invoked :) It's not going to be queued up in a queue of other messages. `<-` (and `<-np`) both just queue up a message on the vat the actor is in and those will be processed when gets to them, it's a FIFO. <tsyesika>with-vat is basically spawning a new dummy actor (called ^call-with-vat, you sometimes see it in questie), this actor has it's behavior the body of your with-vat as the actors behavior and so your (with-vat vat ($ cell 2) ($ cell (* 2 ($ cell)))) example is similar to the cons example yesterday. The two $ calls will be handled together. call-with-vat also runs a churn not turn <tsyesika>not sure if explaining the underlying machinery is helpful or not :) <tsyesika>if it's not helpful just ignore what I said <andreas-e>No, it is quite helpful! So the dummy actor cannot receive <- messages, and its content becomes atomic. This sounds like useful behaviour (and nevertheless a source of potential deadlocks...). The thing I was missing yesterday is that <- cannot come in the middle of a with-vat. <tsyesika>you can do `on`s and handle promises within with-vat <andreas-e>This is not really clear from the explanation that $ is "immediate"; what does it mean for two consecutive $ calls, if the first one takes 10 minutes? Before I thought that the <- handling was somehow happening in a parallel "thread" (which probably makes no sense, since it can entail other lengthy computations and more $ and <-, so could end up in arbitrary parallelism). <andreas-e>Ah, promise handling could complicate things. So how about the following: <tsyesika>if you two two $ calls within an actor `($ wait-10-minutes) ($ my-cell 'a)` for example. your first one will block the vat for 10 minutes, 10 minutes would go by, 'a would be set as the cell's contents and then assuming that's everything within the actor, the turn will be over and if you had also done a `(<- my-cell 'b)` during the wait-10-minutes it'll happen after the setting of 'a when the vat gets to that message <andreas-e>(with-vat vat (on promise (lambda _ ($ cell 3))) ($ cell 2) ($ cell (* 2 ($ cell)))) <andreas-e>Yes, I understood the 10 minutes after all! But rather by explaining that with-vat is "blocking" messages from entering. <andreas-e>The promise thing is also clear, I think: it waits for the promise to be fulfilled, then the cell contains 3, 2 and 4 in turn. <tsyesika>it'll actually not wait until the promise is resolved. It'll set 2 and then double it making it 4. Then later down the line, when the promise is fulfilled 3 will be set in the cell <tsyesika>so you could do for example `(define-values (vow resolver) (with-vat vat (spawn-promise-and-resolver)))`. Then do another with vat `(with-vat vat (on vow (lambda _ ($ cell 3))) ($ cell 2))`. the cell at this point will contain 2 and then in a later with-vat you can do `(with-vat vat ($ resolver 'fulfill 'value))` and then your cell will contain 3. <tsyesika>IRC is not doing us any favours with this formatting :) <tsyesika>the middle with-vat though which contains the `on` won't block until the promise resolves <andreas-e>Oh dear, I wonder how I manage to write any goblins code with my lack of understanding how it all works! But by miracle, I do. My first milestone for the third blog post is working and written up. <andreas-e>So in my "on promise" example above, it is certain that the block setting the cell to 3 is executed after the "with-vat"? Even if the promise is already fulfilled, it would not set the cell to 3 and then to 2 and 4? <dthompson>okay I'm starting to get serious about why hoot programs don't work on webkit even though they've shipped wasm gc and tail calls <dthompson>one thing that's strange is that we were initially receiving reports of runtime errors, but I'm seeing validation issues. <dthompson>yesterday I got my own build of epiphany running with the latest webkitgtk unstable release. <dthompson>my hunch is that their wasm gc implementation is okay because that's fairly widely used. I don't know how many language implementations out there are using tail calls. relatively few, I imagine. <dthompson>I kind of expect this validation issue to be the first layer of a problem onion. we'll see <dpk>Wasm_of_ocaml came out very recently. i wonder if they use tail calls and if so whether they’ve had any similar issues <dthompson>but if they don't use null refs they won't hit this issue <dthompson>I don't see any null refs in those search results so it could be that they don't use them at all <dthompson>fantazo: yeah idk I'm a little skeptical of the argument here <dthompson>author seems to be flopping between conflicting properties <dthompson>at the end it seems they are advocating for a language where, in a single function, you can somehow annotate what machine is calculating which sub-expression <dthompson>which sounds kind of like the inverse of the actor model <dthompson>I guess it wouldn't be to the satisfaction of the author, but if I'm building a distributed system with goblins I have control over which actors are on which machines, it's just that my code doesn't say "machine A do this, machine B do that" <dthompson>I understand the author's point of needing to know where the boundaries are for performance reasons. but I think that even though goblins makes an effort to make the network implicit, I still know it's there. I still have to setup ocapn and stuff. I can strategically place actors according to performance needs. <dckc>"what does it mean for two consecutive $ calls, if the first one takes 10 minutes?" the vat model is communicating event loops. It's cooperative multitasking. A turn (processing a message) is never preempted. (it could be aborted altogether, but never resumed)