If anyone who is excited about DFINITY has interested in AssemblyScript I would appreciate checking out my repos and attempting to run my examples. I currently develop on a Mac so a lot of the instructions I have cater to Mac users. WABT is required, which can be brew installed, to make modifications to the WAT to fit DFINITY nuances.
AssemblyScript has its limitations and I suggest checking out its quirks
I would like to point out that the Rust CDK and Motoko are light years ahead of the AS CDK, things like cross canister calls and a proper way of doing storage have not made its way into the current release.
Limitations
Int/Nat are arbitrary length integers and currently there is no library in assemblyscript, so you must use Int8/16/32/64
wasm2wat demo for converting a motoko/rust/c/as built WASM back to WAT. This is where you discover how your WASM export/imports should look like and if yours is building correctly.
@dfinity/agent More encode/decode help with generating the TypeTable (which is a reversed version of the Motoko/Rust version, this is tricky when you have custom types and need to increment their ids (not sure what the correct term for these are) in the correct order)
AssemblyScript discord: dcode and MaxGraey respond within minutes (do they sleep?)
I still have things to consider.
Would I just include the Assets WASM in my CLI? Where does the assets.wasm actually come from when I build a project? (High priority)
How would do I create better unit tests? It would be interesting to have a DFINITY Node.JS that loads my DFX canister and can run a bunch of requests against it to test my canister. This could be a community project. (Medium priority)
Support recursive types. It just needs to be implemented, but I want to switch how the assemblyscript is transformed/generated first. (Medium priority)
BigInt in AS Reference Source (example Impl by Microsoft) Has yet to be implemented in AS and I believe it could support the AS community. (Medium priority)
For cross canister calls, I usually just hardcode the ID of the other canister, how would I discover this when building for a canister not in my project? (Low priority)
How do I get AS to support spaces in exports? This requires changes to AssemblyScript compiler (Low priority as WABT/Regex can fix this)
Lots more things to think about, but it’s a WIP.
Again if anyone is passionate about AS and DFINITY, feel free to create Issues on GitHub and we can start knocking them down.
That’s a simple Motoko-based canister implementing a key-value store, that is pre-compiled and shipped with the SDK. The source (which is boring) will hopefully be available soon (just like all the other source…)
I think that’s the best you can do right now: For canisters within your project, dfx can maintain a mapping from canister alias to installed-id. For external canisters, some kind of DNS-like registry does not exist yet, so hard-coding canister ids is the way to go.
Heh, yes. Wasm is quite liberal and allows spaces, but not unexpectedly, some tools don’t support that. Did you report that issue upstream?
This is great thank you. It looks like I had some misconceptions.
dfx build automatically detects the “asset” type from the dfx.json and includes it in the build so I don’t actually need to do anything but have a properly configured dfx.json
I don’t actually need didc because it appears by having a properly define web asset it automatically generates my .did.js based off my .did
I was able to clone the Motoko phonebook example in AssemblyScript and leverage the same UI by just correctly configuring my dfx.json, cool stuff.