News for hackers. Stuff that matters.
Re:WebAssembly Interface Types: Interoperate with All the Th... by cesarb on Wednesday August 21, 2019 @02:55PM (#20760347)
> So, how exactly do you magically enforce affine type semantics in the data you pass to wasm-python

In Rust, calling foreign functions is considered unsafe, precisely for that reason: once you leave the boundaries of a single language, the compiler can no longer enforce these invariants for you.

Re:WebAssembly Interface Types: Interoperate with All the Th... by ori_b on Wednesday August 21, 2019 @03:02PM (#20760432)
So, the solution is to make more or less every foreign call unsafe. That's pretty close to the state of the art without wasm.

I'm not sure how satisfactory that is, especially when it is fairly idiomatic for many calls in garbage collected languages to both keep and return a reference (eg, builder pattern), which may lead to rust calling a destructor where the other language doesn't expect it.

Re:WebAssembly Interface Types: Interoperate with All the Th... by the_duke on Wednesday August 21, 2019 @03:32PM (#20760740)
If I understand the proposal correctly, it should actually be possible to auto-generate safe glue code.

These interface types can describe, eg, how to map a Python String or list to a generic representation (pointer + length), and Rust can then take this generic form and map it into a valid Rust string safely - with the intermediate guarantees verified by the WASM runtime.