AssemblyScript

AssemblyScript
ParadigmMulti-paradigm: functional, generic, imperative, object-oriented
FamilyJavaScript, TypeScript
Designed byDaniel Wirtz,[1] Max Graey[2]
DeveloperThe AssemblyScript Project[1]
First appeared2017; 8 years ago (2017)[3]
Stable release
0.27.31[4] Edit this on Wikidata / 12 November 2024; 50 days ago (12 November 2024)
Typing disciplineStatic
ScopeLexical
LicenseApache License 2.0[5]
Filename extensions.ts
File formatsText, Unicode (source)
.wasm binary format (object)
Websitewww.assemblyscript.org
Major implementations
asc (AssemblyScript compiler)
Influenced by
JavaScript, TypeScript, WebAssembly

AssemblyScript is a TypeScript-based programming language that is optimized for, and statically compiled to, WebAssembly (currently using asc, the reference AssemblyScript compiler). Resembling ECMAScript and JavaScript, but with static types, the language is developed by the AssemblyScript Project[6] with contributions from the AssemblyScript community.

Overview

In 2017, the availability of support for WebAssembly, a standard definition for a low-level bytecode and an associated virtual machine, became widespread among major web browsers, providing web developers a lower-level and potentially higher-performance compilation target for client-side programs and applications to execute within web browsers, in addition to the interpreted (and in practice dynamically compiled) JavaScript web scripting language.[7] WebAssembly allows programs and code to be statically compiled ahead of time in order to run at potentially native-level or "bare-metal" performance within web browsers, without the overhead of interpretation or the initial latency of dynamic compilation.[8]

With the adoption of WebAssembly in major web browsers, Alon Zakai, creator of Emscripten, an LLVM/Clang-based C and C++ compiler that targeted a subset of JavaScript called asm.js, added support for WebAssembly as a compilation target in Emscripten, allowing C and/or C++ programs and code to be compiled directly to WebAssembly.[9]

While Emscripten and similar compilers allow web developers to write new code, or port existing code, written in a high-level language such as C, C++, Go, and Rust to WebAssembly to achieve potentially higher, native-level execution performance in web browsers, this forces web developers accustomed to developing client-side web scripts and applications in ECMAScript/JavaScript (the de facto client-side programming language in web browsers) to use a different language for targeting WebAssembly than JavaScript. AssemblyScript, as a variant of TypeScript that is syntactically similar to JavaScript, allows developers accustomed to JavaScript to use a familiar language for targeting WebAssembly, potentially reducing the learning curve of a separate language that can be compiled to WebAssembly. Furthermore, because AssemblyScript was designed to be an optimal source language for WebAssembly, the language's type system closely reflects that of WebAssembly,[10] and the language provides standard low-level functions (typically implemented as macros) that map directly to WebAssembly instructions that mirror instructions available on modern processors such as SIMD and vector instructions and more specialized instructions such as clz (count leading zero bits), ctz (count trailing zero bits), and popcnt (population count), used in applications such as encryption and cryptographic libraries.[11]

asc, the reference AssemblyScript compiler, is based on Binaryen , a back-end compiler toolchain developed by Alon Zakai that compiles to WebAssembly and is a component of Emscripten (which Zakai also developed). The asc compiler and other tooling are available via the npm package manager.

While WebAssembly was originally designed for execution within web browsers, the development of WASI (WebAssembly System Interface), a community specification for a standard API that allows WebAssembly programs access to system calls and other operating system functions,[12] has led to the development of WebAssembly runtime environments from projects such as Wasmtime [13] and Wasmer [14] that allow WebAssembly, and code written in languages such as AssemblyScript that can compile to it, to run in non-web environments as well.

Compatibility with JavaScript

AssemblyScript is compiled to WebAssembly modules, which can then be instantiated into client-side Web pages using standard JavaScript methods such as WebAssembly.compileStreaming and WebAssembly.instantiateStreaming just like standard WebAssembly binaries.[15] Data passing between JavaScript and the compiled WebAssembly modules, as well as function calls between JavaScript and WebAssembly, are then the same as for any WebAssembly module.[16]

Because the AssemblyScript language is largely a subset of TypeScript, it is theoretically possible to write an AssemblyScript program using this subset and compile it to both plain JavaScript and WebAssembly, using the TypeScript compiler and AssemblyScript compiler, respectively. This potentially allows for portable code that can be deployed in either JavaScript or WebAssembly run-time environments.

Usage

As of July 2022, more than 12,000 projects hosted on GitHub are written, either wholly or partially, in AssemblyScript,[17] with roughly 18,000 downloads of the AssemblyScript compiler per week via npm.[18][19]

In 2021, Webpack started using AssemblyScript to speed up the calculation of hash functions such as xxhash and md4 sources. This also made it possible to get rid of native dependencies.

Reception

Lead Emscripten developer Alon Zakai has characterized AssemblyScript as being "designed with WebAssembly and code size in mind. It's not an existing language that we are using for a new purpose, but it's a language designed for WebAssembly. It has great wasm-opt integration—in fact, it's built with it—and it's very easy to get good code size."[20]

Norwegian musician Peter Salomonsen, in a 2020 WebAssembly Summit talk titled, "WebAssembly Music," demonstrated the use of AssemblyScript for real-time compilation to WebAssembly in live electronic music synthesis, saying, "I chose AssemblyScript because it has high-level readability and low-level control; it's like a high-level language, but you get that low-level feeling, and you can even write direct WebAssembly intrinsics if you want to."[21]

Aaron Turner, a senior engineer at Fastly, a cloud computing services provider that uses WebAssembly for the company's Compute@Edge serverless compute environment, in a review of AssemblyScript wrote:[22]

While AssemblyScript requires stricter typing than TypeScript does, it sticks as close as possible to TypeScript syntax and semantics—which means that most JavaScript developers will find AssemblyScript comfortable to use—and it enables great support for the modern JavaScript ecosystem. For instance, the AssemblyScript compiler is available on npm, as well as common AssemblyScript tools and libraries like as-pect. AssemblyScript files also use TypeScript's ‘.ts’ file extension, and it includes proper typings for allowing AssemblyScript to piggy-back on TypeScript tooling, such as the TypeScript linter. With the right small tweaks, AssemblyScript can even be used with the TypeScript compiler.

This is very exciting, as AssemblyScript offers a low-overhead entry-point for JavaScript developers to pick up a language to output WebAssembly—both in terms of learning to read and write AssemblyScript, as well as using a lot of the pre-existing tooling that may already be in a JavaScript developer's workflow. AssemblyScript is often referred to in the WebAssembly community as a great gateway to picking up WebAssembly. It offers a large group of developers who already write applications for the web a path to pick up and learn WebAssembly. Even if you are starting from scratch and are not particularly familiar with JavaScript or TypeScript, AssemblyScript is a solid choice when picking a language to start outputting WebAssembly.

However, Turner went on to cite the language's relative newness and thus its lack of some features available in larger, more complex and established programming languages as potential but temporary shortcomings of the language.

See also

References

  1. ^ a b The AssemblyScript Project (April 24, 2020). "AssemblyScript Working Group". GitHub.com. AssemblyScript Project. Retrieved February 10, 2021. Daniel Wirtz (@dcodeIO) - Author of AssemblyScript
  2. ^ Aaron Turner (March 28, 2019). "WebAssembly for Javascript Developers". YouTube.com. WebAssembly SF. Retrieved February 10, 2021. @dcodeIO [Daniel Wirtz] and @MaxGraey [Max Graey]—they're the main two developers of AssemblyScript
  3. ^ The AssemblyScript Project (2017). "assemblyscript 0.1.0". npmjs.com. AssemblyScript Project. Retrieved February 10, 2021.
  4. ^ "Release 0.27.31". November 12, 2024. Retrieved November 25, 2024.
  5. ^ The AssemblyScript Project (September 29, 2017). "LICENSE". GitHub.com. The AssemblyScript Project. Retrieved February 10, 2021. AssemblyScript/assemblyscript is licensed under the Apache License 2.0
  6. ^ The AssemblyScript Project. "The AssemblyScript Project". GitHub.com. The AssemblyScript Project. Retrieved February 10, 2021.
  7. ^ WebAssembly Community Group (November 2017). "Roadmap". WebAssembly.org. WebAssembly Community Group. Retrieved February 10, 2021.
  8. ^ WebAssembly Working Group. "WebAssembly". WebAssembly.org. WebAssembly Working Group. Retrieved February 10, 2021.
  9. ^ Alon Zakai and Emscripten Contributors. "Emscripten". Emscripten.org. Emscripten project. Retrieved February 10, 2021.
  10. ^ The AssemblyScript Project. "Types". AssemblyScript.org. The AssemblyScript Project. Retrieved February 10, 2021.
  11. ^ The AssemblyScript Project. "Environment". AssemblyScript.org. The AssemblyScript Project. Retrieved February 10, 2012.
  12. ^ The Wasmtime Project. "WASI: The WebAssembly System Interface". WASI.dev. The Wasmtime Project. Retrieved February 10, 2021.
  13. ^ The Wasmtime Project. "Wasmtime: A small and efficient runtime for WebAssembly & WASI". Wasmtime.dev. The Wasmtime Project. Retrieved February 10, 2021.
  14. ^ Wasmer, Inc. "Wasmer: The Universal WebAssembly Runtime". Wasmer.io. Wasmer, Inc. Retrieved February 10, 2021.
  15. ^ Mozilla Developer Network. "Loading and running WebAssembly code". developer.mozilla.org. Mozilla Developer Network. Retrieved February 10, 2021.
  16. ^ Mozilla Developer Network. "Using the WebAssembly JavaScript API". developer.mozilla.org. Mozilla Developer Network. Retrieved February 10, 2021.
  17. ^ GitHub. "AssemblyScript/assemblyscript Dependency graph". GitHub.com. GitHub. Retrieved June 24, 2022.
  18. ^ npmjs. "assemblyscript Weekly Downloads". npmjs.com. Retrieved June 24, 2022.
  19. ^ "Resolve Error In Typescript". June 3, 2022. Saturday, 7 May 2022
  20. ^ Alon Zakai (February 19, 2020). "Shipping Tiny WebAssembly Builds". YouTube.com. WebAssembly-Summit.org. Retrieved February 10, 2021.
  21. ^ Peter Salomonsen (February 19, 2020). "WebAssembly Music". YouTube.com. WebAssembly-Summit.org. Retrieved February 10, 2021.
  22. ^ Aaron Turner (October 29, 2020). "Meet AssemblyScript: your next computing language". Fastly.com. Fastly. Retrieved February 10, 2021.

Read other articles:

Untuk kegunaan lain, lihat Gebang (disambiguasi). Gebang Pohon gebang yang telah tua Unthuk Batur, Prembun, Tambak, Banyumas Klasifikasi ilmiah Kerajaan: Plantae (tanpa takson): Angiospermae (tanpa takson): Monokotil Ordo: Arecales Famili: Arecaceae Genus: CoryphaL. Spesies: C. utan Nama binomial Corypha utanLamk. Spesies Corypha lecomtei Corypha microclada Corypha taliera Corypha umbraculifera Corypha utan Sinonim Corypha elata Roxb.C. gebanga Bl. Gebang adalah nama sejenis palma tinggi...

 

 

2012 2022 Élections législatives de 2017 dans la Mayenne 3 sièges de députés à l'Assemblée nationale 11 et 18 juin 2017 Type d’élection Élections législatives Campagne 22 mai au 10 juin12 juin au 16 juin Corps électoral et résultats Population 307 940 Inscrits 222 480 Votants au 1er tour 118 502   53,26 %  6,7 Votes exprimés au 1er tour 115 646 Votes blancs au 1er tour 1 993 Votes nuls au 1er tour 863 Votants au 2d tour 103 3...

 

 

Koordinat: 0°32′09″S 117°07′30″E / 0.53582°S 117.12506°E / -0.53582; 117.12506Politeknik Pertanian Negeri SamarindaRektorHamka S.TP., MSc. Politeknik Pertanian Negeri Samarinda pada awalnya disebut Politeknik Pertanian Universitas Mulawarman Bidang Studi Kehutanan. Didirikan secara resmi pada tanggal 6 Pebruari 1989 oleh Gubernur Kepala Daerah Tingkat I Kalimantan Timur Bpk. Suwandi bersama-sama dengan Rektor Universitas Mulawarman Bpk. Yunus Rasyid. Kemudi...

  هذه المقالة عن بغداد عاصمة جمهورية العراق. لمعانٍ أخرى، طالع بغداد (توضيح). بَغْدَاد منَ الأعلى باتِجاه عَقارب الساعة: نَهر دِجلة، بُرج بَغداد، المٌتحَف العِراقي، نَصب الحُرية، القَصر العَباسي، نَصب الشَهيد، نَصب إنقاذ الثَقافة، الحَضرة الكاظِمية، الحَضرة الحَنَف...

 

 

Artikel ini membutuhkan rujukan tambahan agar kualitasnya dapat dipastikan. Mohon bantu kami mengembangkan artikel ini dengan cara menambahkan rujukan ke sumber tepercaya. Pernyataan tak bersumber bisa saja dipertentangkan dan dihapus.Cari sumber: Sulu – berita · surat kabar · buku · cendekiawan · JSTOR (August 2014) Halaman ini berisi artikel tentang provinsi di Filipina. Untuk kesultanan, lihat Kesultanan Sulu. Untuk kegunaan lain, lihat Sulu (disamb...

 

 

Chemicals that can interfere with endocrine or hormonal systems This article needs more reliable medical references for verification or relies too heavily on primary sources. Please review the contents of the article and add the appropriate references if you can. Unsourced or poorly sourced material may be challenged and removed. Find sources: Endocrine disruptor – news · newspapers · books · scholar · JSTOR (August 2019) A comparison of the structures...

”The Shepherd’s Song” is a song written by the English composer Edward Elgar in 1892. The words are by Barry Pain. History The manuscript is dated 22 August 1892. The song was first published in 1895 by Tuckwood as his Op. 16 No.1, then in 1896 by Ascherberg. It was re-published in 1907 by Ascherberg, Hopwood & Crew, as the last of the Seven Lieder of Edward Elgar (with English and German words). The song may be the same as that called Muleteer's Song for which permission was obtai...

 

 

For the idea that Earth has been affected in the past by short-lived, violent worldwide events, see Catastrophism. Hypothesis for lack of detected aliens Gamma-ray bursts might have regulated the advent of intelligent life Neocatastrophism is the hypothesis that life-exterminating events such as gamma-ray bursts have acted as a galactic regulation mechanism in the Milky Way upon the emergence of complex life in its habitable zone.[1][2][3] It is one of several proposed...

 

 

Austrian crime drama television series You can help expand this article with text translated from the corresponding article in German. (September 2011) Click [show] for important translation instructions. View a machine-translated version of the German article. Machine translation, like DeepL or Google Translate, is a useful starting point for translations, but translators must revise errors as necessary and confirm that the translation is accurate, rather than simply copy-pasting machin...

Koordinat: 1°51′S 105°27′E / 1.850°S 105.450°E / -1.850; 105.450 Kabupaten Bangka BaratKabupatenTranskripsi bahasa daerah • Jawiكابوڤاتين بڠک بارتPelabuhan Muntok LambangMotto: Sejiran setasonWilayah negeri yang mempunyai warga yang berdasarkan kekeluargaan dan kebersamaanPetaKabupaten Bangka BaratPetaTampilkan peta SumatraKabupaten Bangka BaratKabupaten Bangka Barat (Indonesia)Tampilkan peta IndonesiaKoordinat: 1°57′30�...

 

 

Protein-coding gene in the species Homo sapiens FHL2Available structuresPDBOrtholog search: PDBe RCSB List of PDB id codes1X4K, 1X4L, 2D8Z, 2MIUIdentifiersAliasesFHL2, AAG11, DRAL, FHL-2, SLIM-3, SLIM3, four and a half LIM domains 2External IDsOMIM: 602633 MGI: 1338762 HomoloGene: 20372 GeneCards: FHL2 Gene location (Human)Chr.Chromosome 2 (human)[1]Band2q12.2Start105,357,712 bp[1]End105,438,513 bp[1]Gene location (Mouse)Chr.Chromosome 1 (mouse)[2]Band1|1 ...

 

 

American soccer player (born 1998) Weston McKennie McKennie with the United States in 2019Personal informationFull name Weston James Earl McKennie[1]Date of birth (1998-08-28) August 28, 1998 (age 25)Place of birth Fort Lewis, Washington, U.S.[2]Height 6 ft 0 in (1.83 m)[3]Position(s) MidfielderTeam informationCurrent team JuventusNumber 16Youth career2004–2009 FC Phönix Otterbach2009–2016 FC Dallas2016–2017 Schalke 04Senior career*Years Team...

泰国陆军元帅他侬·吉滴卡宗ถนอม กิตติขจรPChW SR MPCh MWM第10任泰國總理任期1963年12月9日—1973年10月14日君主拉玛九世前任沙立·他那叻元帥继任訕耶·探瑪塞任期1958年1月1日—1958年10月20日君主拉玛九世前任乃朴·沙拉信继任沙立·他那叻元帥第32任泰國國防部長任期1957年9月23日—1973年10月14日前任鑾披汶·頌堪继任他威·尊拉塞(英语:Dawee Chullasapya) 个人资料出...

 

 

Crawford, Dorset redirects here. For the village in Scotland, see Crawford, South Lanarkshire. For the village in Lancashire, see Crawford, Lancashire. For the surname, see Crawford (surname). Human settlement in EnglandTarrant CrawfordWayside Cross, Tarrant CrawfordTarrant CrawfordLocation within DorsetPopulation20 OS grid referenceST925035DistrictNorth DorsetShire countyDorsetRegionSouth WestCountryEnglandSovereign stateUnited KingdomPost townBLANDFORD FORUMPostcode...

 

 

莎拉·阿什頓-西里洛2023年8月,阿什頓-西里洛穿著軍服出生 (1977-07-09) 1977年7月9日(46歲) 美國佛羅里達州国籍 美國别名莎拉·阿什頓(Sarah Ashton)莎拉·西里洛(Sarah Cirillo)金髮女郎(Blonde)职业記者、活動家、政治活動家和候選人、軍醫活跃时期2020年—雇主內華達州共和黨候選人(2020年)《Political.tips》(2020年—)《LGBTQ國度》(2022年3月—2022年10月)烏克蘭媒�...

Deir el-Bersha Administration Pays Égypte Gouvernorat Minya Démographie Population 14 297 hab. Géographie Coordonnées 27° 45′ nord, 30° 54′ est Localisation Géolocalisation sur la carte : Égypte Deir el-Bersha Géolocalisation sur la carte : Égypte Deir el-Bersha modifier  Deir el-Bersha est un village copte en Moyenne-Égypte. Il est situé à 225 km au sud du Caire sur la rive est du Nil dans le gouvernorat d'Al-Minya, au sud d...

 

 

هذه المقالة تحتاج للمزيد من الوصلات للمقالات الأخرى للمساعدة في ترابط مقالات الموسوعة. فضلًا ساعد في تحسين هذه المقالة بإضافة وصلات إلى المقالات المتعلقة بها الموجودة في النص الحالي. (أغسطس 2021) قرار مجلس الأمن 2060 ميناء بوساسوميناء بوساسو التاريخ 25 يوليو 2012 اجتماع رقم 6,81...

 

 

1982 film by James Toback Love and MoneyDVD coverDirected byJames TobackWritten byJames TobackProduced byRichard McWhorterJames TobackStarringRay SharkeyCinematographyFred SchulerEdited byDennis M. HillProductioncompanyLorimarDistributed byParamount PicturesRelease date February 12, 1982 (1982-02-12) Running time90 minutesCountryUnited StatesLanguageEnglishBox office$14,009[1] Love and Money, also known as Love & Money, is a 1982 American drama film directed by Jame...

Political party in Canada Action démocratique du Québec FoundersJean AllaireMario DumontFoundedJanuary 6, 1994 (1994-01-06)DissolvedJanuary 21, 2012Split fromQuebec Liberal PartyMerged intoCoalition Avenir QuébecHeadquarters740 rue Saint-Maurice, Suite 108, Montreal, Quebec, H3C 1L5IdeologyQuebec nationalism[1][2]Quebec autonomism[3] Right-wing populismConservatism[1]Economic liberalism[2]Political positionCentre-ri...

 

 

Overview of crime in Bangladesh Bangladeshi police car. Crime in Bangladesh is present in various forms such as drug trafficking, money laundering, extortion, contract killing, fraud, human trafficking, robbery, corruption, black marketeering, political violence, terrorism and abduction, wildlife trafficking, among others. Narcotics trafficking Bangladesh is used as a transit route for narcotics produced in neighboring countries.[1] The Annual Report for 2007 from the International Na...