Category:Wren: Difference between revisions

Deleted paragraph about updating S/H which has now been completed.
(Added link to Wren-crypto module.)
(Deleted paragraph about updating S/H which has now been completed.)
 
(42 intermediate revisions by the same user not shown)
Line 13:
It is under development on [https://github.com/wren-lang/wren GitHub] and is fully documented [http://wren.io/ here].
 
The CLI tool (Wren CLI) has its own repository and is the main focus of examples written for RC.
Version 0.3.0 was released in June 2020 and the CLI tool (Wren CLI) was then split off into its own repository. It is now available as a pre-built standalone executable and is the main focus of examples written for RC. Unfortunately, its embedded VM suffers from a stack corruption bug which often manifests itself in recursive code. This bug was fixed in September 2020 and, rather than use the pre-built executable, I would recommend that RC users build Wren CLI themselves using the latest VM code pending the release of version 0.4.0. From April 2021, the latest build already includes Wren 0.4.0 features and the official release will follow soon.
The latest version 0.4.0 is available as a pre-built standalone executable for 64-bit Linux, MacOS and Windows and can be downloaded from [https://github.com/wren-lang/wren-cli/releases here].
 
In common with several other 'newer' languages (Rust, Kotlin, Julia, Swift, Phix etc.) Wren doesn't have its own syntax highlighting on Rosetta Code as GeSHi support hasn't been updated for a long time and may never be. However, I've found by experimentation that, if ''ecmascript'' is used in the ''lang'' tag, then this will highlight all of Wren's keywords except ''construct'' and ''foreign'' and is probably the best we can do in the circumstances.
 
As a language mainly designed for embedding, Wren's standard library is (of necessity) quite small and I have therefore decided to create some additional modules to assist with writing Rosetta Code tasks so the same code does not have to be written or copy/pasted time and time again thereby bloating a task's script code unnecessarily. The ones written so far are listed below:
 
{| class="wikitable"
* [https://rosettacode.org/wiki/Category:Wren-fmt fmt]
! No. !! Module name !! !! No. !! Module name
* [https://rosettacode.org/wiki/Category:Wren-str str]
|-
* [https://rosettacode.org/wiki/Category:Wren-sort sort]
| 1 || [[:Category:Wren-fmt|fmt]] || || 2 || [[:Category:Wren-str|str]]
* [https://rosettacode.org/wiki/Category:Wren-math math]
|-
* [https://rosettacode.org/wiki/Category:Wren-trait trait]
| 3 || [[:Category:Wren-sort|sort]] || || 4 || [[:Category:Wren-math|math]]
* [https://rosettacode.org/wiki/Category:Wren-seq seq]
|-
* [https://rosettacode.org/wiki/Category:Wren-date date]
| 5 || [[:Category:Wren-trait|trait]] || || 6 || [[:Category:Wren-seq|seq]]
* [https://rosettacode.org/wiki/Category:Wren-rat rat]
|-
* [https://rosettacode.org/wiki/Category:Wren-pattern pattern]
| 7 || [[:Category:Wren-date|date]] || || 8 || [[:Category:Wren-rat|rat]]
* [https://rosettacode.org/wiki/Category:Wren-big big]
|-
* [https://rosettacode.org/wiki/Category:Wren-upc upc]
| 9 || [[:Category:Wren-pattern|pattern]] || || 10 || [[:Category:Wren-big|big]]
* [https://rosettacode.org/wiki/Category:Wren-matrix matrix]
|-
* [https://rosettacode.org/wiki/Category:Wren-set set]
| 11 || [[:Category:Wren-upc|upc]] || || 12 || [[:Category:Wren-matrix|matrix]]
* [https://rosettacode.org/wiki/Category:Wren-llist llist]
|-
* [https://rosettacode.org/wiki/Category:Wren-queue queue]
| 13 || [[:Category:Wren-set|set]] || || 14 || [[:Category:Wren-llist|llist]]
* [https://rosettacode.org/wiki/Category:Wren-complex complex]
|-
* [https://rosettacode.org/wiki/Category:Wren-dynamic dynamic]
| 15 || [[:Category:Wren-queue|queue]] || || 16 || [[:Category:Wren-complex|complex]]
* [https://rosettacode.org/wiki/Category:Wren-ioutil ioutil]
|-
* [https://rosettacode.org/wiki/Category:Wren-long long]
| 17 || [[:Category:Wren-dynamic|dynamic]] || || 18 || [[:Category:Wren-ioutil|ioutil]]
* [https://rosettacode.org/wiki/Category:Wren-crypto crypto]
|-
| 19 || [[:Category:Wren-long|long]] || || 20 || [[:Category:Wren-crypto|crypto]]
|-
| 21 || [[:Category:Wren-sound|sound]] || || 22 || [[:Category:Wren-polygon|polygon]]
|-
| 23 || [[:Category:Wren-srandom|srandom]] || || 24 || [[:Category:Wren-lsystem|lsystem]]
|-
| 25 || [[:Category:Wren-turtle|turtle]] || || 26 || [[:Category:Wren-ellipse|ellipse]]
|-
| 27 || [[:Category:Wren-check|check]] || || 28 || [[:Category:Wren-array|array]]
|-
| 29 || [[:Category:Wren-gmp|gmp]] || || 30 || [[:Category:Wren-ecm|ecm]]
|-
| 31 || [[:Category:Wren-sql|sql]] || || 32 || [[:Category:Wren-event|event]]
|-
| 33 || [[:Category:Wren-i64|i64]] || || 34 || [[:Category:Wren-perm|perm]]
|-
| 35 || [[:Category:Wren-linear|linear]] || || 36 || [[:Category:Wren-regex|regex]]
|-
| 37 || [[:Category:Wren-maputil|maputil]] || || 38 || [[:Category:Wren-plot|plot]]
|-
| 39 || [[:Category:Wren-debug|debug]] || || 40 || [[:Category:Wren-table|table]]
|-
| 41 || [[:Category:Wren-iterate|iterate]] || || 42 || [[:Category:Wren-money|money]]
|-
| 43 || [[:Category:Wren-vector|vector]] || || 44 || [[:Category:Wren-ordered|ordered]]
|-
| 45 || [[:Category:Wren-psieve|psieve]] || || ||
|}
<br>
To use a class or classes from a module (say ''fmt''), you need to import them into your script with Wren code such as the following. To use more than one class separate their names with commas:
 
<syntaxhighlight lang="wren">import "./fmt" for Conv, Fmt</syntaxhighlight>
 
These modules are subject to the same license as any other code submitted to Rosetta Code though contributors' user pages should be checked to see whether more permissive terms are available. If anyone wishes to add further modules, please do so using a similar model and append them to the list.
 
Please note that when creating a category for a new module its name should be prefixed with 'Wren-' as in 'Wren-fmt' and the library header for a task which uses the module should therefore use this name. Modules will normally have generic names and this convention allows Rosetta Code users to easily distinguish Wren modules from similarly named modules/libraries written for other languages.
 
There are also a number of third-party modules available for Wren of which the following have been used to write solutions for Rosetta Code tasks:
 
{| class="wikitable"
! No. !! Module name !! !! No. !! Module name
|-
| 1 || [[:Category:DOME|DOME]] || || 2 || [[:Category:Raylib-wren|Raylib-wren]]
|-
| 3 || [[:Category:SpiderWren|SpiderWren]] || || 4 || [[:Category:Wren-assert|Wren-assert]]
|-
| 5 || [[:Category:Wren-json|Wren-json]] || || 6 || [[:Category:Wren-test|Wren-test]]
|-
| 7 || [[:Category:WrenGo|WrenGo]] || || 8 || [[:Category:Wren-xsequence|Wren-xsequence]]
|}
<br>
For further information and licensing requirements, please consult their individual pages.
 
==Todo==
* [[Tasks not implemented in Wren]]
9,476

edits