Hello, I'm currently investigating whether capt'n proto schema would be appropriate for describing Webassebly interfaces. I'm attempting to translate this interface <https://github.com/WebAssembly/WASI/blob/master/docs/WASI-overview.md> to capn proto schema. I several questions and I'm sure I'll have more as the work progresses.
1. Webassebly will soon have opaque references <https://github.com/WebAssembly/reference-types>. How would you represent reference types in capt'n proto? 2. Is annotation the correct way to represent pointers? for example using Pointer = UInt32; using TimestampT = Uint64 # Return the resolution of a clock. # Note: This is similar to clock_getres in POSIX. > clockResGet @2 ( > clock_id :ClockId, # The clock for which to return the resolution. > resolution :Pointer $type("TimestampT") # The resolution of the clock. > ) -> ( > error :ErrnoT > ); Here I need to generate the corrisponding wasm signature > (func $clockResGet(param $clock_id i32)(param $resolution_pntr i32) > (return i32)) But what I really want to write in captn proto is using Pointer = UInt32; > using TimestampT = Uint64 > # Return the resolution of a clock. > # Note: This is similar to clock_getres in POSIX. > clockResGet @2 ( > clock_id :ClockId, # The clock for which to return the resolution. > ) -> ( error :ErrnoT, resolution :TimestampT > ); But I can't do this because because wasm doesn't have mutiple return values and I can't automatically generate the correct wasm signature in all cases since I'm porting a old interface and some times the output pointers are not always in the same order. Another Option I thought about was this. using Pointer = UInt32; > using TimestampT = Uint64 > # Return the resolution of a clock. > # Note: This is similar to clock_getres in POSIX. > clockResGet @2 ( > clock_id :ClockId, # The clock for which to return the resolution. > ) -> ( > error :ErrnoT, > resolution :TimestampT $arg_index(1) > ); Here the annotation "$arg_index" say what param index to put the output pointer in wasm function signature. I think this solution might be the best for now. But I would love to hear some feedback. -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/capnproto. To view this discussion on the web visit https://groups.google.com/d/msgid/capnproto/97ca4d77-dee9-40e4-b668-ccf518a3674a%40googlegroups.com.