how do you hand-write wasi-cli modules?
the component model explainer is not good enough for this
ah we see, it's too unstable to use, literally any typos will cause it to panic
Component Model book shows some examples in different languages. If by hand you mean using WAT this page shows a really simple starting example (but not a full wasi:cli world example, would probably use another lang for a full cli example but don't know what your use-case is): https://component-model.bytecodealliance.org/language-support.html#language-agnostic-tooling
This example from the component book shows a command component (using wasi:clii/run) written in rust: https://component-model.bytecodealliance.org/tutorial.html#create-a-command-component
why's there soooooo much boilerplate
(component
(core module $Main
(func (export "run") (param) (result i32)
i32.const 1
)
)
;; we don't know what the wasm folks have been cooking but wasip1 took
;; SIGNIFICANTLY less boilerplate than this...
;; seriously, wasip2 is such a massive downgrade for readability...
;; maybe "Component Model Proposal" is a misnomer, they should call it
;; "Wasm Obfuscation Proposal" instead. lmao.
(core instance $main (instantiate $Main))
(alias core export $main "run" (core func $run))
(type $uh (result))
(type $uhh (func (result $uh)))
(func $run (type $uhh) (canon lift (core func $run)))
(component $main
(type $uh (result))
(type $uhh (func (result $uh)))
(import "import-func-run" (func $uh (type $uhh)))
(type $uhhh (result))
(type $uhhhh (func (result $uhhh)))
(export "run" (func $uh) (func (type $uhhhh)))
)
(instance $main (instantiate $main
(with "import-func-run" (func $run))
))
(export "wasi:cli/run@0.2.0" (instance $main))
)
I wouldn't mind answering questions like this but you are taking a particularly hostile tone and it seems like you are assuming bad faith on those involved in development. I would ask that you change how you communicate here as that may help foster answers to your questions.
most of the boilerplate is dealing with the fact that a module instance is not a component instance (?)
oh, may we share an itemized list of reasons why we're being somewhat hostile? it involves things like "why is compiling wasm-tools so slow (at least we only have to do it once)" "why's the explainer the only barely-decent source of information on components (and still doesn't explain things well enough to be able to write a wasi cli app using only the explainer as reference - we had to decompile/reverse-engineer a rust cli app to gather enough information for this)" "why is wasmtime overshadowing wabt" "[historical experiences with rust folks, which we shall not rehash here]" among others.
the original proposal for component model was that it was simply an ABI thing, you'd compile components and turn them into wasm modules. the current proposal is that component model is... we actually don't know what it is, we can't figure out what it is, it reminds us of wasm-c-api, as a binary RPC format, with some more stuff thrown on top, so we can do things like load modules and instantiate modules and link modules the same as we would if we were using wasm-c-api, and then there's all this stuff about worlds and resources which aren't in wasm-c-api
@Soni L. You're being an ass to the very people you're ostensibly asking to help you. This is not a place to vent. Try Twitter?
but at that point we have this "wasm RPC format" which needs to be... loaded and instantiated like a wasm module, and then it loads and instantiates either more components or wasm modules, and it's just... why
(also it would be easier for ppl to understand if it were just called "wasm RPC" instead of "component model")
it is up to you to decide whether or not to accept feedback from someone who's been trying to figure out how to use "compoent model" aka wasm-rpc for as long as wasi preview 2 has been a thing, and is only now figuring it out
ultimately, the docs are written by ppl. and if someone had told us this is just RPC we would've figured it out ages ago.
Dearest Soni, I'm uninterested in feedback that assumes its own hostility is somehow fine. Go somewhere else, or submit a PR to the docs. Don't like preview 2? Don't use it. Or you might like it but need more information? Ask like a human, as other humans are involved, and they don't work for you.
For someone who has been "trying to figure out how to use" this for "as long as wasi preview 2 has been a thing" you haven't really appeared here that much and... simply asked. Of course the entire component model overview has the explanation about "why" but didn't find that and didn't ask, right? here: https://github.com/WebAssembly/component-model.
Now, if reading that document doesn't help you, we'd love to know why but don't care whether you're "irritated" about it. That's on you, not anyone else.
if, however, you do not understand the docs, or are looking for material that isn't there, that's fine. Please ask. Like a human to another human. Happy to help humans, always.
The great thing about open source is that your own choices are essentially infinite. But they are YOUR choices, not ours. use something else! Entirely fine.
From here, I feel like this thread isn't going to go somewhere productive for anyone and it might be best not to continue it.
you're right, it likely isn't.
however, there are people who continue to enter the zulip who have expectations that are not met. it is important to ensure the tone of communication is established so that they can properly adjust their expectations in a comfortable way.
sorry
Last updated: Dec 23 2024 at 12:05 UTC