mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-26 23:23:55 +00:00
[assemblyscript/en] fix link and format
This commit is contained in:
parent
f56f80dd80
commit
d66ea131e4
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
language: Assemblyscript
|
language: AssemblyScript
|
||||||
contributors:
|
contributors:
|
||||||
- ["Philippe Vlérick", "https://github.com/pvlerick"]
|
- ["Philippe Vlérick", "https://github.com/pvlerick"]
|
||||||
- ["Steve Huguenin-Elie", "https://github.com/StEvUgnIn"]
|
- ["Steve Huguenin-Elie", "https://github.com/StEvUgnIn"]
|
||||||
@ -13,7 +13,7 @@ __AssemblyScript__ compiles a variant of __TypeScript__ (basically JavaScript wi
|
|||||||
This article will focus only on AssemblyScript extra syntax, as opposed to [TypeScript](/docs/typescript) and [JavaScript](/docs/javascript).
|
This article will focus only on AssemblyScript extra syntax, as opposed to [TypeScript](/docs/typescript) and [JavaScript](/docs/javascript).
|
||||||
|
|
||||||
To test AssemblyScript's compiler, head to the
|
To test AssemblyScript's compiler, head to the
|
||||||
[Playground](https://bit.ly/asplayground) where you will be able
|
[Playground](https://www.assemblyscript.org/editor.html#IyFydW50aW1lPXN0dWIKLyoqIENhbGN1bGF0ZXMgdGhlIG4tdGggRmlib25hY2NpIG51bWJlci4gKi8KZXhwb3J0IGZ1bmN0aW9uIGZpYihuOiBpMzIpOiBpMzIgewogIHZhciBhID0gMCwgYiA9IDEKICBpZiAobiA+IDApIHsKICAgIHdoaWxlICgtLW4pIHsKICAgICAgbGV0IHQgPSBhICsgYgogICAgICBhID0gYgogICAgICBiID0gdAogICAgfQogICAgcmV0dXJuIGIKICB9CiAgcmV0dXJuIGEKfQoKIyFodG1sCjx0ZXh0YXJlYSBpZD0ib3V0cHV0IiBzdHlsZT0iaGVpZ2h0OiAxMDAlOyB3aWR0aDogMTAwJSIgcmVhZG9ubHk+PC90ZXh0YXJlYT4KPHNjcmlwdD4KbG9hZGVyLmluc3RhbnRpYXRlKG1vZHVsZV93YXNtLCB7IC8qIGltcG9ydHMgKi8gfSkKICAudGhlbigoeyBleHBvcnRzIH0pID0+IHsKICAgIGNvbnN0IG91dHB1dCA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdvdXRwdXQnKQogICAgZm9yIChsZXQgaSA9IDA7IGkgPD0gMTA7ICsraSkgewogICAgICBvdXRwdXQudmFsdWUgKz0gYGZpYigke2l9KSA9ICR7ZXhwb3J0cy5maWIoaSl9XG5gCiAgICB9CiAgfSkKPC9zY3JpcHQ+Cg==) where you will be able
|
||||||
to type code, have auto completion and directly see the emitted WebAssembly.
|
to type code, have auto completion and directly see the emitted WebAssembly.
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
@ -144,11 +144,11 @@ export namespace Geometry {
|
|||||||
let s1 = new Geometry.Square(5);
|
let s1 = new Geometry.Square(5);
|
||||||
|
|
||||||
// Generics
|
// Generics
|
||||||
// AssemblyScript compiles generics to one concrete method or function per set
|
// AssemblyScript compiles generics to one concrete method or function per set
|
||||||
// of unique contextual type arguments, also known as [monomorphisation].
|
// of unique contextual type arguments, also known as [monomorphisation].
|
||||||
// Implications are that a module only includes and exports concrete functions
|
// Implications are that a module only includes and exports concrete functions
|
||||||
// for sets of type arguments actually used and that concrete functions can be
|
// for sets of type arguments actually used and that concrete functions can be
|
||||||
// shortcutted with [static type checks] at compile time, which turned out to
|
// shortcutted with [static type checks] at compile time, which turned out to
|
||||||
// be quite useful.
|
// be quite useful.
|
||||||
// Classes
|
// Classes
|
||||||
export class Tuple<T1, T2> {
|
export class Tuple<T1, T2> {
|
||||||
@ -196,6 +196,7 @@ let bytes3: u8[] = [0, 1, 2, 3, 4] // will infer as Array<u8>
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Further Reading
|
## Further Reading
|
||||||
* [AssemblyScript Official website] (https://www.assemblyscript.org/)
|
|
||||||
* [AssemblyScript source documentation] https://github.com/AssemblyScript/website/tree/main/src)
|
* [AssemblyScript Official website](https://www.assemblyscript.org/)
|
||||||
* [Source Code on GitHub] (https://github.com/AssemblyScript/assemblyscript)
|
* [AssemblyScript source documentation](https://github.com/AssemblyScript/website/tree/main/src)
|
||||||
|
* [Source Code on GitHub](https://github.com/AssemblyScript/assemblyscript)
|
||||||
|
Loading…
Reference in New Issue
Block a user