It would be particularly helpful if ~dozreg-toplud can weigh in with a brief update on how Urwasm has developed since the original project description here.

The project advanced quite a bit, there is a presentation that explains the implementation of the Lia language and the interpreter. The interpreter is jetted and the jet matches the Nock implementation if the code is valid, does not run floating point arithmetic and does not reallocate memory. So the current goal is to fix all of that, most likely by adding code validation to wasm3 (the interpreter used in the jet) and by implementing floating point operations via softfloat library, among some other things.

One more thing: there is no more Lia to Wasm compilation, since I found how to express Lia scripts in Hoon! The script that gets evaluated against a given module is a state monad, which at the moment is expressed as a head-tagged noun.

Previously, Lia interpreter would take Wasm bytecode, a list of Lia scripts and some other parameters and compute the result of applying the scripts one after the other. Each script, when evaluated, returns a result and mutates Wasm interpreter state. The results of the first n-1 scripts would be discarded, and they would only be used to mutate Wasm state. The result of the last script would be returned, discarding the accumulated step. This avoids Wasm VM state marshalling, and in the future the state would be persisted/cached with the input noun as a key, allowing to continue a stateful computation across e.g. Arvo events without having to either decode/encode the state or rerun the list of scripts again.

The first three operations are simply to call a function, to read from and write to the memory buffer. There can be some other operations which I skip for brevity. %pure simply returns the contained noun and does not modify the state.

%bind is where magic happens. It is evaluated by first evaluating monad p, giving its result to the gate q which returns the next monad to evaluate. So all the gluing logic is written in Hoon as a series of binds, similarly to the IO monadic operations via Spider threads.

Initial plan to enable stateful computations was to append new scripts to run to the list of scripts. Now to append a new computation you would make a monad %bind prev-monad _new-monad, equivalent to Haskell's m1 >> m2.

The jetted monad reducer would work the same way it works in Nock, but instead of instantiating and updating a Wasm state as a noun it would handle wasm3 or some other interpreter's state.

The implementation of monads as head-tagged nouns limits the output type. It is possible to express them as actual gates $-(state [result state]) and to match batteries instead of head tags (something that I already did for another monad when experimenting). That way you could benefit from the polymorphism of ++bind and ++pure.

.

It would be particularly helpful if ~dozreg-toplud can weigh in with a brief update on how Urwasm has developed since the original project description here.

The project advanced quite a bit, there is a presentation that explains the implementation of the Lia language and the interpreter. The interpreter is jetted and the jet matches the Nock implementation if the code is valid, does not run floating point arithmetic and does not reallocate memory. So the current goal is to fix all of that, most likely by adding code validation to wasm3 (the interpreter used in the jet) and by implementing floating point operations via softfloat library, among some other things.

One more thing: there is no more Lia to Wasm compilation, since I found how to express Lia scripts in Hoon! The script that gets evaluated against a given module is a state monad, which at the moment is expressed as a head-tagged noun.

Previously, Lia interpreter would take Wasm bytecode, a list of Lia scripts and some other parameters and compute the result of applying the scripts one after the other. Each script, when evaluated, returns a result and mutates Wasm interpreter state. The results of the first n-1 scripts would be discarded, and they would only be used to mutate Wasm state. The result of the last script would be returned, discarding the accumulated step. This avoids Wasm VM state marshalling, and in the future the state would be persisted/cached with the input noun as a key, allowing to continue a stateful computation across e.g. Arvo events without having to either decode/encode the state or rerun the list of scripts again.

A Lia script thus can be understood as a Wasm state monad State -> Result State. So I define a head-tagged union:

```

+$ lia-monad

$% %call ...

%read ...

%write ...

... :: various basic stateful computations

%pure p=result

%bind p=lia-monad q=$-(result lia-monad)

```

The first three operations are simply to call a function, to read from and write to the memory buffer. There can be some other operations which I skip for brevity.

`%pure`

simply returns the contained noun and does not modify the state.`%bind`

is where magic happens. It is evaluated by first evaluating monad`p`

, giving its result to the gate`q`

which returns the next monad to evaluate. So all the gluing logic is written in Hoon as a series of binds, similarly to the IO monadic operations via Spider threads.Initial plan to enable stateful computations was to append new scripts to run to the list of scripts. Now to append a new computation you would make a monad %bind prev-monad _new-monad, equivalent to Haskell's m1 >> m2.

The jetted monad reducer would work the same way it works in Nock, but instead of instantiating and updating a Wasm state as a noun it would handle wasm3 or some other interpreter's state.

The implementation of monads as head-tagged nouns limits the output type. It is possible to express them as actual gates

`$-(state [result state])`

and to match batteries instead of head tags (something that I already did for another monad when experimenting). That way you could benefit from the polymorphism of`++bind`

and`++pure`

.No URL highlight? " a presentation" is a link.

No markdown code blocks? Test:

```

a = b + c

```

I see, I have to specify a language (even though there's no highlight)

or maybe I should've added a newline before the block:

URWASM NUMBAH ONE

Ur my number one ~tamlut-modnys <3

hi