From ebe3e463c79d04fc1ecbbbce6c2260a8828aec77 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 4 Jul 2024 15:13:03 +0530 Subject: [PATCH 01/53] Fix broken links --- swan-lake/integration/supported-data-formats.md | 6 +++--- .../featured-scenarios/build-a-data-service-in-ballerina.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swan-lake/integration/supported-data-formats.md b/swan-lake/integration/supported-data-formats.md index 9ad4b8cd8178..025162123172 100644 --- a/swan-lake/integration/supported-data-formats.md +++ b/swan-lake/integration/supported-data-formats.md @@ -16,6 +16,6 @@ intro: Ballerina supports the data formats listed below. | CSV | Ballerina facilitates working with data in CSV format with support for parsing and writing CSV data along with support for reading/writing data as user-defined types and streaming. | | | TSV | Ballerina facilitates working with data in TSV format with support for parsing and writing TSV data along with streaming. | | | Protobuf | Ballerina supports serializing and deserializing Protobuf messages sent/received via the gRPC protocol. | | -| EDI | Ballerina facilitates B2B integration with support for EDI standards, including support for parsing EDI data as JSON or records and converting JSON or records to EDI text against a specific schema. | | -| FHIR | Ballerina facilitates the development of healthcare applications with built-in support to process FHIR (Fast Healthcare Interoperability Resources) resources, including support for conversion between FHIR JSON messages and records. | -| HL7 | Ballerina enables healthcare information exchange between different systems with support for the HL7 messaging standard, including parsing HL7 messages as Ballerina values, encoding to wire format, and exchanging data. | | +| EDI | Ballerina facilitates B2B integration with support for EDI standards, including support for parsing EDI data as JSON or records and converting JSON or records to EDI text against a specific schema. | | +| FHIR | Ballerina facilitates the development of healthcare applications with built-in support to process FHIR (Fast Healthcare Interoperability Resources) resources, including support for conversion between FHIR JSON messages and records. | +| HL7 | Ballerina enables healthcare information exchange between different systems with support for the HL7 messaging standard, including parsing HL7 messages as Ballerina values, encoding to wire format, and exchanging data. | | diff --git a/swan-lake/resources/featured-scenarios/build-a-data-service-in-ballerina.md b/swan-lake/resources/featured-scenarios/build-a-data-service-in-ballerina.md index 1f6b9b76cf9a..7e05adc32a92 100644 --- a/swan-lake/resources/featured-scenarios/build-a-data-service-in-ballerina.md +++ b/swan-lake/resources/featured-scenarios/build-a-data-service-in-ballerina.md @@ -33,7 +33,7 @@ Select one out of the methods below to set up a MySQL server. >**Tip:** Keep the connection and authentication details for connecting to the MySQL server including the hostname, port, username and password noted down. 1. Install a MySQL server on your machine locally by downloading and installing [MySQL](https://dev.mysql.com/doc/mysql-getting-started/en/#mysql-getting-started-installing) for different platforms. -2. Use a cross-platform web-server solution such as [XAMPP](https://www.apachefriends.org/index.html) or [WampServer](https://www.wampserver.com/en/). +2. Use a cross-platform web-server solution such as [XAMPP](https://www.apachefriends.org/index.html) or [WampServer](https://wampserver.aviatechno.net/). 3. Use [Docker](https://dev.mysql.com/doc/mysql-installation-excerpt/8.0/en/docker-mysql-getting-started.html) to create a MySQL server deployment. 4. Use a cloud-based MySQL solution such as Google’s [CloudSQL](https://cloud.google.com/sql), Amazon’s [RDS for MySQL](https://aws.amazon.com/rds/sqlserver/), or Microsoft’s [Azure database for MySQL](https://azure.microsoft.com/en-us/services/mysql/). From 88789210cfc5e3efbc05427b94fc66c0e12fbff9 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Tue, 9 Jul 2024 11:50:41 +0530 Subject: [PATCH 02/53] Add release note for 2201.9.2 release --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md new file mode 100644 index 000000000000..d9c8067cf07b --- /dev/null +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -0,0 +1,56 @@ +--- +layout: ballerina-left-nav-release-notes +title: Swan Lake Update 9 (2201.9.2) +permalink: /downloads/swan-lake-release-notes/2201.9.2/ +active: 2201.9.2 +redirect_from: + - /downloads/swan-lake-release-notes/2201.9.2 + - /downloads/swan-lake-release-notes/2201.9.2/ + - /downloads/swan-lake-release-notes/2201.9.2-swan-lake/ + - /downloads/swan-lake-release-notes/2201.9.2-swan-lake +--- + +## Overview of Ballerina Swan Lake Update 8 () + +Swan Lake Update 9 (2201.9.2) is the second patch release of Ballerina 2201.9.0 (Swan Lake Update 9) and it includes a new set of bug fixes to the . + +## Update Ballerina + +Run the command below to update your current Ballerina installation directly to by using the [Ballerina Update Tool](/learn/update-tool/). + +``` +$ bal dist pull +``` + +## Install Ballerina + +If you have not installed Ballerina, then, download the [installers](/downloads/#swanlake) to install. + + + +## Language updates + +### Bug fixes + +To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A). + +## Runtime updates + +### Bug fixes + +To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A+label%3ATeam%2FjBallerina+label%3AType%2FBug+is%3Aclosed). + +## Ballerina library updates + +### Bug fixes + +To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-standard-library/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A). + +## Developer tools updates + +### Bug fixes + +To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of the repositories below. + +- [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A+is%3Aclosed+label%3AType%2FBug+) +- [OpenAPI](https://github.com/ballerina-platform/openapi-tools/issues?q=is%3Aissue+label%3AType%2FBug+milestone%3A%22Swan+Lake+%22+is%3Aclosed) \ No newline at end of file From 85e88da04a36bfcd395b71390ed57234f6629fc7 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Tue, 9 Jul 2024 11:52:20 +0530 Subject: [PATCH 03/53] Update 2201.9.2 release note --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index d9c8067cf07b..056a3915c6a3 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -10,7 +10,7 @@ redirect_from: - /downloads/swan-lake-release-notes/2201.9.2-swan-lake --- -## Overview of Ballerina Swan Lake Update 8 () +## Overview of Ballerina Swan Lake Update 9 (2201.9.2) Swan Lake Update 9 (2201.9.2) is the second patch release of Ballerina 2201.9.0 (Swan Lake Update 9) and it includes a new set of bug fixes to the . From 149781baa6f9f3dcc71281d6b2f8dc6107b4bc5f Mon Sep 17 00:00:00 2001 From: azinneera Date: Tue, 9 Jul 2024 13:43:36 +0530 Subject: [PATCH 04/53] Add Ballerina packages updates to the 9.2 release note --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 056a3915c6a3..66de1d31563f 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -53,4 +53,21 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of the repositories below. - [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A+is%3Aclosed+label%3AType%2FBug+) -- [OpenAPI](https://github.com/ballerina-platform/openapi-tools/issues?q=is%3Aissue+label%3AType%2FBug+milestone%3A%22Swan+Lake+%22+is%3Aclosed) \ No newline at end of file +- [OpenAPI](https://github.com/ballerina-platform/openapi-tools/issues?q=is%3Aissue+label%3AType%2FBug+milestone%3A%22Swan+Lake+%22+is%3Aclosed) + +## Ballerina packages updates + +### Improvements + +Introduced an experimental build option to enable memory-efficient compilation of package dependencies. This can help prevent out-of-memory issues during the initial compilation with a clean central cache. Pass the flag to the `bal` command or specify the build option in the `Ballerina.toml` file to enable this experimental feature. + +```bash +$ bal build --optimize-dependency-compilation +``` + +Specifying the build option in the `Ballerina.toml` file: + +```toml +[build-options] +optimizeDependencyCompilation = true +``` From 231d97667e6722ac659c3fc4af78a7b8ec46e1b3 Mon Sep 17 00:00:00 2001 From: lnash94 Date: Tue, 9 Jul 2024 13:58:02 +0530 Subject: [PATCH 05/53] Update release note with openapi changes --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 056a3915c6a3..9050f287ad5d 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -53,4 +53,4 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of the repositories below. - [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A+is%3Aclosed+label%3AType%2FBug+) -- [OpenAPI](https://github.com/ballerina-platform/openapi-tools/issues?q=is%3Aissue+label%3AType%2FBug+milestone%3A%22Swan+Lake+%22+is%3Aclosed) \ No newline at end of file +- [OpenAPI](https://github.com/ballerina-platform/ballerina-library/issues?q=label%3Amodule%2Fopenapi-tools+milestone%3A2201.9.2+is%3Aclosed) \ No newline at end of file From b20bffea12f6754b1f05aaecd609a5aab854db2e Mon Sep 17 00:00:00 2001 From: mindula Date: Tue, 9 Jul 2024 14:34:55 +0530 Subject: [PATCH 06/53] Update release note with LS changes --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 056a3915c6a3..751a10ee8c36 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -52,5 +52,5 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of the repositories below. -- [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A+is%3Aclosed+label%3AType%2FBug+) +- [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A2201.9.2+is%3Aclosed+label%3AType%2FBug+) - [OpenAPI](https://github.com/ballerina-platform/openapi-tools/issues?q=is%3Aissue+label%3AType%2FBug+milestone%3A%22Swan+Lake+%22+is%3Aclosed) \ No newline at end of file From 8f243106f05d9e27eaa3c23c1c7790a219d4ed08 Mon Sep 17 00:00:00 2001 From: prakanth <50439067+prakanth97@users.noreply.github.com> Date: Tue, 9 Jul 2024 15:11:30 +0530 Subject: [PATCH 07/53] Update release note with library bug fixes --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 751a10ee8c36..878bc6d2687d 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -44,7 +44,7 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( ### Bug fixes -To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-standard-library/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A). +To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-library/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A2201.9.2). ## Developer tools updates From bebe694be2fa38dc5357b6a7cd20a24739ea57ff Mon Sep 17 00:00:00 2001 From: Nipuna Ranasinghe Date: Tue, 9 Jul 2024 15:15:15 +0530 Subject: [PATCH 08/53] Update 2201.9.2 release notes with Bindgen tool fixes --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 111b677f9e13..1ef8c20da13b 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -54,3 +54,4 @@ To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of - [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A2201.9.2+is%3Aclosed+label%3AType%2FBug+) - [OpenAPI](https://github.com/ballerina-platform/ballerina-library/issues?q=label%3Amodule%2Fopenapi-tools+milestone%3A2201.9.2+is%3Aclosed) +- [Bindgen too](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AArea%2FBindgen+milestone%3A2201.9.2+is%3Aclosed) From bcad463b9686a679562b6397ede1c816452da027 Mon Sep 17 00:00:00 2001 From: Gayal Dassanayake Date: Tue, 9 Jul 2024 15:49:00 +0530 Subject: [PATCH 09/53] Add CLI part of the release note --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 1c2684916dd5..71b341141570 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -54,6 +54,7 @@ To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of - [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A2201.9.2+is%3Aclosed+label%3AType%2FBug+) - [OpenAPI](https://github.com/ballerina-platform/ballerina-library/issues?q=label%3Amodule%2Fopenapi-tools+milestone%3A2201.9.2+is%3Aclosed) +- [CLI](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A2201.9.2+is%3Aclosed+label%3AType%2FBug+label%3AArea%2FCLI-BuildTools) ## Ballerina packages updates From 22266a534e92bdf9d5b01d8bee5a26cc0e43ad8f Mon Sep 17 00:00:00 2001 From: Azeem Muzammil Date: Tue, 9 Jul 2024 17:42:26 +0530 Subject: [PATCH 10/53] Write release notes for 2201.9.2 --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index dfec8eb46689..bb00da9660a2 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -48,6 +48,23 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( ## Developer tools updates +### Improvements + +Introduced the WSDL CLI-tool as an experimental feature which generates Ballerina types from a WSDL file. This tool can be accessed by pulling it from Ballerina Central and running it with an input WSDL file. + +```bash +# To pull the tool from Ballerina Central +bal tool pull wsdl + +# To use the tool to generate Ballerina types from a WSDL file: +bal wsdl -i --operations + +# -i : Specifies the input WSDL file from which to generate Ballerina types. + +# --operations (Optional): +# Lists specific operations to generate Ballerina types for. +``` + ### Bug fixes To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of the repositories below. From ed0195ae0414937506f8eb1c3637112ec3af9768 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Tue, 9 Jul 2024 17:49:22 +0530 Subject: [PATCH 11/53] Update release note for 2201.9.2 --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index dfec8eb46689..1b4bf44324d6 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -16,10 +16,10 @@ redirect_from: ## Update Ballerina -Run the command below to update your current Ballerina installation directly to by using the [Ballerina Update Tool](/learn/update-tool/). +Run the command below to update your current Ballerina installation directly to 2201.9.2 by using the [Ballerina Update Tool](/learn/update-tool/). ``` -$ bal dist pull +$ bal dist pull 2201.9.2 ``` ## Install Ballerina @@ -32,13 +32,13 @@ If you have not installed Ballerina, then, download the [installers](/downloads/ ### Bug fixes -To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A). +To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A2201.9.2). ## Runtime updates ### Bug fixes -To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A+label%3ATeam%2FjBallerina+label%3AType%2FBug+is%3Aclosed). +To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A2201.9.2+label%3ATeam%2FjBallerina+label%3AType%2FBug+is%3Aclosed). ## Ballerina library updates From f135049d8b3de89b6725bd520c6827f0d56cf07e Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Tue, 9 Jul 2024 17:53:32 +0530 Subject: [PATCH 12/53] Update release note for 2201.9.2 --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 1b4bf44324d6..b741d8228f50 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -12,7 +12,7 @@ redirect_from: ## Overview of Ballerina Swan Lake Update 9 (2201.9.2) -Swan Lake Update 9 (2201.9.2) is the second patch release of Ballerina 2201.9.0 (Swan Lake Update 9) and it includes a new set of bug fixes to the . +Swan Lake Update 9 (2201.9.2) is the second patch release of Ballerina 2201.9.0 (Swan Lake Update 9) and it includes a new set of bug fixes to the language, runtime, library and developer tooling. ## Update Ballerina From c29b14561caba87cfe9f46e3b476d7fab0a5e346 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Tue, 9 Jul 2024 17:54:51 +0530 Subject: [PATCH 13/53] Update release note for 2201.9.2 --- .../swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index b741d8228f50..712afc743046 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -12,7 +12,7 @@ redirect_from: ## Overview of Ballerina Swan Lake Update 9 (2201.9.2) -Swan Lake Update 9 (2201.9.2) is the second patch release of Ballerina 2201.9.0 (Swan Lake Update 9) and it includes a new set of bug fixes to the language, runtime, library and developer tooling. +Swan Lake Update 9 (2201.9.2) is the second patch release of Ballerina 2201.9.0 (Swan Lake Update 9) and it includes a new set of bug fixes to the language server, runtime, library and developer tooling. ## Update Ballerina From df676ab1df87d53e23f8cefacac55e0aa3cb0864 Mon Sep 17 00:00:00 2001 From: Azeem Muzammil Date: Tue, 9 Jul 2024 18:05:41 +0530 Subject: [PATCH 14/53] Fix naming issue --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index bb00da9660a2..a18356461f4b 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -57,11 +57,11 @@ Introduced the WSDL CLI-tool as an experimental feature which generates Ballerin bal tool pull wsdl # To use the tool to generate Ballerina types from a WSDL file: -bal wsdl -i --operations +bal wsdl -i --operations -# -i : Specifies the input WSDL file from which to generate Ballerina types. +# -i : Specifies the input WSDL file from which to generate Ballerina types. -# --operations (Optional): +# --operations (Optional): # Lists specific operations to generate Ballerina types for. ``` From f61eeedd16faa54aac3f518ad1e54fccf6f0d617 Mon Sep 17 00:00:00 2001 From: Azeem Muzammil Date: Tue, 9 Jul 2024 20:10:23 +0530 Subject: [PATCH 15/53] Fix WSDL release note --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index a18356461f4b..6f39f077857e 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -50,16 +50,16 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( ### Improvements -Introduced the WSDL CLI-tool as an experimental feature which generates Ballerina types from a WSDL file. This tool can be accessed by pulling it from Ballerina Central and running it with an input WSDL file. +Introduced the WSDL CLI tool as an experimental feature which generates Ballerina types from a WSDL file. This tool can be accessed by pulling it from Ballerina Central and running it with an input WSDL file. ```bash -# To pull the tool from Ballerina Central +# To pull the tool from Ballerina Central: bal tool pull wsdl # To use the tool to generate Ballerina types from a WSDL file: bal wsdl -i --operations -# -i : Specifies the input WSDL file from which to generate Ballerina types. +# -i, --input : Specifies the input WSDL file from which to generate Ballerina types. # --operations (Optional): # Lists specific operations to generate Ballerina types for. From 8ee5f80c40eb112bf09fc2df5b02ee2b5bfee264 Mon Sep 17 00:00:00 2001 From: Azeem Muzammil Date: Tue, 9 Jul 2024 20:50:06 +0530 Subject: [PATCH 16/53] Address review comments --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 6f39f077857e..cb247d944971 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -48,7 +48,9 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( ## Developer tools updates -### Improvements +### New features + +#### WSDL tool Introduced the WSDL CLI tool as an experimental feature which generates Ballerina types from a WSDL file. This tool can be accessed by pulling it from Ballerina Central and running it with an input WSDL file. From 5489434a427de7b7859cafd3cbedd38214bb74b7 Mon Sep 17 00:00:00 2001 From: azinneera Date: Tue, 9 Jul 2024 21:01:34 +0530 Subject: [PATCH 17/53] Update the 2201.9.2 release note --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index fbe39e5436bf..4610814ec1da 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -52,19 +52,24 @@ To view bug fixes, see the [GitHub milestone for Swan Lake Update 9 (2201.9.2)]( #### WSDL tool -Introduced the WSDL CLI tool as an experimental feature which generates Ballerina types from a WSDL file. This tool can be accessed by pulling it from Ballerina Central and running it with an input WSDL file. +Introduced the WSDL CLI tool as an experimental feature that generates Ballerina types from a WSDL file. This tool can be accessed by pulling it from the Ballerina Central and running it with an input WSDL file. + +Execute the following command to pull the tool from the Ballerina Central. ```bash -# To pull the tool from Ballerina Central: -bal tool pull wsdl +$ bal tool pull wsdl +``` -# To use the tool to generate Ballerina types from a WSDL file: -bal wsdl -i --operations +Execute the following command to generate Ballerina types from a WSDL file. + +```bash +$ bal wsdl -i [--operations ] -# -i, --input : Specifies the input WSDL file from which to generate Ballerina types. +# -i, --input +# Input WSDL file from which to generate Ballerina types. -# --operations (Optional): -# Lists specific operations to generate Ballerina types for. +# --operations +# Optional. Specify the list of operations, for which Ballerina types need to be generated. ``` ### Bug fixes @@ -73,7 +78,7 @@ To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of - [Language server](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3ATeam%2FLanguageServer+milestone%3A2201.9.2+is%3Aclosed+label%3AType%2FBug+) - [OpenAPI](https://github.com/ballerina-platform/ballerina-library/issues?q=label%3Amodule%2Fopenapi-tools+milestone%3A2201.9.2+is%3Aclosed) -- [Bindgen too](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AArea%2FBindgen+milestone%3A2201.9.2+is%3Aclosed) +- [Bindgen tool](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AArea%2FBindgen+milestone%3A2201.9.2+is%3Aclosed) - [CLI](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A2201.9.2+is%3Aclosed+label%3AType%2FBug+label%3AArea%2FCLI-BuildTools) ## Ballerina packages updates From ec18b84c634e8103527cc5e4897ccee9ea0ab3c6 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Tue, 9 Jul 2024 22:32:24 +0530 Subject: [PATCH 18/53] Update metadata.json --- _data/swanlake-latest/metadata.json | 24 +++++++++++----------- _data/swanlake_release_notes_versions.json | 21 +++++++++++++++++++ utils/archived-lm.json | 8 ++++++++ utils/rl.json | 8 ++++++++ 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/_data/swanlake-latest/metadata.json b/_data/swanlake-latest/metadata.json index 829a58a66542..90e44bfc2e35 100644 --- a/_data/swanlake-latest/metadata.json +++ b/_data/swanlake-latest/metadata.json @@ -1,21 +1,21 @@ { - "version":"2201.9.1", - "short-version":"2201.9.1", - "display-version":"2201.9.1 (Swan Lake Update 9)", - "release-date":"2024-06-14", - "windows-installer":"ballerina-2201.9.1-swan-lake-windows-x64.msi", + "version":"2201.9.2", + "short-version":"2201.9.2", + "display-version":"2201.9.2 (Swan Lake Update 9)", + "release-date":"2024-07-09", + "windows-installer":"ballerina-2201.9.2-swan-lake-windows-x64.msi", "windows-installer-size":"177mb", - "linux-installer":"ballerina-2201.9.1-swan-lake-linux-x64.deb", + "linux-installer":"ballerina-2201.9.2-swan-lake-linux-x64.deb", "linux-installer-size":"198mb", - "macos-installer":"ballerina-2201.9.1-swan-lake-macos-x64.pkg", + "macos-installer":"ballerina-2201.9.2-swan-lake-macos-x64.pkg", "macos-installer-size":"234mb", - "macos-arm-installer":"ballerina-2201.9.1-swan-lake-macos-arm-x64.pkg", + "macos-arm-installer":"ballerina-2201.9.2-swan-lake-macos-arm-x64.pkg", "macos-arm-installer-size":"234mb", - "rpm-installer":"ballerina-2201.9.1-swan-lake-linux-x64.rpm", + "rpm-installer":"ballerina-2201.9.2-swan-lake-linux-x64.rpm", "rpm-installer-size":"237mb", "other-artefacts":[ - "ballerina-2201.9.1-swan-lake.zip" + "ballerina-2201.9.2-swan-lake.zip" ], - "api-docs":"ballerina-api-docs-2201.9.1.zip", - "release-notes":"ballerina-release-notes-2201.9.1.md" + "api-docs":"ballerina-api-docs-2201.9.2.zip", + "release-notes":"ballerina-release-notes-2201.9.2.md" } diff --git a/_data/swanlake_release_notes_versions.json b/_data/swanlake_release_notes_versions.json index a97190736848..0c8aa905e621 100644 --- a/_data/swanlake_release_notes_versions.json +++ b/_data/swanlake_release_notes_versions.json @@ -1324,5 +1324,26 @@ ], "api-docs":"ballerina-api-docs-2201.9.0.zip", "release-notes":"ballerina-release-notes-2201.9.0.md" +}, +{ + "version":"2201.9.1", + "short-version":"2201.9.1", + "display-version":"2201.9.1 (Swan Lake Update 9)", + "release-date":"2024-06-14", + "windows-installer":"ballerina-2201.9.1-swan-lake-windows-x64.msi", + "windows-installer-size":"177mb", + "linux-installer":"ballerina-2201.9.1-swan-lake-linux-x64.deb", + "linux-installer-size":"198mb", + "macos-installer":"ballerina-2201.9.1-swan-lake-macos-x64.pkg", + "macos-installer-size":"234mb", + "macos-arm-installer":"ballerina-2201.9.1-swan-lake-macos-arm-x64.pkg", + "macos-arm-installer-size":"234mb", + "rpm-installer":"ballerina-2201.9.1-swan-lake-linux-x64.rpm", + "rpm-installer-size":"237mb", + "other-artefacts":[ + "ballerina-2201.9.1-swan-lake.zip" + ], + "api-docs":"ballerina-api-docs-2201.9.1.zip", + "release-notes":"ballerina-release-notes-2201.9.1.md" } ] diff --git a/utils/archived-lm.json b/utils/archived-lm.json index 7e8c61991f0d..f54010cb27bb 100644 --- a/utils/archived-lm.json +++ b/utils/archived-lm.json @@ -22,6 +22,14 @@ "url": "https://lib.ballerina.io/", "id": "swan-lake-api-docs" }, + { + "dirName": "2201.9.1", + "level": 2, + "position": 1, + "isDir": false, + "url": "#2201.9.1", + "id": "2201.9.1v" + }, { "dirName": "2201.9.0", "level": 2, diff --git a/utils/rl.json b/utils/rl.json index 133f8ca42627..bb7ad0466bf5 100644 --- a/utils/rl.json +++ b/utils/rl.json @@ -14,6 +14,14 @@ "url": "/downloads/swan-lake-release-notes", "id": "swan-lake-release-notes", "subDirectories": [ + { + "dirName": "2201.9.2 (Swan Lake Update 9)", + "level": 2, + "position": 1, + "isDir": false, + "url": "/downloads/swan-lake-release-notes/swan-lake-2201.9.2", + "id": "swan-lake-2201.9.2" + }, { "dirName": "2201.9.1 (Swan Lake Update 9)", "level": 2, From 662e4284a424cad14b0eb395c51bad6d52776552 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Tue, 9 Jul 2024 22:56:53 +0530 Subject: [PATCH 19/53] Update RELEASE_NOTE.md --- .../swan-lake-2201.9.2/RELEASE_NOTE.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md index 4610814ec1da..e3f187c251cc 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.9.2/RELEASE_NOTE.md @@ -56,13 +56,13 @@ Introduced the WSDL CLI tool as an experimental feature that generates Ballerina Execute the following command to pull the tool from the Ballerina Central. -```bash +``` $ bal tool pull wsdl ``` Execute the following command to generate Ballerina types from a WSDL file. -```bash +``` $ bal wsdl -i [--operations ] # -i, --input @@ -87,7 +87,7 @@ To view bug fixes, see the GitHub milestone for Swan Lake Update 9 (2201.9.2) of Introduced an experimental build option to enable memory-efficient compilation of package dependencies. This can help prevent out-of-memory issues during the initial compilation with a clean central cache. Pass the flag to the `bal` command or specify the build option in the `Ballerina.toml` file to enable this experimental feature. -```bash +``` $ bal build --optimize-dependency-compilation ``` From 9326afb0929ce8c88e6b28c2afd38849848d8ddf Mon Sep 17 00:00:00 2001 From: Asma Jabir Date: Wed, 10 Jul 2024 01:37:25 +0530 Subject: [PATCH 20/53] Update the 2201.8.7 release note --- .../swan-lake-2201.8.7/RELEASE_NOTE.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/downloads/swan-lake-release-notes/swan-lake-2201.8.7/RELEASE_NOTE.md b/downloads/swan-lake-release-notes/swan-lake-2201.8.7/RELEASE_NOTE.md index 299c03c6d381..804f15790e32 100644 --- a/downloads/swan-lake-release-notes/swan-lake-2201.8.7/RELEASE_NOTE.md +++ b/downloads/swan-lake-release-notes/swan-lake-2201.8.7/RELEASE_NOTE.md @@ -28,6 +28,28 @@ If you have not installed Ballerina, then, download the [installers](/downloads/ ## Language updates +### Improvements + +Introduced timeout configurations to prevent premature commits of long-running transactions. The following configurations related to transactions can be added to the `Config.toml` file. + +```toml +[ballerina.lang.transaction] +transactionAutoCommitTimeout=120 +transactionCleanupTimeout=600 +``` + ### Bug fixes To view bug fixes, see the [GitHub milestone for Swan Lake Update 8 (2201.8.7)](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+label%3AType%2FBug+is%3Aclosed+milestone%3A2201.8.7). + +## Developer tools updates + +### Improvements + +Improved the performance of the VSCode editor. + +## Bug fixes + +To view bug fixes, see the GitHub milestone for Swan Lake Update 8 (2201.8.7) of the repositories below. +- [Debugger](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A2201.8.7+is%3Aclosed+label%3AArea%2FDebugger+label%3AType%2FBug) +- [Project API](https://github.com/ballerina-platform/ballerina-lang/issues?q=is%3Aissue+milestone%3A2201.8.7+is%3Aclosed+label%3AArea%2FProjectAPI+label%3AType%2FBug) From 1bf07141ca97c4eb590fd05b8e06aa6bd3dbcff9 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Thu, 11 Jul 2024 11:34:05 +0530 Subject: [PATCH 21/53] Add release note for 1.2.53 release --- _data/release_notes_versions.json | 18 +++++++++++++ downloads/1.2.x-release-notes/1.2.53.md | 34 +++++++++++++++++++++++++ utils/archived-lm.json | 8 ++++++ utils/rl.json | 8 ++++++ 4 files changed, 68 insertions(+) create mode 100644 downloads/1.2.x-release-notes/1.2.53.md diff --git a/_data/release_notes_versions.json b/_data/release_notes_versions.json index ea531e432759..ef87dde32a45 100644 --- a/_data/release_notes_versions.json +++ b/_data/release_notes_versions.json @@ -1438,5 +1438,23 @@ ], "api-docs": "ballerina-api-docs-1.2.52.zip", "release-notes": "ballerina-release-notes-1.2.52.md" + }, + { + "version":"1.2.53", + "release-date":"2024-07-11", + "windows-installer":"ballerina-windows-installer-x64-1.2.53.msi", + "windows-installer-size":"272K", + "linux-installer":"ballerina-linux-installer-x64-1.2.53.deb", + "linux-installer-size":"152mb", + "macos-installer":"ballerina-macos-installer-x64-1.2.53.pkg", + "macos-installer-size":"171mb", + "rpm-installer":"ballerina-linux-installer-x64-1.2.53.rpm", + "rpm-installer-size":"174mb", + "other-artefacts":[ + "ballerina-1.2.53.zip", + "ballerina-1.2.53.vsix" + ], + "api-docs":"ballerina-api-docs-1.2.53.zip", + "release-notes":"ballerina-release-notes-1.2.53.md" } ] diff --git a/downloads/1.2.x-release-notes/1.2.53.md b/downloads/1.2.x-release-notes/1.2.53.md new file mode 100644 index 000000000000..566daab685c9 --- /dev/null +++ b/downloads/1.2.x-release-notes/1.2.53.md @@ -0,0 +1,34 @@ +--- +layout: ballerina-left-nav-release-notes +title: 1.2.53 +permalink: /downloads/1.2.x-release-notes/1.2.53/ +active: 1.2.53 +redirect_from: + - /downloads/1.2.x-release-notes/ +--- + +## Overview of jBallerina 1.2.53 + +The jBallerina 1.2.53 patch release improves upon the 1.2.52 release by addressing the issue of Inaccurate Metrics Due to Concurrency Issues in Observer Context List. + +You can use the update tool to update to jBallerina 1.2.53 as follows. + +**For existing users:** + +If you are already using jBallerina version 1.2.14, or above, you can directly update your distribution to jBallerina 1.2.53 by executing the following command: + +``` +bal dist update +``` + +However, if you are using + +- jBallerina 1.2.0 to 1.2.13, run `ballerina dist update` to update +- jBallerina 1.2.0 but being switched to a previous version, run `ballerina dist pull jballerina-1.2.53` to update +- a jBallerina version below 1.1.0, install via the [installers](https://ballerina.io/downloads/) + +**For new users:** + +If you have not installed jBallerina, then download the [installers](https://ballerina.io/downloads/) to install. + + \ No newline at end of file diff --git a/utils/archived-lm.json b/utils/archived-lm.json index f54010cb27bb..f22976092336 100644 --- a/utils/archived-lm.json +++ b/utils/archived-lm.json @@ -593,6 +593,14 @@ "url": "/1.2/learn/api-docs/ballerina/", "id": "1.2.x-api-docs" }, + { + "dirName": "1.2.53", + "level": 2, + "position": 1, + "isDir": false, + "url": "#1.2.53", + "id": "1.2.53v" + }, { "dirName": "1.2.52", "level": 2, diff --git a/utils/rl.json b/utils/rl.json index bb7ad0466bf5..4cf8f886ab20 100644 --- a/utils/rl.json +++ b/utils/rl.json @@ -595,6 +595,14 @@ "url": "/downloads/1.2.x-release-notes", "id": "1.2.x-release-notes", "subDirectories": [ + { + "dirName": "1.2.53", + "level": 2, + "position": 1, + "isDir": false, + "url": "/downloads/1.2.x-release-notes/1.2.53", + "id": "1.2.53" + }, { "dirName": "1.2.52", "level": 2, From 02c633a9147e911423a89f6ad34694c0b2ca52da Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Thu, 11 Jul 2024 11:56:31 +0530 Subject: [PATCH 22/53] Update 1.2.53 release note --- downloads/1.2.x-release-notes/1.2.53.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/downloads/1.2.x-release-notes/1.2.53.md b/downloads/1.2.x-release-notes/1.2.53.md index 566daab685c9..747a7aa485d9 100644 --- a/downloads/1.2.x-release-notes/1.2.53.md +++ b/downloads/1.2.x-release-notes/1.2.53.md @@ -9,8 +9,6 @@ redirect_from: ## Overview of jBallerina 1.2.53 -The jBallerina 1.2.53 patch release improves upon the 1.2.52 release by addressing the issue of Inaccurate Metrics Due to Concurrency Issues in Observer Context List. - You can use the update tool to update to jBallerina 1.2.53 as follows. **For existing users:** From f7641543b7c33e31089f5ed096c81f55448068ff Mon Sep 17 00:00:00 2001 From: Nipuna Madhushan <51471998+NipunaMadhushan@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:01:16 +0530 Subject: [PATCH 23/53] Update downloads/1.2.x-release-notes/1.2.53.md Co-authored-by: Sarani Mendis --- downloads/1.2.x-release-notes/1.2.53.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloads/1.2.x-release-notes/1.2.53.md b/downloads/1.2.x-release-notes/1.2.53.md index 747a7aa485d9..1f038da5d391 100644 --- a/downloads/1.2.x-release-notes/1.2.53.md +++ b/downloads/1.2.x-release-notes/1.2.53.md @@ -9,7 +9,7 @@ redirect_from: ## Overview of jBallerina 1.2.53 -You can use the update tool to update to jBallerina 1.2.53 as follows. +You can use the Update tool to update to jBallerina 1.2.53 as follows. **For existing users:** From c9bf0f47fc4a5c74789c34dcbd615de40846b700 Mon Sep 17 00:00:00 2001 From: NipunaMadhushan Date: Thu, 11 Jul 2024 12:41:53 +0530 Subject: [PATCH 24/53] Update 1.2.53 release note --- downloads/1.2.x-release-notes/1.2.53.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/downloads/1.2.x-release-notes/1.2.53.md b/downloads/1.2.x-release-notes/1.2.53.md index 1f038da5d391..2b29b4809820 100644 --- a/downloads/1.2.x-release-notes/1.2.53.md +++ b/downloads/1.2.x-release-notes/1.2.53.md @@ -9,6 +9,8 @@ redirect_from: ## Overview of jBallerina 1.2.53 +The jBallerina 1.2.53 patch release improves upon the 1.2.52 release by adding security fixes. + You can use the Update tool to update to jBallerina 1.2.53 as follows. **For existing users:** From 7d9faa85d28ea022acace620b9cdea8c65a2b5ba Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 11 Jul 2024 13:57:06 +0530 Subject: [PATCH 25/53] Update the wording and permalinks in Choreo blades --- components/ai/code/Code.js | 6 +++--- .../trivial-hosting-in-wso2-choreo-ipaas.md | 4 ++-- .../ballerina-vs-apollo-for-graphql/code/Code.js | 6 +++--- .../trivial-hosting-in-wso2-choreo-ipaas.md | 4 ++-- components/integration/code/Code.js | 6 +++--- .../trivial-hosting-in-wso2-choreo-ipaas.md | 4 ++-- pages/_app.js | 16 ++++++++++++++++ 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/components/ai/code/Code.js b/components/ai/code/Code.js index f842d802bbaf..9f4d107a044e 100644 --- a/components/ai/code/Code.js +++ b/components/ai/code/Code.js @@ -923,7 +923,7 @@ export default function UseCases(props) { -

+

props.getLink(e.target, 'trivial-hosting-in-wso2-choreo-ipaas')} + onClick={(e) => props.getLink(e.target, 'trivial-hosting-in-wso2-choreo')} > @@ -949,7 +949,7 @@ export default function UseCases(props) { (ipaas.frontmatter.url && ipaas.frontmatter.url !== '') ? : null diff --git a/components/ai/code/ai-bbe/trivial-hosting-in-wso2-choreo-ipaas.md b/components/ai/code/ai-bbe/trivial-hosting-in-wso2-choreo-ipaas.md index f64c6f2171c0..ade144409bd9 100644 --- a/components/ai/code/ai-bbe/trivial-hosting-in-wso2-choreo-ipaas.md +++ b/components/ai/code/ai-bbe/trivial-hosting-in-wso2-choreo-ipaas.md @@ -1,6 +1,6 @@ --- -title: '(Extra!) Trivial hosting in WSO2 Choreo iPaaS' +title: '(Extra!) Trivial hosting in WSO2 Choreo' description: Manual integrations? Scheduled integrations (cron jobs)? Triggered integrations? Integrations as APIs? No problem! Write the code, attach the repo to WSO2 Choreo, and let it do the rest. image: 'images/choreo-ipaas-image-v2.png' -url: 'https://wso2.com/choreo/ipaas/' +url: 'https://wso2.com/choreo/integration/' --- \ No newline at end of file diff --git a/components/integration/ballerina-vs-apollo-for-graphql/code/Code.js b/components/integration/ballerina-vs-apollo-for-graphql/code/Code.js index 8de7fff69a7d..05a23f26d62a 100644 --- a/components/integration/ballerina-vs-apollo-for-graphql/code/Code.js +++ b/components/integration/ballerina-vs-apollo-for-graphql/code/Code.js @@ -799,7 +799,7 @@ export default function UseCases(props) { -

+

props.getLink(e.target, 'trivial-hosting-in-wso2-choreo-ipaas')} + onClick={(e) => props.getLink(e.target, 'trivial-hosting-in-wso2-choreo')} > @@ -826,7 +826,7 @@ export default function UseCases(props) { : null diff --git a/components/integration/ballerina-vs-apollo-for-graphql/code/apollo-graphql-bbe/trivial-hosting-in-wso2-choreo-ipaas.md b/components/integration/ballerina-vs-apollo-for-graphql/code/apollo-graphql-bbe/trivial-hosting-in-wso2-choreo-ipaas.md index f64c6f2171c0..ade144409bd9 100644 --- a/components/integration/ballerina-vs-apollo-for-graphql/code/apollo-graphql-bbe/trivial-hosting-in-wso2-choreo-ipaas.md +++ b/components/integration/ballerina-vs-apollo-for-graphql/code/apollo-graphql-bbe/trivial-hosting-in-wso2-choreo-ipaas.md @@ -1,6 +1,6 @@ --- -title: '(Extra!) Trivial hosting in WSO2 Choreo iPaaS' +title: '(Extra!) Trivial hosting in WSO2 Choreo' description: Manual integrations? Scheduled integrations (cron jobs)? Triggered integrations? Integrations as APIs? No problem! Write the code, attach the repo to WSO2 Choreo, and let it do the rest. image: 'images/choreo-ipaas-image-v2.png' -url: 'https://wso2.com/choreo/ipaas/' +url: 'https://wso2.com/choreo/integration/' --- \ No newline at end of file diff --git a/components/integration/code/Code.js b/components/integration/code/Code.js index dd044596ee04..437b0d85c414 100644 --- a/components/integration/code/Code.js +++ b/components/integration/code/Code.js @@ -1015,7 +1015,7 @@ export default function UseCases(props) { -

+

props.getLink(e.target, 'trivial-hosting-in-wso2-choreo-ipaas')} + onClick={(e) => props.getLink(e.target, 'trivial-hosting-in-wso2-choreo')} > @@ -1042,7 +1042,7 @@ export default function UseCases(props) { : null diff --git a/components/integration/code/integration-bbe/trivial-hosting-in-wso2-choreo-ipaas.md b/components/integration/code/integration-bbe/trivial-hosting-in-wso2-choreo-ipaas.md index f64c6f2171c0..ade144409bd9 100644 --- a/components/integration/code/integration-bbe/trivial-hosting-in-wso2-choreo-ipaas.md +++ b/components/integration/code/integration-bbe/trivial-hosting-in-wso2-choreo-ipaas.md @@ -1,6 +1,6 @@ --- -title: '(Extra!) Trivial hosting in WSO2 Choreo iPaaS' +title: '(Extra!) Trivial hosting in WSO2 Choreo' description: Manual integrations? Scheduled integrations (cron jobs)? Triggered integrations? Integrations as APIs? No problem! Write the code, attach the repo to WSO2 Choreo, and let it do the rest. image: 'images/choreo-ipaas-image-v2.png' -url: 'https://wso2.com/choreo/ipaas/' +url: 'https://wso2.com/choreo/integration/' --- \ No newline at end of file diff --git a/pages/_app.js b/pages/_app.js index 56795a5cc3dc..89b785c108e7 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -20,8 +20,24 @@ import '../styles/globals.css'; import 'bootstrap/dist/css/bootstrap.min.css'; import 'bootstrap-icons/font/bootstrap-icons.css'; import {SSRProvider} from '@react-aria/ssr'; +import { useRouter } from 'next/router'; +import { useEffect } from 'react'; function MyApp({ Component, pageProps }) { + const router = useRouter(); + + useEffect(() => { + if (typeof window !== 'undefined') { + const hash = window.location.hash; + + if (hash === '#trivial-hosting-in-wso2-choreo-ipaas') { + const newHash = '#trivial-hosting-in-wso2-choreo'; + const newUrl = window.location.pathname + window.location.search + newHash; + router.replace(newUrl); + } + } + }, [router]); + return From cb663b0c18caccb46730f7c1733da8f59ae49a98 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Fri, 12 Jul 2024 21:59:13 +0530 Subject: [PATCH 26/53] Update styles and layout in university sessions --- _data/university_sessions.json | 71 ++++++++++++------- .../student-engagement/events/Events.js | 55 ++++++++------ .../events/Events.module.css | 23 +++++- 3 files changed, 101 insertions(+), 48 deletions(-) diff --git a/_data/university_sessions.json b/_data/university_sessions.json index cb96f55b7c5e..efa22b1211e6 100644 --- a/_data/university_sessions.json +++ b/_data/university_sessions.json @@ -7,7 +7,8 @@ "university": "Universitas Teknologi Digital Indonesia", "faculty": "Faculty of Information Technology", "title": "Elegant Integrations with Ballerina Swan Lake", - "location": "Virtual", + "isVirtual": true, + "location": "Indonesia", "presenters": [ { "name": "Manuranga Perera", @@ -24,7 +25,8 @@ "university": "Sabaragamuwa University of Sri Lanka", "faculty": "Faculty of Computing", "title": "Ballerina language for Seamless Integration", - "location": "Virtual", + "isVirtual": true, + "location": "Sri Lanka", "presenters": [ { "name": "Heshan Padmasiri", @@ -41,7 +43,8 @@ "university": "University of Moratuwa", "faculty": "Department of Computer Science & Engineering", "title": "Modern Compiler Trends: Insights from the Ballerina Compiler", - "location": "Moratuwa, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Hasitha Aravinda", @@ -58,7 +61,8 @@ "university": "University of Moratuwa", "faculty": "Department of Computer Science & Engineering", "title": "Code Generation and Intermediate Representation in Ballerina Compiler", - "location": "Moratuwa, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Manuranga Perera", @@ -75,7 +79,8 @@ "university": "Namibia University of Science and Technology", "faculty": "Department of Software Engineering", "title": "Elegant Integrations with Ballerina Swan Lake", - "location": "Virtual", + "isVirtual": true, + "location": "Namibia", "presenters": [ { "name": "Thisaru Guruge", @@ -92,7 +97,8 @@ "university": "Sikkim Manipal Institute of Technology", "faculty": "", "title": "Mastering API Integrations and Microservice Architecture", - "location": "Virtual", + "isVirtual": true, + "location": "India", "presenters": [ { "name": "Niveathika Rajendran", @@ -117,7 +123,8 @@ "university": "MAIT Campus", "faculty": "", "title": "Building Cloud Native Applications with Ballerina and Choreo", - "location": "Rohini - Delhi, India", + "isVirtual": false, + "location": "India", "presenters": [ { "name": "Tharik Kanaka", @@ -138,7 +145,8 @@ "university": "KIET", "faculty": "", "title": "Building Cloud Native Applications with Ballerina and Choreo", - "location": "Ghaziabad, India", + "isVirtual": false, + "location": "India", "presenters": [ { "name": "Tharik Kanaka", @@ -159,7 +167,8 @@ "university": "KR Mangalam University", "faculty": "", "title": "Building Cloud Native Applications with Ballerina and Choreo", - "location": "Gurugram, India", + "isVirtual": false, + "location": "India", "presenters": [ { "name": "Tharik Kanaka", @@ -180,7 +189,8 @@ "university": "Bennett University", "faculty": "", "title": "Building Cloud Native Applications with Ballerina and Choreo", - "location": "Greater Noida, India", + "isVirtual": false, + "location": "India", "presenters": [ { "name": "Tharik Kanaka", @@ -201,7 +211,8 @@ "university": "Manav Rachna International Institute of Research and Studies", "faculty": "", "title": "Building Cloud Native Applications with Ballerina and Choreo", - "location": "Faridabad, India", + "isVirtual": false, + "location": "India", "presenters": [ { "name": "Tharik Kanaka", @@ -222,7 +233,8 @@ "university": "University of Peradeniya", "faculty": "Faculty of Engineering", "title": "Deploying Apps In Cloud", - "location": "Kandy, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Anuruddha Liyanarachchi", @@ -243,7 +255,8 @@ "university": "University of Moratuwa", "faculty": "Institute of Technology", "title": "Initiating and Integrating Software Development Projects", - "location": "Moratuwa, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Chiran Fernando", @@ -260,7 +273,8 @@ "university": "Informatics Institute of Technology (IIT)", "faculty": "", "title": "Empowering Modern Systems with Microservices and AI-as-a Service using Ballerina", - "location": "Colombo, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Anjana Supun", @@ -281,7 +295,8 @@ "university": "University of Moratuwa", "faculty": "Computer Science & Engineering", "title": "Mastering Web Backend Fundamentals Session 2: Exploring the era of microservices and API integrations with Ballerina", - "location": "Moratuwa, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Nipuna Ranasinghe", @@ -306,7 +321,8 @@ "university": "Namibia University of Science and Technology", "faculty": "Department of Software Engineering", "title": "Demo on GraphQL Kafka and Docker", - "location": "Virtual", + "isVirtual": true, + "location": "Namibia", "presenters": [ { "name": "Dilan Sachintha", @@ -323,7 +339,8 @@ "university": "University of Peradeniya", "faculty": "Faculty of Engineering", "title": "Mastering Microservices and APIs with Ballerina: A Practical Guide", - "location": "Kandy, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Thisaru Guruge", @@ -344,7 +361,8 @@ "university": "Namibia University of Science and Technology", "faculty": "Department of Software Engineering", "title": "Elegent integrations with Ballerina Swan Lake", - "location": "Virtual", + "isVirtual": true, + "location": "Namibia", "presenters": [ { "name": "Manuranga Perera", @@ -361,7 +379,8 @@ "university": "University of Moratuwa", "faculty": "Computer Science & Engineering", "title": "Mastering web backend fundamentals: from concept to cloud - Session 1", - "location": "Moratuwa, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Hasitha Aravinda", @@ -386,7 +405,8 @@ "university": "University of Colombo School of Computing (UCSC)", "faculty": "", "title": "Introduction to Ballerina", - "location": "Colombo, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Dilan Perera", @@ -403,7 +423,8 @@ "university": "University of Colombo School of Computing (UCSC)", "faculty": "", "title": "Compiler Construction Insights from the Ballerina Language", - "location": "Colombo, Sri Lanka", + "isVirtual": false, + "location": "Sri Lanka", "presenters": [ { "name": "Manuranga Perera", @@ -424,7 +445,8 @@ "university": "Sikkim Manipal Institute of Technology", "faculty": "", "title": "Ballerina language workshop", - "location": "Sikkim, India", + "isVirtual": false, + "location": "India", "presenters": [ { "name": "Aditya Upadhyay", @@ -441,7 +463,8 @@ "university": "University of Texas - Dallas", "faculty": "", "title": "Ballerina language: Seamless Integration and Cloud-Native Development", - "location": "Virtual", + "isVirtual": true, + "location": "USA", "presenters": [ { "name": "Anupama Pathirage", @@ -452,4 +475,4 @@ "buttonText": "View slides" } ] -} +} \ No newline at end of file diff --git a/components/student-engagement/events/Events.js b/components/student-engagement/events/Events.js index ca3cf4ec86ba..1fa0a9c19fc2 100644 --- a/components/student-engagement/events/Events.js +++ b/components/student-engagement/events/Events.js @@ -56,28 +56,39 @@ export function Session(props) { :

{item.university}{item.faculty !== "" ? <> - {item.faculty} : null}

} -
{item.title}
- { - item.presenters.length > 0 ? - <> - { - item.presenters.map((presenter, index) => { - return ( - - {presenter.name} - { - index + 1 < item.presenters.length ? - <>, - : null - } - - ) +
{item.title} {item.isVirtual && <>(Virtual)}
+
Conducted by:   + { + item.presenters.length > 0 ? + <> + { + item.presenters.map((presenter, index) => { + const isLast = index === item.presenters.length - 1; + const isSecondLast = index === item.presenters.length - 2; + const hasTwoPresenters = item.presenters.length === 2; + + return ( + + {presenter.name} + { + !isLast && ( + hasTwoPresenters + ? and + : (isSecondLast + ? , and + : , + ) + ) + } + + ) + }) } - ) - } - - : null - } + + + : null + } +
{ @@ -165,4 +176,4 @@ export default function Events(props) { ); -} +} \ No newline at end of file diff --git a/components/student-engagement/events/Events.module.css b/components/student-engagement/events/Events.module.css index 140b3bef4322..70338033de57 100644 --- a/components/student-engagement/events/Events.module.css +++ b/components/student-engagement/events/Events.module.css @@ -6,8 +6,15 @@ } .eventRows { - margin-bottom: 40px; + font-weight: 400; + margin-top: 40px; +} + +.eventRows:not(:last-of-type) { + border-bottom: 0.3px solid #d9dadb; + margin-bottom: 40px; + padding-bottom: 40px; } .eventRows p { @@ -49,6 +56,12 @@ font-weight: 300; } +.eventDetail { + display: flex; + flex-direction: column; + justify-content: space-between; +} + .eventDetail a { color: #20b6b0; text-decoration: none; @@ -97,4 +110,10 @@ a.eventRegistration:hover { a.eventRegistration { margin: 0 15px; } -} \ No newline at end of file +} + +.eventDateContainer { + display: flex; + flex-direction: column; + justify-content: space-between; +} From a717d1100e38a3f05241f65fb82d6b6b22706840 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Fri, 12 Jul 2024 22:01:58 +0530 Subject: [PATCH 27/53] Update university_sessions.json --- _data/university_sessions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/university_sessions.json b/_data/university_sessions.json index efa22b1211e6..0b88679767a6 100644 --- a/_data/university_sessions.json +++ b/_data/university_sessions.json @@ -475,4 +475,4 @@ "buttonText": "View slides" } ] -} \ No newline at end of file +} From a91e4f22d5a60d11e4db263e6bead79b72998d06 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Fri, 12 Jul 2024 22:02:40 +0530 Subject: [PATCH 28/53] Update Events.js --- components/student-engagement/events/Events.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/student-engagement/events/Events.js b/components/student-engagement/events/Events.js index 1fa0a9c19fc2..9afccafa8a62 100644 --- a/components/student-engagement/events/Events.js +++ b/components/student-engagement/events/Events.js @@ -176,4 +176,4 @@ export default function Events(props) { ); -} \ No newline at end of file +} From ca8f7923836aa8d7ead79b0e140fbba4d9a3cc2d Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Mon, 15 Jul 2024 09:28:59 +0000 Subject: [PATCH 29/53] Update ballerina standard library specifications --- public/spec/http/spec.md | 42 +++++++++++++++++++++++++++++++++------- spec/http/spec.md | 42 +++++++++++++++++++++++++++++++++------- 2 files changed, 70 insertions(+), 14 deletions(-) diff --git a/public/spec/http/spec.md b/public/spec/http/spec.md index 63cc4c36375c..29339bcc0cbc 100644 --- a/public/spec/http/spec.md +++ b/public/spec/http/spec.md @@ -2498,20 +2498,48 @@ path = "testTraceLog.txt" # Optional host = "localhost" # Optional port = 8080 # Optional ``` + #### 8.2.4 Access log +Ballerina supports HTTP access logs for HTTP services, providing insights into web traffic and request handling. +The access log feature is **disabled by default** to allow users to opt-in as per their requirements. -Ballerina supports HTTP access logs for HTTP services. The access log format used is the combined log format. -The HTTP access logs are **disabled as default**. -To enable access logs, set console=true under the ballerina.http.accessLogConfig in the Config.toml file. Also, -the path field can be used to specify the file path to save the access logs. +To enable access logs, configuration settings are provided under `ballerina.http.accessLogConfig` in the +`Config.toml` file. Users can specify whether logs should be output to the console, a file, or both, +and can select the format and specific attributes to log. ```toml [ballerina.http.accessLogConfig] # Enable printing access logs in console console = true # Default is false -# Specify the file path to save the access logs -path = "testAccessLog.txt" # Optional -``` +# Specify the file path to save the access logs +path = "testAccessLog.txt" # Optional, omit to disable file logging +# Select the format of the access logs +format = "json" # Options: "flat", "json"; Default is "flat". Omit to stick to the default. +# Specify which attributes to log. Omit to stick to the default set. +attributes = ["ip", "date_time", "request", "status", "response_body_size", "http_referrer", "http_user_agent"] +# Default attributes: ip, date_time, request, status, response_body_size, http_referrer, http_user_agent +``` + +##### Configurable Attributes +Users can customize which parts of the access data are logged by specifying attributes in the configuration. +This allows for tailored logging that can focus on particular details relevant to the users' needs. + +| Attribute | Description | +|:----------------------:|:---------------------------------------------------:| +| ip | Client's IP address | +| date_time | HTTP request received time | +| request | Full HTTP request line (method, URI, protocol) | +| request_method | HTTP method of the request | +| request_uri | URI of the request, including parameters | +| scheme | Scheme of the request and HTTP version | +| status | HTTP status code returned to the client | +| request_body_size | Size of the request body in bytes | +| response_body_size | Size of the HTTP response body in bytes | +| request_time | Total time taken to process the request | +| http_referrer | HTTP Referer header, indicating the previous page | +| http_user_agent | User-Agent header, identifying the client software | +| http_x_forwarded_for | Originating IP address if using a proxy | +| http_(X-Custom-Header) | Header fields. Referring to them with `http` followed by the header name. (`x-request-id` ->; `http_x-request-id`) | #### 8.2.5 Panic inside resource diff --git a/spec/http/spec.md b/spec/http/spec.md index 63cc4c36375c..29339bcc0cbc 100644 --- a/spec/http/spec.md +++ b/spec/http/spec.md @@ -2498,20 +2498,48 @@ path = "testTraceLog.txt" # Optional host = "localhost" # Optional port = 8080 # Optional ``` + #### 8.2.4 Access log +Ballerina supports HTTP access logs for HTTP services, providing insights into web traffic and request handling. +The access log feature is **disabled by default** to allow users to opt-in as per their requirements. -Ballerina supports HTTP access logs for HTTP services. The access log format used is the combined log format. -The HTTP access logs are **disabled as default**. -To enable access logs, set console=true under the ballerina.http.accessLogConfig in the Config.toml file. Also, -the path field can be used to specify the file path to save the access logs. +To enable access logs, configuration settings are provided under `ballerina.http.accessLogConfig` in the +`Config.toml` file. Users can specify whether logs should be output to the console, a file, or both, +and can select the format and specific attributes to log. ```toml [ballerina.http.accessLogConfig] # Enable printing access logs in console console = true # Default is false -# Specify the file path to save the access logs -path = "testAccessLog.txt" # Optional -``` +# Specify the file path to save the access logs +path = "testAccessLog.txt" # Optional, omit to disable file logging +# Select the format of the access logs +format = "json" # Options: "flat", "json"; Default is "flat". Omit to stick to the default. +# Specify which attributes to log. Omit to stick to the default set. +attributes = ["ip", "date_time", "request", "status", "response_body_size", "http_referrer", "http_user_agent"] +# Default attributes: ip, date_time, request, status, response_body_size, http_referrer, http_user_agent +``` + +##### Configurable Attributes +Users can customize which parts of the access data are logged by specifying attributes in the configuration. +This allows for tailored logging that can focus on particular details relevant to the users' needs. + +| Attribute | Description | +|:----------------------:|:---------------------------------------------------:| +| ip | Client's IP address | +| date_time | HTTP request received time | +| request | Full HTTP request line (method, URI, protocol) | +| request_method | HTTP method of the request | +| request_uri | URI of the request, including parameters | +| scheme | Scheme of the request and HTTP version | +| status | HTTP status code returned to the client | +| request_body_size | Size of the request body in bytes | +| response_body_size | Size of the HTTP response body in bytes | +| request_time | Total time taken to process the request | +| http_referrer | HTTP Referer header, indicating the previous page | +| http_user_agent | User-Agent header, identifying the client software | +| http_x_forwarded_for | Originating IP address if using a proxy | +| http_(X-Custom-Header) | Header fields. Referring to them with `http` followed by the header name. (`x-request-id` ->; `http_x-request-id`) | #### 8.2.5 Panic inside resource From 827119627507c8f1db9b7f696a330fcd97b85de4 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 18 Jul 2024 10:22:44 +0530 Subject: [PATCH 30/53] Add new article --- _data/articles.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/_data/articles.json b/_data/articles.json index c33e66788070..3aa280cc0c6b 100644 --- a/_data/articles.json +++ b/_data/articles.json @@ -1,5 +1,12 @@ { "articles": [ + { + "url": "https://thearabianpost.com/innovation-in-programming-5-emerging-open-source-languages-catching-attention/", + "title": "Innovation in Programming: 5 Emerging Open Source Languages Catching Attention", + "author": "", + "source": "Arabian Post", + "date": "July 16, 2024" + }, { "url": "https://middaylive.com/technology/5-cutting-edge-programming-languages-that-you-should-not-ignore/", "title": "5 Cutting-edge programming languages that you should not ignore", From 2f1815bb2442014fb6c7f483cfb08d5862019289 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 18 Jul 2024 14:08:43 +0530 Subject: [PATCH 31/53] Update spec.md --- spec/spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec.md b/spec/spec.md index a0bb2acda2e8..1f3a7e7a7af5 100644 --- a/spec/spec.md +++ b/spec/spec.md @@ -33,7 +33,7 @@ Below are the most stable versions of the language specification, which are in s | Version | Release Date | Description | | ------- | ------------ | ----------- | -| 2023R1 | 2023-07-07 | First release of 2023. This is the basis for Ballerina Swan Lake Update 7. | +| 2023R1 | 2023-07-07 | First release of 2023. This is the basis for Ballerina Swan Lake Update 7 and upwards. | | 2022R4 | 2022-12-09 | Fourth release of 2022. This is the basis for Ballerina 2201.3.0 (Swan Lake Update 3). | | 2022R3 | 2022-08-12 | Third release of 2022. This is the basis for Ballerina 2201.2.0 (Swan Lake Update 2). | | 2022R2 | 2022-06-02 | Second release of 2022. This is the basis for Ballerina 2201.1.0 (Swan Lake Update 1). | From d6d07d65944a7cf67afd3102104d1d2d6ca0d0a0 Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Thu, 18 Jul 2024 09:14:00 +0000 Subject: [PATCH 32/53] [Automated] Sync new spec release with ballerina dev site --- public/spec/lang/2024R1/index.html | 15251 ++++++++++++++++ public/spec/lang/2024R1/spec.xml | 14723 +++++++++++++++ .../ballerina-language-specification.css | 86 + .../style/ballerina-language-specification.js | 22 + spec/spec.md | 2 +- 5 files changed, 30083 insertions(+), 1 deletion(-) create mode 100644 public/spec/lang/2024R1/index.html create mode 100644 public/spec/lang/2024R1/spec.xml create mode 100644 public/spec/lang/2024R1/style/ballerina-language-specification.css create mode 100644 public/spec/lang/2024R1/style/ballerina-language-specification.js diff --git a/public/spec/lang/2024R1/index.html b/public/spec/lang/2024R1/index.html new file mode 100644 index 000000000000..cf2e3ac59500 --- /dev/null +++ b/public/spec/lang/2024R1/index.html @@ -0,0 +1,15251 @@ + + + + Ballerina Language Specification + + + + + + + +

Ballerina Language Specification, 2024R1

+

+Primary contributors: +

+ +

+(Other contributors are listed in Appendix D.) +

+

+Copyright © 2018-2024 WSO2 +

+

+Licensed under the Creative Commons +Attribution-NoDerivatives 4.0 International license +

+

+Language and document status +

+

+The language described in this specification is now stable. We do not plan to +make changes that introduce significant incompatibilities. +

+

+This release contains a preview of the regular expression feature. Minor +changes may be made before it becomes stable. +

+

+Comments on this document are welcome and should be made by creating an issue in +https://github.com/ballerina-platform/ballerina-spec, which is the +GitHub repository where this specification is maintained. +

+

Table of contents

+
+
+

1. Introduction

+

+Ballerina is a statically typed, concurrent programming language, focusing on +network interaction and structured data. It is intended to be the core of a +language-centric middleware platform. It has all the general-purpose +functionality expected of a modern programming language, but it also has several +unusual aspects that make it particularly suitable for its intended purpose. +

+

+First, it provides language constructs specifically for consuming and providing +network services. Future versions of Ballerina will add language constructs for +other middleware functionality such as event stream processing and reliable +messaging; this is described in more detail in Appendix C. +

+

+Second, its abstractions and syntax for concurrency and network interaction have +been designed so that there is a close correspondence with sequence diagrams. +This enables a bidirectional mapping for any Ballerina function between its +textual representation in the syntax described in this specification and its +graphical representation as a sequence diagram, such that the sequence diagram +fully shows the aspects of the behavior of that function that relate to +concurrency and network interaction. +

+

+Third, it has a type system that is more flexible and allows for looser coupling +than traditional statically typed languages. The type system is structural: +instead of requiring the program to explicitly say which types are compatible +with each other, compatibility of types and values is determined automatically +based on their structure; this is particularly useful when combining data from +multiple, independently-designed systems. In addition, the type system provides +union types and open records. This flexibility allows the type system to be used +as a schema for the data that is exchanged in distributed applications. +Ballerina's data types are designed to work particularly well with JSON; any +JSON value has a direct, natural representation as a Ballerina value. Ballerina +also provides support for XML and tabular data. +

+

+Ballerina is not a research language. It is intended to be a pragmatic language +suitable for mass-market commercial adoption. It tries to feel familiar to +programmers who are used to popular, modern C-family languages, notably Java, C# +and JavaScript. It also gets ideas and inspiration from many other existing +programming languages including TypeScript, Go, Rust, D, Kotlin, Swift, Python +and Perl. +

+

+The Ballerina language has been designed in conjunction with the Ballerina +platform, which provides comprehensive support for a module-based software +development model, including versioning, dependency management, testing, +documentation, building and sharing. Modules are organized into repositories; +there is a globally-shared, central repository, but repositories can also be +local. +

+

+The Ballerina language includes a small library, the lang library, which +provides fundamental operations on the data types defined by the language; the +lang library is defined by this specification. The Ballerina platform includes +an extensive standard library, which includes not only the usual low-level, +general-purpose functionality, but also support for a wide variety of network +protocols, interface standards, data formats and authentication/authorization +standards, which make writing secure, resilient distributed applications +significantly easier than with other languages. The standard library is not +specified in this document. +

+
+
+

2. Notation

+

+Productions are written in the form: +

+ +
symbol := rhs
+
+

+where symbol is the name of a nonterminal, and rhs is as follows: +

+
    +
  • +0xX means the single character whose Unicode code point is +denoted by the hexadecimal numeral X
  • +
  • +^x means any single Unicode code point that does not match x +and is not a disallowed character;
  • +
  • +x..y means any single Unicode character whose code point is +greater than or equal to that of x and less than or equal to that of y
  • +
  • +xyz means the characters xyz literally
  • +
  • +xyzNR means the characters xyz literally, +and xyz is not a reserved keyword
  • +
  • +symbol means a reference to production for the nonterminal +symbol +
  • +
  • +x|y means x or y
  • +
  • +x&y means x and y, interleaved in any order
  • +
  • +[x] means zero or one times
  • +
  • +x? means x zero or one times
  • +
  • +x* means x zero or more times
  • +
  • +x+ means x one or more times
  • +
  • +(x) means x (grouping)
  • +
+

+The rhs of a symbol that starts with a lower-case letter implicitly allows white +space and comments, as defined by the production TokenWhiteSpace, +between the terminals and nonterminals that it references. +

+
+
+

3. Program structure

+

+A Ballerina program is divided into modules. A module has a source form and a +binary form. The source form of a module consists of an ordered collection of +one or more source parts; each source part is a sequence of bytes that is the +UTF-8 encoding of part of the source code for the module. The format of a source +part is defined by this specification. The format of a binary module is +specified by the Ballerina platform. +

+

+A source module can reference other modules. Each source module can be +separately compiled into a binary module: compilation of a source module needs +access only to the binary form of other modules referenced from the source +module. A source module identifies each module that it references using an +organization name and a module name, which is divided into one or more parts. +Both the organization name and each part of the module name are Unicode strings. +Any organization name starting with the string ballerina is +reserved for use by the Ballerina platform. +

+

+The Ballerina platform defines a packaging system for Ballerina modules, which +allows one or more modules to be combined into a package. The packaging system +treats the first part of each module's name as being a package name. All the +modules combined into a package share the same package name. Packages have both +a source and a binary format. The source format stores the source form of a +package's modules in a hierarchical filesystem. The binary format stores the +binary form of a package's module as a sequence of bytes. +

+

+Binary packages can be stored in a package repository. Packages are versioned; +versions are semantic, as described in the SemVer specification. A package +repository can store multiple versions of the same package. Thus, within a +repository, binary packages are organized into a three-level hierarchy: +

+
    +
  1. organization;
  2. +
  3. package name;
  4. +
  5. version.
  6. +
+

+The source format of a package includes a Ballerina.toml file that +allows control over the package versions used for referenced modules. +

+

+The packaging system also allows control over which modules are exported from a +package; modules that are not exported from a package are visible only to +modules within the package. +

+
+
+

4. Lexical structure

+

+The grammar in this document specifies how a sequence of Unicode code points is +interpreted as part of the source of a Ballerina module. A Ballerina module part +is a sequence of octets (8-bit bytes); this sequence of octets is interpreted as +the UTF-8 encoding of a sequence of code points and must comply with the +requirements of RFC 3629. +

+

+After the sequence of octets is decoded from UTF-8, the following two +transformations must be performed before it is parsed using the grammar in this +document: +

+
    +
  • if the sequence starts with a byte order mark (code point 0xFEFF), it must +be removed
  • +
  • newlines are normalized as follows: +
      +
    • the two character sequence 0xD 0xA is replaced by 0xA
    • +
    • a single 0xD character that is not followed by 0xD is replaced by 0xA
    • +
    +
  • +
+

+The sequence of code points must not contain any of the following disallowed +code points: +

+
    +
  • surrogates (0xD800 to 0xDFFF)
  • +
  • non-characters (the 66 code points that Unicode designates as +non-characters)
  • +
  • C0 control characters (0x0 to 0x1F and 0x1F) other than white space (0x9, +0xA, 0xC, 0xD)
  • +
  • C1 control characters (0x80 to 0x9F)
  • +
+

+Note that the grammar notation ^X does not allow the above disallowed code +points. +

+ +
identifier := UnquotedIdentifier | QuotedIdentifier
+UnquotedIdentifier := (IdentifierInitialChar | IdentifierEscape) (IdentifierFollowingChar | IdentifierEscape)*
+QuotedIdentifier := ' (IdentifierFollowingChar | IdentifierEscape)+
+IdentifierInitialChar :=  AsciiLetter | _ | UnicodeIdentifierChar
+IdentifierFollowingChar := IdentifierInitialChar | Digit
+IdentifierEscape := IdentifierSingleEscape | NumericEscape
+IdentifierSingleEscape := \ ^ ( AsciiLetter | 0x9 | 0xA | 0xD | UnicodePatternWhiteSpaceChar )
+NumericEscape := \u{ CodePoint }
+CodePoint := HexDigit+
+AsciiLetter := A .. Z | a .. z
+UnicodeIdentifierChar := ^ ( AsciiChar | UnicodeNonIdentifierChar )
+AsciiChar := 0x0 .. 0x7F
+UnicodeNonIdentifierChar :=
+   UnicodePrivateUseChar
+   | UnicodePatternWhiteSpaceChar
+   | UnicodePatternSyntaxChar
+UnicodePrivateUseChar :=
+   0xE000 .. 0xF8FF
+   | 0xF0000 .. 0xFFFFD
+   | 0x100000 .. 0x10FFFD
+UnicodePatternWhiteSpaceChar := 0x200E | 0x200F | 0x2028 | 0x2029
+UnicodePatternSyntaxChar := character with Unicode property Pattern_Syntax=True
+Digit := 0 .. 9
+
+

+Note that the set of characters allowed in identifiers follows the requirements +of Unicode TR31 for immutable identifiers; the set of characters is immutable in +the sense that it does not change between Unicode versions. +

+

+The QuotedIdentifier syntax allows a reserved keyword +K can be used as an identifier by preceding it with a +single quote i.e. 'K. The IdentifierEscape +syntax allows an arbitrary non-empty string to be treated as an identifier. In a +NumericEscape, CodePoint must valid Unicode code +point; more precisely, it must be a hexadecimal numeral denoting an integer +n where 0 ≤ n < 0xD800 or 0xDFFF < n ≤ +0x10FFFF. +

+ +
RestrictedIdentifier := AsciiLetter RestrictedFollowingChar* RestrictedIdentifierWord*
+RestrictedIdentifierWord := _ RestrictedFollowingChar+
+RestrictedFollowingChar := AsciiLetter | Digit
+
+ +

+Identifiers used for the names of organizations and modules are restricted to +RestrictedIdentifier. +

+ +
TokenWhiteSpace := (Comment | WhiteSpaceChar)*
+Comment := // AnyCharButNewline*
+AnyCharButNewline := ^ 0xA
+WhiteSpaceChar := 0x9 | 0xA | 0xD | 0x20
+
+

+TokenWhiteSpace is implicitly allowed on the right hand side of +productions for non-terminals whose names start with a lower-case letter. +

+ +
NoSpaceColon := :
+
+

+When NoSpaceColon is used in a production, +TokenWhiteSpace is not allowed immediately before or after the +colon. When a literal : is used in a production, white space is +handled in the same was as for any other character. +

+ +
+
+

5. Values, types and variables

+ +
+

5.1 Overview

+ +
+

5.1.1 Type system fundamentals

+

+Ballerina programs operate on a rich universe of values. This universe of values +is partitioned into a number of basic types; every value belongs to +exactly one basic type. +

+

+Values are of four kinds, each corresponding to a kind of basic type: +

+
    +
  • simple values, like booleans and floating point numbers, which are not +composed from other values;
  • +
  • structured values, like mappings and lists, which contain values of arbitrary basic types;
  • +
  • sequence values, which consists of sequences of values of the same basic type;
  • +
  • behavioral values, like functions and objects, which are not just data.
  • +
+

+There is a fundamental distinction between values that have a storage +identity and values that do not. A value that has storage identity has an +identity that comes from the location where the value is stored. All structural +and behavioural values have a storage identity, whereas all simple values +do not. Storage identity for sequence values is more complicated and will be +explained in the section on sequence values. +

+

+Values can be stored in variables or as members of structures or in constituents +of sequences. When a value has no storage identity, it can be stored directly in +the variable, structure or sequence. However, when a value has storage identity, +what is stored in the variable, structure or sequence is a reference to the +location where the value is stored rather than the value itself. Storage +identity allows values in Ballerina to represent not just trees but graphs. +

+

+Ballerina provides the ability to test whether two values have the same storage +identity, but does not expose the specific storage location of a value. For +values with storage identity, there is the concept of creating a new +value: this means creating a value that has a storage identity that is different +from any existing value. For values with storage identity, there is also the +concept of copying: it means to create a value that is the same, except +for having a new storage identity. The concept of having storage identity is +similar to the concept of a reference type in some other programming languages, +but also accomodates the concept of a sequence value. +

+

+Ballerina programs use types to categorize values both at compile-time and +runtime. Types deal with an abstraction of values that does not consider storage +identity. This abstraction is called a shape. A type denotes a set of +shapes. Subtyping in Ballerina is semantic: a type S is a subtype of +type T if the set of shapes denoted by S is a subset of the set of shapes +denoted by T. Every value has a corresponding shape. A shape is specific to a +basic type: if two values have different basic types, then they have different +shapes. The shape of the values contained in a structured value are part of the +shape of the structured value. Since shapes do not deal with storage identity, +they represent trees rather graphs. For simple values, there is no difference +between a shape and a value, with the exception of floating point values where +the shape does not consider representation details that do not affect the +mathematical value being represented. +

+

+A value is plain data if it is a simple value, a sequence value, or a +structured value that does not contain a behavioral value at any depth. +More precisely, a value is defined to be plain data if it is +

+
    +
  • a simple value,
  • +
  • a sequence value,
  • +
  • a structured value, all of whose members are also plain data.
  • +
+

+Plain data values can in general contain cycles of references, but in some +contexts are restricted to be acyclic. Plain data values, including values with +cycles, can be compared for equality. +

+

+The two most important kinds of behavioural values are functions and objects. A +function value can be executed by calling it; when a function is called, it is +passed values and arguments and returns a value. An object encapsulates data +with functions that operate on the data: an object's members are divided into +fields, which hold the data, and methods, which are the functions that operate +on the data. +

+
+ +
+

5.1.2 Mutation

+

+There are two kinds of things that can be mutated in Ballerina: variables and +values. Mutation of values is tied to storage identity: mutation is only +possible for values with storage identity. When a value stored in some storage +location is mutated, the change will be visible through all variables referring +to the value in that location. But not all values with storage identity can be +mutated: a value may not support mutation even though it has a storage identity. +

+

+The possibility of mutation gives rise to two relations between a value and a +type: +

+
    +
  • a value looks like a type at a particular point in the execution of +a program if its shape at that point is a member of the type;
  • +
  • a value belongs to a type if it looks like the type, and it will +necessarily continue to look like the type no matter how the value is mutated.
  • +
+

+If a value cannot be mutated, looking like a type and belonging to a type are +the same thing. +

+

+When a Ballerina program declares a variable to have a compile-time type, this +means that the Ballerina compiler together with the runtime system will ensure +that the variable will only ever hold a value that belongs to the type. +Ballerina also provides mechanisms that take a value that looks like a type and +use it to create a value that belongs to a type. +

+

+Every value has a read-only bit. If the read-only bit is on, it means that the +value is immutable. A value's read-only bit is fixed when the value is +constructed, and cannot be changed thereafter. Ballerina maintains the invariant +that immutability is deep: any value reachable from a value with its read-only +bit set is guaranteed to have its read-only bit set. Here reachable +means reachable through read operations: every member of a structure value is +reachable from the structure value; every constituent of a sequence value is +reachable from the sequence value; every member of an object value is reachable +from the object value. Reachability is transitive: if t is reachable +from s, and s is reachable from r, then +t is reachable from r. Reachability is also considered +reflexive: a value is reachable from itself. +

+

+Some basic types are inherently immutable: the read-only bit is always on for a +value that belongs to an inherently immutable basic type. All simple types are +inherently immutable as are functions. Some basic types are selectively +immutable: a type is selectively immutable if it is possible to construct both +values of the type that have the read-only bit on and values that do not have +the read-only bit on. All structured types are selectively immutable as are +objects. Finally, some basic types are inherently mutable: the read-only bit is +never on for a value belonging to an inherently mutable basic type. +

+

+Each selectively immutable basic type can be partitioned into two +uniform types, one containing values with the read-only bit on, and one +containing values where the read-only bit is off. For every other basic type, +there is a single uniform type. Every uniform type is thus either completely +readonly or completely mutable; every value thus belongs to exactly one uniform +type, and mutation cannot change the uniform type to which a value belongs. +

+

+It is also possible to limit the mutability of variables, by making them final. +This means that the value that a variable holds cannot be changed after the +variable has been initialized. Unlike immutability of variables, this is not +deep. A final variable can hold a mutable value. +

+
+ +
+

5.1.3 Isolation

+

+There are three possible operations on storage: read, write and execute. The +concept of immutability relates to reading and writing storage, and provides +limited information about execution: execution cannot lead to mutation of an +immutable value. For functions and objects, it is useful to have more +information about how execution may lead to mutation. Ballerina has a concept of +isolation that provides this. +

+

+In addition to defining when a value is reachable from a value, we can define +when a value is reachable from a variable: a value is reachable from a variable +if the value is reachable from the value that the variable holds. We +can also define when mutable state is reachable from a value or variable: the +mutable state of a value v is reachable from a value or variable, if v is +reachable from the value or variable; the mutable state of a variable v is +reachable only from the variable v. +

+

+Objects have an isolated bit in addition to a read-only bit; an object value is +isolated if its isolated bit is set. Mutable state is defined to be freely +reachable from a value or variable if it is reachable without following a +reference to an isolated object. A variable or value is an isolated +root if its mutable state is isolated from the rest of the program's +mutable state: any mutable state that is freely reachable from the isolated root +is reachable from outside only through the isolated root. More precisely, if +some mutable state s is freely reachable from an isolated root value +r, then s is not freely reachable from a variable or value +that is not reachable from r except by following a reference through +r; similarly, if some mutable state s is freely reachable +from an isolated root variable r, then s is not freely +reachable from a value that is not reachable from r and is not freely +reachable from any variable other than r. A variable can also be +declared to be isolated. Ballerina maintains the invariant that isolated objects +and isolated variables are isolated roots. Ballerina also guarantees that any +mutable state freely reachable from an isolated object or isolated variable is +accessed only within the scope of a lock +statement, which ensures that there is no data race in accessing that +mutable state. This implies that there will be no data race accessing any +mutable state that is reachable (not just freely reachable) from an isolated +object or isolated variable. +

+

+Functions and methods have an isolated bit in addition to a read-only bit; a +function or method is isolated if its isolated bit is set. Ballerina guarantees +that a call an isolated method or function will only result in access to mutable +state if at least one of the following conditions applies: +

+
    +
  • the mutable state is freely reachable from an argument passed to the +function or method and the access happens on the strand on which the function is +called; the object on which a method is invoked is considered as an argument for +this purpose;
  • +
  • the mutable state is freely reachable from an isolated variable or an +isolated object;
  • +
  • the mutable state is part of a new value created by the call.
  • +
+

+The caller of a function can thus ensure that a function call will not lead to a +data race by ensuring that no data race is possible for the mutable state freely +reachable from the arguments that it passes to the function, for example by +passing only immutable values or isolated objects. +

+ +
+
+

5.1.4 Type descriptors

+

+Ballerina provides a rich variety of type descriptors, which programs use to +describe types. For example, there is a type descriptor for each simple basic +type; there is a type descriptor that describes a type as a union of two types; +there is a type descriptor that uses a single value to describe a type that +contains a single shape. This means that values can look like and belong to +arbitrarily many types, even though they look like or belong to exactly one +basic type. +

+

+The following table summarizes the type descriptors provided by Ballerina. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KindNameSet of values denoted by type descriptor
basic, simplenil()
booleantrue, false
int64-bit signed integers
float64-bit IEEE 754-2008 binary floating point numbers
decimaldecimal floating point numbers
basic, sequencestringa sequence of Unicode scalar values
XMLa sequence of zero or more elements, processing instructions, comments or +text items
basic, structuredarrayan ordered list of values, optionally with a specific length, where a +single type is specified for all members of the list
tuplean ordered list of values, where a type is specified separately for each +member of the list
mapa mapping from keys, which are strings, to values; specifies mappings in +terms of a single type to which all keys are mapped
recorda mapping from keys, which are strings, to values; specifies maps in +terms of names of fields (required keys) and value for each field
tablea ordered collection of mappings, where a mapping is uniquely identified +within the table by a key derived from the mapping
basic, behavioralerroran indication that there has been an error, with a string identifying the +reason for the error, and a mapping giving additional details about the error
functiona function with 0 or more specified parameter types and a single return +type
futurea value to be returned by a function execution
objecta combination of named fields and named methods
typedesca type descriptor
handlereference to externally managed storage
streama sequence of values that can be generated lazily
othersingletona single value described by a literal
readonlyany value whose read-only bit is on
anyany value other than an error
neverno value
optionala value that is either () or belongs to a type
uniona value that belongs to at least one of a number of types
intersectiona value that belongs to all of a number of types
distinct
anydataplain data (a simple value, sequence value or structured value that + does not contain behavioral members at any depth)
jsonthe union of (), int, float, decimal, string, and maps and arrays whose +values are, recursively, json
byteint in the range 0 to 255 inclusive
+

+A shape is divided into two aspects: the primary aspect and +the read-only aspect. A value's read-only bit is a part of the +read-only aspect of the value's shape. The read-only bit of values +contained in a structured value is part of the read-only aspect of those values +and of the read-only aspect of the structured value. Everything about a shape +except the read-only bits constitutes the primary aspect of the shape. If two +plain data values compare equal, then the primary aspect of their shapes is the +same, but there may be differences in the read-only aspect. +

+

+Type descriptors other than readonly describes types using only the +primary aspect of shape: whether a value belongs to the type is not affected by +the read-only aspect of the value's shape. The readonly type uses +only the read-only aspect: whether a value belongs to the readonly +type depends only on the read-only aspect of the value's shape. +

+

+In addition to describing a type, a type descriptor may also include information +used to construct a value of the type, as well as metadata. Whereas the type +described by a type descriptor is known at compile time, this additional +information may need to be resolved at runtime. The typedesc basic type +represents a type descriptor that has been resolved. +

+ +
type-descriptor :=
+   simple-type-descriptor
+   | sequence-type-descriptor
+   | structured-type-descriptor
+   | behavioral-type-descriptor
+   | other-type-descriptor
+
+

+For simplicity, the type-descriptor grammar is ambiguous. The following table +shows the various types of type descriptor in decreasing order of precedence, +together with associativity. +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
OperatorAssociativity
distinct T
+T[]
T? +
T1 & T2left
T1 | T2left
function(args) returns Tright
+ + +
+
+

5.1.5 Type-ids

+

+Ballerina has a feature, called distinct types, which provides +functionality similar to that provided by nominal types, but which works within +Ballerina's structural type system. Distinct types are similar to the branded +types found in some other structurally typed languages, such as Modula-3. +

+

+The semantics of distinct types are based on type-ids. These are similar to the +brands used by branded types. A distinct type is created by the use of the +distinct keyword in either a distinct-type-descriptor or the +class-type-quals of a module-class-defn. Each such +occurrence of the distinct keyword has a distinct type-id, which +uniquely identifies it within a Ballerina program. A type-id has three parts: +

+
    +
  1. a module id, which identifies the module within which the +distinct-type-descriptor occurs; this consists of an organization, a module +name, and an array of platform-specified strings, which could include +information about, for example, the repository or version of the package the +module comes from;
  2. +
  3. a local id, which identifies the occurrence of the +distinct within the module; this takes one of two forms: +
      +
    • named - +
        +
      • if the distinct keyword is part of a distinct-type-descriptor +that is the only distinct-type-descriptor occurring within a module-type-defn, +then the local id is the name of the type defined by the module-type-defn;
      • +
      • if the distinct keyword is part of the class-type-quals +of a module-class-defn, then the local id is the name of the class defined +by the module-class-defn;
      • +
      +
    • +
    • anonymous - otherwise, the local id is a compiler-generated integer;
    • +
    +
  4. +
  5. a boolean flag saying whether the type-id is public; this flag is on if and +only if the local id part is named and is the name of a module-type-defn that is +public.
  6. +
+

+Distinct types can be used with only the object or error basic types. An object +value or error value has a set of type-ids. These type-ids are fixed at the +time of construction and are immutable thereafter. A value's set of type-ids may +be empty. The type-ids of a value are part of the value's shape and so can +affect when an object belongs to a type. The set of type-ids of an object or +error value are divided into primary type-ids and secondary type-ids: the +secondary type-ids could be inferred from the primary type-ids using the +program's source. +

+

+An object or error value is always constructed using a specific type descriptor. +A type descriptor for objects and errors thus performs a dual role: it denotes a +type and it defines a mechanism to construct a value of the type. A type +descriptor is definite if it induces a specific set of type-ids. The +set of type-ids of an object or error value are those induced by the +type-descriptor used to construct it; such a type descriptor must therefore be +definite. A type descriptor that denotes a type that does not allow object or +error values induces an empty set of type-ids and so is vacuously definite. For +other type descriptors, the section that specifies that type descriptor will say +when it is definite, the set of type-ids that it induces when it is, and which +of those are primary. +

+ +
+
+

5.1.6 Iterability

+

+Values of some basic types are iterable. An iterable value supports an +iteration operation, which treats the iterable value as consisting of a sequence +of zero or more simpler values, which are in some sense a part of the iterable +value; the iteration operation provides the values in the sequence, one after +another. The sequence of values that an iteration operation on a value provides +is the iteration sequence of the value. Each iterable basic type +defines the iteration sequence for a value of that basic type. There is also a +value associated with the completion of the iteration operation, which is nil if +the iteration completed successfully and an error otherwise. The iteration +operation thus determines two associated types for an iterable type: the value +type, which is the type of the values in the iteration sequence, and the +completion type, which is the type of the iteration completion value. +

+

+The following tables summarizes the iterable basic types. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic typeIteration sequenceType descriptorValue typeCompletion type
stringlength 1 substringsstringstring:Char()
xmlsingleton xml valuesxml<T>T()
listmembers in orderT[]T()
mappingmembersmap<T>T()
tablemembers in ordertable<T>T()
streamitemsstream<T,C>TC
+
+
+ +
+

5.2 Simple values

+

+The basic type of a simple value is either one of the following +

+
    +
  • nil
  • +
  • boolean
  • +
  • int
  • +
  • float
  • +
  • decimal
  • +
+

+or is a tagged data type. +

+

+All simple basic types are inherently immutable. +

+ +
simple-type-descriptor :=
+   nil-type-descriptor
+   | boolean-type-descriptor
+   | int-type-descriptor
+   | floating-point-type-descriptor
+   | tagged-data-type-descriptor
+
+

+The type descriptor for each simple basic type contains all the values of the +basic type. +

+
+

5.2.1 Nil

+ +
nil-type-descriptor := nil-literal
+nil-literal :=  ( ) | null
+
+

+The nil type contains a single value, called nil, which is used to represent the +absence of any other value. The nil value is written (). The nil +value can also be written null, for compatibility with JSON; the +use of null should be restricted to JSON-related contexts. +

+

+The nil type is special, in that it is the only basic type that consists of a +single value. +

+
+
+

5.2.2 Boolean

+ +
boolean-type-descriptor := boolean
+boolean-literal := true | false
+
+

+The boolean type consists of the values true and false. +

+
+
+

5.2.3 Int

+ +
int-type-descriptor := int
+int-literal := DecimalNumber | HexIntLiteral
+DecimalNumber := 0 | NonZeroDigit Digit*
+HexIntLiteral := HexIndicator HexNumber
+HexNumber := HexDigit+
+HexIndicator := 0x | 0X
+HexDigit := Digit | a .. f | A .. F
+NonZeroDigit := 1 .. 9
+
+

+The int type consists of integers between -9,223,372,036,854,775,808 and +9,223,372,036,854,775,807 (i.e. signed integers than can fit into 64 bits using +a two's complement representation). +

+

+The byte type is a subtype of +int. The lang.int lang library module also +provides built-in subtypes for signed and +unsigned integers representable in 8, 16 and 32 bits. +

+ +
+
+

5.2.4 Floating point types

+ +
floating-point-type-descriptor := float | decimal
+floating-point-literal :=
+   DecimalFloatingPointNumber | HexFloatingPointLiteral
+DecimalFloatingPointNumber :=
+   DecimalNumber Exponent [FloatingPointTypeSuffix]
+   | DottedDecimalNumber [Exponent] [FloatingPointTypeSuffix]
+   | DecimalNumber FloatingPointTypeSuffix
+DottedDecimalNumber :=
+   DecimalNumber . Digit+
+   | . Digit+
+Exponent := ExponentIndicator [Sign] Digit+
+ExponentIndicator := e | E
+HexFloatingPointLiteral := HexIndicator HexFloatingPointNumber
+HexFloatingPointNumber :=
+   HexNumber HexExponent
+   | DottedHexNumber [HexExponent]
+DottedHexNumber :=
+   HexDigit+ . HexDigit+
+   | . HexDigit+
+HexExponent := HexExponentIndicator [Sign] Digit+
+HexExponentIndicator := p | P
+Sign := + | -
+FloatingPointTypeSuffix := DecimalTypeSuffix | FloatTypeSuffix
+DecimalTypeSuffix := d | D
+FloatTypeSuffix :=  f | F
+
+ +
+
5.2.4.1 Float
+ +

+The float type corresponds to IEEE 754-2008 64-bit binary (radix 2) floating +point numbers. A float value can be represented by either a +DecimalFloatingPointNumber with an optional FloatTypeSuffix, or by a +HexFloatingPointLiteral. +

+

+The multiple bit patterns that IEEE 754 treats as NaN are considered to be the +same value in Ballerina. Positive and negative zero of a floating point basic +type are distinct values, following IEEE 754, but are defined to have the same +shape, so that they will usually be treated as being equal. +

+

+IEEE-defined operations on float values must be performed using a +rounding-direction attribute of roundTiesToEven (which is the default IEEE +rounding direction, sometimes called round to nearest). All float +values, including the intermediate results of expressions, must use the value +space defined for the float type; implementations must not use extended +precision for intermediate results. This ensures that all implementations will +produce identical results. (This is the same as what is required by strictfp in +Java.) +

+
+
+
5.2.4.2 Decimal
+ +

+The decimal type corresponds to a subset of IEEE 754-2008 128-bit decimal (radix +10) floating point numbers. Any decimal value can be represented by a +DecimalFloatingPointNumber with an optional DecimalTypeSuffix. +

+

+A decimal value is a triple (s, c, e) where +

+
    +
  • +s is sign, either 0 or -1
  • +
  • +c is the coefficient, an unsigned integer that can be exactly +represented in 34 decimal digits
  • +
  • +e is the exponent, a signed integer
  • +
+

+representing the mathematical value -1s × +c × 10e. The range for the exponent +e is implementation dependent, but must be at least the range +supported by the IEEE 754-2008 decimal128 format (which is -6176 to 6111 +inclusive). +

+

+The decimal type corresponds to the ANSI X3.274 subset of IEEE 754-2008, which +has the following simplifications: +

+
    +
  • +0 and -0 are not distinguished; if the coefficent is zero, then the sign is +also constrained to be zero;
  • +
  • NaN, infinities and subnormals are not supported; operations that would +result in one of these values according to the normal rules of IEEE 754-2008 +instead result in a panic.
  • +
+

+Operations on the decimal type use the roundTiesToEven rounding mode, like the +float type. +

+

+The shape of a decimal value is its mathematical value. Thus two decimal values +have the same shape if they represent the same mathematical value, even if they +do so using different exponents. +

+
+
+
+

5.2.5 Tagged data values

+ +

+Tagged data types are used for well-known data types that are not +application-specific, but are widely supported across multiple protocols and +programming languages. Each of these data types has its own conventional string +syntax. The use of tagged data types allows programs to work with these data +types using their normal string syntax, while distinguishing the values as +belonging to a specific tagged data type. +

+

+Data tags are defined either by this specification or the Ballerina platform. +For each such data tag, there is a corresponding basic type. The definition of a +data tag specifies the set of values belonging to the corresponding basic type. +A tagged data value is a value belonging to one of these basic types. Every +tagged data value is plain data, immutable and has no storage identity. The +shape of a tagged data value is the value. +

+

+The definition of a data tag with corresponding basic type B specifies: +

+
    +
  • the name of the data tag; this is an unqualified identifier that is used +with the tagged-data-template-expr to construct a value of type B;
  • +
  • the set of values that B consists of;
  • +
  • an abstract parsing function, used at compile-time; a sequence of characters +into which n values can be interpolated is represented by an array of +n + 1 strings; the abstract parsing function accordingly takes an +array of n + 1 strings, with n ⁥ 0, and returns +either an error or a function of n arguments that interpolates its +arguments into the result of the parse; the type of both the arguments and the +return value of the returned function is B;
  • +
  • an abstract function mapping from values of type B to strings;
  • +
  • a library module; method call expressions on values of type B will call +functions in this module.
  • +
+

+Note that errors cannot happen during interpolation. The abstract parsing +function must therefore allow interpolations only in places where any valid +value of type B can be interpolated. +

+

+Most of the functionality of a tagged data type is provided by its library +module. +

+ +
tagged-data-type-descriptor := qualified-identifier
+
+

+The qualified-identifier in a tagged-data-type-descriptor refers to a type that +is defined in a module that is part of the language library or standard library. +

+

+In this version of the Ballerina language, only the data tag re +is defined, with associated lang library module lang.regexp. +

+ +
+ +
+
+

5.3 Sequence values

+ +
sequence-type-descriptor :=
+   string-type-descriptor
+   | xml-type-descriptor
+
+

+A sequence value belongs to one of the following two basic types: +

+
    +
  • string
  • +
  • xml
  • +
+

+A sequence value consists of an ordered sequence of zero or more constituent +items, where the constituent items belong to the same basic type as the sequence +value itself. The length of a sequence value is the number of its +constituent items. Each constituent of a sequence value has an integer index +≥ 0 and < length. A sequence value is a singleton if its +length is 1. For each sequence basic type, there is an empty value, +which has length 0. As with other basic types, the sequence basic types are +disjoint with themselves and with other basic types. Thus the empty value for +string is distinct from the empty value for xml, and these are both distinct +from nil. +

+

+The values belonging to a sequence basic type B can be defined in terms of its +singleton values and a concatenation operation, by the following rules: +

+
    +
  • +the singleton values of B belong to B; +
  • +
  • +the empty value of B belongs to B; +
  • +
  • +if v1 and v2 belong to B, then the concatenation of +v1 and v2 belongs to B. +
  • +
+

+The concatenation of any value v belonging to B with the empty sequence of B in +either order is v. +

+

+Note that for a sequence consisting of a single item v is the same thing as v. A +single item is a sequence. The type of the constituent items of a +sequence of basic type B is thus a subtype of B. This is a fundamental +difference between sequences and lists. +

+

+Only singleton values of a sequence type can have storage identity. When a +constituent of a sequence value has storage identity, what is stored in the +sequence value is a reference to the location where the constituent value is +stored rather than the constituent value itself. +

+

+A sequence value is iterable: the iteration sequence consists of the singleton +items of the sequence value in order and the iteration completion value is +always nil. +

+ +
+

5.3.1 Strings

+ +
string-type-descriptor := string
+string-literal := DoubleQuotedStringLiteral
+DoubleQuotedStringLiteral := " (StringChar | StringEscape)* "
+StringChar := ^ ( 0xA | 0xD | \ | " )
+StringEscape := StringSingleEscape | NumericEscape
+StringSingleEscape := \t | \n | \r | \\ | \"
+
+

+A string is an sequence of zero or more Unicode characters. More precisely, it +is a sequence whose singleton values represent Unicode scalar values, where a +Unicode scalar value is any code point in the Unicode range of 0x0 to 0x10FFFF +inclusive, other than surrogate code points, which are 0xD800 to 0xDFFF +inclusive. Note that a string may include Unicode noncharacters, such as 0xFFFE +and 0xFFFF. +

+

+String values do not have storage identity and so the string basic type is +inherently immutable. +

+

+There is a built-in subtype +string:Char for single character strings. +

+
+
+

5.3.2 XML

+ +

+An xml value is a sequence representing parsed XML, such as occurs in the +content of an XML element. The singleton values are of the following types: +

+
    +
  • element
  • +
  • processing instruction
  • +
  • comment
  • +
  • text
  • +
+

+The element, processing instruction and comment singletons correspond directly +to information items in the XML Information Set. A text singleton corresponds to +one or more character information items. When an xml value is constructed, +consecutive text singletons are merged, so that an xml value never contains +consecutive text singletons. There are built-in +subtypes xml:Element, xml:ProcessingInstruction, +xml:Comment and xml:Text corresponding to the above +singletons; xml:Text also allows the empty xml value. +

+
xml-type-descriptor := xml [type-parameter]
+type-parameter := < type-descriptor >
+
+

+A shape belongs to type xml if its basic type is xml. +A type parameter of an xml-type-descriptor must be a subtype of +xml. A shape belongs to type xml<T> if all of +its constituent items belong to T. So, for example, +xml<xml:Element> is the type for xml values containing +only elements. Note that xml<xml<T>> is the +same as xml<T> and that +xml<xml:Text> is the same as xml:Text. +

+

+The name of an element is represented by a string. The attributes of an element +are represented by a value of type map<string>. The children +of an element is represented by a value of type xml. +

+

+Singleton element, processing instruction and comment values have storage +identity. Other xml values do not. +

+

+The xml:Text type is inherently immutable. This implies that both +text singletons and empty xml values always have their read-only bits on. The +xml:Element, xml:ProcessingInstruction and +xml:Comment types are selectively immutable. The read-only bit of a +xml value with length greater than one is on if and only if the read-only bit of +all its constituent items is on. The attributes and children of an element are +reachable from the element. Thus, if the read-only bit of an +xml:Element is on, then the read-only bits of the mapping +representing its attributes and of the xml value representing its children are +also on. +

+

+Note that although the mutable constituents of mutable xml value can be mutated, +the number and the storage identity of the constituents of a xml value are fixed +when the value is constructed. The storage identity of the attributes map of an +element are also fixed when the element is constructed. +

+
+
5.3.2.1 XML namespaces
+

+The name of an element or attribute, which in the XML Information Set is +represented by a combination of the [namespace name] and [local name] properties +of an element information item (EII) or attribute information item (AII), is +represented by a single expanded name string. If the [namespace name] +property has no value, then the expanded name consists of just the value of the +[local name] property; otherwise, the expanded name is of the form: +

+
+   {namespace-uri}local-name
+
+

+where namespace-uri and +local-name are the values of the [namespace name] and +[local name] properties respectively. +

+

+The attributes map for an element includes not only an entry for each AII in the +[attributes] property of the EII, but also an entry for each attribute in the +[namespace attributes] property. The key of the entry is the string representing +the name of the attribute, constructed from the AII item as described in the +previous paragraph. The name of every namespace attribute will thus start with +the string {http://www.w3.org/2000/xmlns/}. +

+

+The attributes map can also contain entries representing namespace attributes +synthesized from the [in-scope namespaces] property. There will be a synthesized +namespace attribute for every prefix other than xml that occurs as +a prefix of the EII or of an AII in the element's [attributes] property and for +which there is no declaration in the [namespace attributes] property. No +namespace attribute will be synthesized for the default namespace. (The +synthesized namespace attributes ensure that namespace prefixes will not be lost +if the element is extracted into a new context.) +

+

+An xml value can be converted to an XML information set for serialization. This +is done in the context of a set of namespace declarations that are in-scope from +the xml value's parent element, if any. The process of converting an xml element +singleton into an EII has the following stages. +

+
    +
  1. The [namespace name] and [local name] properties of the EII are determined +from the element's expanded name.
  2. +
  3. An AII is constructed for each entry in the element's attribute map, with +the [namespace name] and [local name] properties of the AII determined from the +entry's key, which is the attribute's expanded name. Each AII is added to either +the [attributes] or [namespace attributes] property of the EII depending on the +AII's [namespace name] property. The [prefix] property of each AII in the +[namespace attributes] property can also be set at this point.
  4. +
  5. The [namespace attributes] property of the EII is pruned by removing an +AII with [normalized value] N if the AII is not a default namespace declaration, +and the in-scope namespace declarations include a declaration with namespace +name N, and either the EII or one of the AIIs has a [namespace name] property +equal to N. (In this case, the entry for the namespace attribute would get +synthesized when the information set is converted to an xml value.)
  6. +
  7. For each AII in the EII's [attributes] property that has a [namespace name] +property, a [prefix] property is assigned. If the namespace name is +http://www.w3.org/XML/1998/namespace, then use a prefix of +xml. If there is already a namespace declaration in the [namespace +attributes] that declares a prefix with that namespace name, then that prefix is +used. Otherwise if there is a namespace declaration in the in-scope namespaces +that declares a prefix with that namespace and it is not redeclared or +undeclared by the [namespace attributes], then that prefix is used. Otherwise +generate a prefix and add an AII to the [namespace attributes] to declare +it.
  8. +
  9. If the EII has no [namespace name] property, but a default namespace +declaration is in scope, then an xmlns="" AII is added to the +[namespace attributes] property to undeclare the default namespace.
  10. +
  11. If the EII has a [namespace name] property N, then we need +to ensure that there is an applicable namespace declaration: +
      +
    1. if one of the [namespace attributes] declares N as the default namespace, +then nothing needs to be done;
    2. +
    3. similarly, if an in-scope namespace declaration declares N as the default +namespace, and the [namespace attributes] do not undeclare it, then nothing +needs to be done;
    4. +
    5. otherwise, try to find, in the same way as for an AII, a prefix P which is +already declared as N; if there is one, set the [prefix] property of the EII to +P;
    6. +
    7. otherwise, if the [namespace attributes] property does not contain a default +namespace declaration or undeclaration, generate a default namespace declaration +for N and add it to the [namespace attributes] property;
    8. +
    9. otherwise, generate a new prefix P, set the [prefix] property of the EII to +P, and add an AII to the [namespace attributes] to declare it.
    10. +
    +
  12. +
  13. Generate the [in-scope namespaces] property for this EII, using the parent's +in-scope namespaces and the [namespace attributes].
  14. +
  15. Convert the children of the xml element, including the element children, to +a list of information items, in the context of this EII's in-scope +namespaces.
  16. +
+ +
+ +
+ +
+
+

5.4 Structured values

+

+Structured values are containers for other values, which are called their +members. There are three basic types of structured value: list, mapping and +table. +

+

+Structured values are usually mutable. Mutating a structured value changes which +values it contains. Structured values can also be constructed as immutable. +Immutability is deep: immutable structured values cannot contain mutable +structured values; if the read-only bit of a structured value is on, then the +read-only bit of each of its members is on. +

+

+The shape of the members of a structured value contributes to the shape of the +structured value. A structured type descriptor describe the shape of the +structured value in terms of the shapes of its members. Mutating a member of a +structured value can cause the shape of the structured value to change. A +structured value has an inherent type, which is a type descriptor which is part +of the structured value's runtime value. At runtime, the structured value +prevents any mutation that might lead to the structured value having a shape +that is not a member of its inherent type. Thus a structured value belongs to a +type if and only if its inherent type is a subtype of that type. +

+

+The inherent type of an immutable structured value is a singleton type with the +structured value's shape as its single member. Thus, an immutable structured +value belongs to a type if and only if the type contains the shape of the value. +

+

+Every structured value has a length, which is the number of its members. +All structured values are iterable: the iteration sequence consists of the +members of the structure and the completion type is always nil. +

+

+A structured value provides random access to its members using a key that +uniquely identifies each member within the structure. A key can be out-of-line, +meaning it is independent of the member, or in-line, meaning it is part of the +member. The member type for a key type K in a structured type T +consists of all shapes v such that there is a shape in T with key in K and shape +v. A type K is an optional key type for T if there is a shape v in T +and a key k in K such that v does not have a member k; a type that is not an +optional key type is a required key type. +

+ +
structured-type-descriptor :=
+   list-type-descriptor
+   | mapping-type-descriptor
+   | table-type-descriptor
+
+

+The following table summarizes the type descriptors for structured types. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Structured typelistmappingtable
Key sourceout-of-lineout-of-linein-line
Key typeintegerstringanydata
Type descriptor with uniform member typearraymaptable
Type descriptor with separate member typestuplerecord-
+ +
+

5.4.1 Lists

+

+A list value is a container that keeps its members in an ordered list. The +number of members of the list is called the length of the list. The key +for a member of a list is the integer index representing its position in the +list, with the index of the first member being 0. For a list of length +n, the indices of the members of the list, from first to last, are +0,1,...,n - 1. The shape of a list value is an ordered list of the +shapes of its members. +

+

+A list is iterable: the iteration sequence consists of the members of the +list in order and the iteration completion value is always nil. +

+

+The type of list values can be described by two kinds of type descriptors. +

+ +
list-type-descriptor :=
+   array-type-descriptor | tuple-type-descriptor
+
+

+The inherent type of a list value must be a list-type-descriptor. +The inherent type of a list value determines a type Ti for a +member with index i. The runtime system will enforce a constraint that +a value written to index i will belong to type Ti. +Note that the constraint is not merely that the value looks like +Ti. +

+

+Both kinds of type descriptor are covariant in the types of their members. +

+
+
5.4.1.1 Array types
+

+An array type-descriptor describes a type of list value by specifying the type +that the value for all members must belong to, and optionally, a length. +

+ +
array-type-descriptor := array-member-type-descriptor inferable-array-dimension array-dimension*
+inferable-array-dimension := [ [ inferable-array-length ] ]
+array-dimension := [ [ array-length ] ]
+array-member-type-descriptor := type-descriptor but not array-type-descriptor
+inferable-array-length := array-length | inferred-array-length
+array-length := int-literal | constant-reference-expr
+inferred-array-length := *
+
+

+A type T[] contains a list shape if all members of the list shape +are in T. A type T[n] contains a list shape if in +addition the length of the list shape is n. +

+

+When an array-type-descriptor includes multiple +array dimensions, th array dimensions are interpreted +so that the order of the dimensions in the array-type-descriptor is +consistent with the order of the dimensions in a +member-access-expr. Specifically, a type +T[n1]...[nk - 1][nk] is +interpreted as (T[nk])[n1]...[nk - +1]. Thus, for a value v of type T[M][N], +a member-access-expr v[i][j] will evaluate to an value of type +T if and only if 0 ≤ iM +and 0 ≤ jN. An +array-type-descriptor is parsed to include all following +array-dimensions: an array-type-descriptor is not +recognized as array-member-type-descriptor. +

+

+A constant-reference-expr in an array-length must +evaluate to a non-negative integer. An array length of * means that +the length of the array is to be inferred from an initializer; this is allowed +when the array-type-descriptor specifies the type of variable for which an +initializer is specified, i.e. in a local-init-var-decl-stmt, a +module-init-var-decl or a module-const-decl; its +meaning is the same as if the length was specified explicitly. +

+

+Note also that T[n] is a subtype of T[], and that if +S is a subtype of T, then S[] is a +subtype of T[]; this is a consequence of the definition of +subtyping in terms of subset inclusion of the corresponding sets of shapes. +

+

+The type of the values in the iteration sequence of a value belonging +T[] is T. +

+
+
+
5.4.1.2 Tuple types
+

+A tuple type descriptor describes a type of list value by specifying a separate +type for each member of the list. +

+ +
tuple-type-descriptor :=
+   [ tuple-member-type-descriptors ]
+tuple-member-type-descriptors :=
+   member-type-descriptor (, member-type-descriptor)* [, tuple-rest-descriptor]
+   | [ tuple-rest-descriptor ]
+member-type-descriptor := [annots] type-descriptor
+tuple-rest-descriptor := type-descriptor ...
+
+
+

+A tuple type descriptor T with m member type descriptors contains a list shape L +of length n if and only if: +

+
    +
  • m is less than or equal to n
  • +
  • the i-th member type descriptor of T contains the i-th member of L for each +i from 1 to m;
  • +
  • if n is greater than m, then T has a tuple-rest-descriptor +R..., and R contains the j-th member of L for each j from m + 1 to +n.
  • +
+

+Note that a tuple type where all the member-type-descriptors are +the same and there is no tuple-rest-descriptor is equivalent to an +array-type-descriptor with a length. +

+
+
+
+

5.4.2 Mappings

+

+A mapping value is a container where each member has a key, which is a string, +that uniquely identifies within the mapping. We use the term field to +mean the member together its key; the name of the field is the key, and the +value of the field is that value of the member; no two fields in a mapping value +can have the same name. +

+

+The shape of a mapping value is an unordered collection of field shapes one for +each field. The field shape for a field f has a name, which is the same as the +name of f, and a shape, which is the shape of the value of f. +

+

+Each field also has a read-only bit. This is in addition to the read-only bit of +the mapping value. If a mapping value's field has its read-only bit on, then +that field cannot be assigned to nor removed. If the mapping value's read-only +bit is on, then the read-only bit of every field is also on. A field's read-only +bit is fixed when the mapping value is constructed, and cannot be changed +thereafter. If a field's read-only bit is on, the read-only bit of the value of +the field is also on. The read-only bit of a field is part of the read-only +aspect of the mapping value's shape. +

+

+The type of mapping values can be described by two kinds of type descriptors. +

+ +
mapping-type-descriptor :=
+   map-type-descriptor | record-type-descriptor
+
+

+The inherent type of a mapping value must be a +mapping-type-descriptor. The inherent type of a mapping value +determines a type Tf for the value of the field with name +f. The runtime system will enforce a constraint that a value written to +field f will belong to type Tf. Note that the +constraint is not merely that the value looks like Tf. +

+

+Both kinds of type descriptor are covariant in the types of their members. +

+

+A mapping value is iterable: the iteration sequence consists of the members of +the mapping value and the iteration completion value is always nil. When the +inherent type of a mapping value is equivalent to a +map-type-descriptor, the order of iteration must correspond to the +order in which fields were added. In other cases, the order of the iteration +sequence is implementation-dependent. +

+ +
+
5.4.2.1 Map types
+

+A map type-descriptor describes a type of mapping value by specifying the type +that the value for all fields must belong to. +

+ +
map-type-descriptor := map type-parameter
+
+

+A type map<T> contains a mapping shape m if every field +shape in m has a value shape that is in T. +

+

+The type of the values in the iteration sequence of a value belonging +map<T> is T. +

+

+If a type descriptor T has lax static typing, +then the type map<T> also has lax static typing. +

+
+
+
5.4.2.2 Record types
+

+A record type descriptor describes a type of mapping value by specifying a type +separately for the value of each field. +

+ +
record-type-descriptor :=
+   inclusive-record-type-descriptor | exclusive-record-type-descriptor
+inclusive-record-type-descriptor :=
+   record { field-descriptor* }
+exclusive-record-type-descriptor :=
+   record {| field-descriptor* [record-rest-descriptor] |}
+field-descriptor :=
+   individual-field-descriptor | record-type-inclusion
+individual-field-descriptor :=
+   metadata [readonly] type-descriptor field-name [? | (= default-expression)] ;
+field-name := identifier
+default-expression := expression
+record-type-inclusion := * type-reference ;
+record-rest-descriptor := type-descriptor ... ;
+
+

+Each individual-field-descriptor specifies an additional constraint +that a mapping value shape must satisfy for it to be a member of the described +type. The constraint depends on whether ? is present: +

+
    +
  • if ? is not present, then the constraint is that the mapping +value shape must have a field shape with the specified field-name and with a +value shape that is a member of the specified type-descriptor; this is called a +required field;
  • +
  • if ? is present, then the constraint is that if the mapping +value shape has a field shape with the specified field-name, then its value +shape must be a member of the specified type-descriptor; this is called an +optional field.
  • +
+

+If an individual-field-descriptor specifies readonly, +then there is also a constraint that the field has its read-only bit set. +Furthermore, the type of the field is the intersection of readonly +and the type specified by the type-descriptor. +

+

+The order of the individual-field-descriptors within a +record-type-descriptor is not significant. Note that the delimited +identifier syntax allows the field name to be any non-empty string. +

+

+An exclusive-record-type-descriptor, which uses the {| and +|} delimiters, allows exclusively the fields described. More +precisely, for a mapping value shape and a record-type-descriptor, let the extra +field shapes be the field shapes of the mapping value shapes whose names are not +the same as field-name of any individual-field-descriptor; a mapping value shape +is a member of the type described by an exclusive-record-type-descriptor only if +either: +

+
    +
  • there are no extra fields shapes, or
  • +
  • there is a record-rest-descriptor T..., and the value shape of +every extra field shape is a member of T.
  • +
+

+An inclusive-record-type-descriptor, which uses the { and +} delimiters, allows any mapping value that includes the fields +described, provided that the values of all other fields are plain data. A type +descriptor record { F }; is thus equivalent to record {| F; +anydata...; |}, where anydata is defined below as the type descriptor for plain data. +

+

+A record type descriptor that either is an inclusive-record-type-descriptor or +is an exclusive-record-type-descriptor with a record-rest-descriptor is called +open; a record type descriptor that is not open is called +closed. +

+

+If a record type descriptor is closed and every individual-field-descriptor +specifies readonly, then it describes a type that is a subtype of +readonly: a shape belongs to the type only if its read-only bit is +set. +

+

+A default-expression is an expression that specifies a default +value for the field, which is used when the record type descriptor is used to +construct a mapping value but no value is specified explicitly for the field. +The type descriptor contains a 0-argument function closure for each default +value. The closure is created from the expression when the type descriptor is +resolved. The expression must meet the requirements for an isolated function. The closure is evaluated to +create a field value each time the default is used in the construction of a +mapping value. The default value does not affect the type described by the type +descriptor. It is a compile-time error if a default-expression +contains a checking-expr with a checking-keyword of check, +i.e. if evaluation of the expression could complete abruptly with a check-fail. +

+

+A record-type-inclusion includes fields from a named record type. +The type-reference must reference a type described by a +record-type-descriptor. The field-descriptors and any +record-rest-descriptor are included the type being defined; the +meaning is the same as if they had been specified explicitly. For default +values, the closure rather than the expression is copied in. +It is an error for an record-type-descriptor to directly or +indirectly include itself. An individual-field-descriptor in a +record-type-descriptor can override an +individual-field-descriptor of the same name in an included +record-type-descriptor, provided the type declared for the field in +the overriding field descriptor is a subtype of the type declared in the +overridden field descriptor. It is an error if a +record-type-descriptor has two or more +record-type-inclusions that include an +individual-field-descriptor with the same name, unless those +individual-field-descriptors are overridden by an +individual-field-descriptor in the including +record-type-descriptor. A record-rest-descriptor in +the including type overrides any record-rest-descriptor in the +included type. It is an error if a record-type-descriptor has two +or more record-type-inclusions that include different +record-rest-descriptors, unless those +record-rest-descriptors are overridden by an +record-rest-descriptor in the including +record-type-descriptor. For the purposes of +resolving a record-type-inclusion, an including or included type +that is an inclusive-record-type-descriptor is treated as if it +were the equivalent exclusive-record-type-descriptor with an +explicit record-rest-descriptor. +

+
+
+
+

5.4.3 Tables

+

+A table is a structural value, whose members are mapping values. A table +provides access to its members using a key that comes from the read-only fields +of the member. It keeps its members in order, but does not provide random access +to a member using its position in this order. +

+

+Every table value has, in addition to its members, a key sequence, which is used +to provide keyed access to its members. The key sequence is an ordered sequence +of field names. The key sequence of a table is fixed when a table is +constructed and cannot be changed thereafter. For each field name in the key +sequence, every member of the table must have a read-only field with that name +and the value of the field must be acyclic plain data. A table's key sequence +determines a key value for each member of the table: if the key sequence +consists of a single field name f, then the key value of a member is that value +of field f of that member. If the key sequence consists of multiple field names +f1,f2,...,fn where n is ≥ 2, then the +key value for a member r is a tuple with members +v1,v2,...,vn where vi is the value +of field fi of r. A table constrains its membership so that a key +value uniquely identifies a member within the table. More precisely, for every +two rows ri and rj in a table with i not equal to j, the +key value for ri must not be equal to the key value for +rj. Key values are compared for equality using the DeepEquals abstract operation. This constraint is +enforced by the table both when the table is constructed and when the table is +mutated. As a special case, a table's key sequence may be empty; this represents +a keyless table, whose members are not uniquely identified by a key. +

+

+The shape of a table value is a triple consisting of +

+
    +
  • an ordered list containing for each table member, the shape of that member
  • +
  • the table's key sequence, and
  • +
  • a set containing for each table member, the shape of the key value of that +member (derived from the table members and the key sequence)
  • +
+ +
table-type-descriptor := table row-type-parameter [key-constraint]
+row-type-parameter := type-parameter
+key-constraint := key-specifier | key-type-constraint
+key-specifier := key ( [ field-name (, field-name)* ] )
+key-type-constraint := key type-parameter
+
+

+The row-type-parameter specifies the shape of the table's members. A table type +table<R> KC contains a table shape if +and only if every table member shape belongs to R and +the table shape satisfies the key constraint KC. The +type specified by a row-type-parameter must be a subtype of +map<any|error> +

+

+In a table-type-descriptor table<R> +key(ks), R and +ks must be consistent in the following sense: for each +field name fi in ks, fi must be a +required, read-only field of R with a type that is a +subtype of anydata. A table shape satisfies a key-constraint +key(ks) if and only if its key sequence is +ks. A table shape satisfies a key-constraint +key<K> if and and only if its set of key value shapes are a +subset of K. The shape of a keyless table satisfies the +key-constraint key<never>. +

+

+As with other structured values, a table value has an inherent type. The +inherent type of a table value must be a table-type-descriptor with a +key-constraint that is a key-specifier. +

+

+A table is iterable: the iteration sequence consists of the members of the +table in order and the iteration completion value is always nil. +

+ +
+
+
+

5.5 Behavioral values

+ +
behavioral-type-descriptor :=
+   error-type-descriptor
+   | function-type-descriptor
+   | object-type-descriptor
+   | future-type-descriptor
+   | typedesc-type-descriptor
+   | handle-type-descriptor
+   | stream-type-descriptor
+
+ +
+

5.5.1 Errors

+ +
error-type-descriptor := error [type-parameter]
+
+

+An error value provides information about an error that has occurred. Error +values belong to a separate basic type; this makes it possible for language +constructs to handle errors differently from other values. +

+

+The error type is inherently immutable. An error value contains the following +information: +

+
    +
  • a message, which is a string containing a human-readable message describing +the error
  • +
  • a cause, which is either nil or another error value that was the cause of +this error
  • +
  • a detail, which is an immutable mapping providing additional information about +the error
  • +
  • a stack trace, which is an immutable snapshot of the state of the execution +stack
  • +
+

+The detail mapping must be a subtype of map<Cloneable>. +

+

+The shapes of the message, cause and detail record are part of the shape of the +error; the stack trace is not part of the shape. A type descriptor +error<T> contains an error shape if +T contains the shape of its detail. The type +error contains a shape if its basic type is error. +

+

+An error-type-descriptor is always definite and induces an empty set of +type-ids. An intersection type can be used to describe an error type that induces +a non-empty set of type-ids. +

+
+ +
+

5.5.2 Functions

+ +
function-type-descriptor :=
+   function-quals function function-signature
+   | [isolated-qual] function
+function-quals :=
+   transactional-qual [isolated-qual]
+   | [isolated-qual] [transactional-qual]
+isolated-qual := isolated
+transactional-qual := transactional
+function-signature := ( param-list ) return-type-descriptor
+
+

+A function is a part of a program that can be explicitly executed. In Ballerina, +a function is also a value, implying that it can be stored in variables, and +passed to or returned from functions. When a function is executed, it is passed +an argument list as input and returns a value as output. +

+ +
param-list :=
+   required-params [, defaultable-params] [, included-record-params] [, rest-param]
+   | defaultable-params [, included-record-params] [, rest-param]
+   | included-record-params [, rest-param]
+   | [rest-param]
+required-params := required-param (, required-param)*
+required-param := [annots] type-descriptor [param-name]
+defaultable-params := defaultable-param (, defaultable-param)*
+defaultable-param := [annots] type-descriptor [param-name] = (default-expression | inferred-typedesc-default) 
+included-record-params := included-record-param (, included-record-param)*
+included-record-param := [annots] * type-reference [param-name]
+rest-param := [annots] type-descriptor ... [param-name]
+param-name := identifier
+inferred-typedesc-default := < >
+
+

+A param-name can be omitted from a required-param, defaultable-param, +included-record-param or rest-param only when occuring in the function-signature +of a function-type-descriptor. The type-descriptor in a required-param or +defaultable-param must not be never. +

+

+The argument list passed to a function consists of zero or more arguments in order; +each argument is a value, but the argument list itself is not passed as a value. +The argument list must conform to the param-list as described in this section. +Usually, the compiler's type checking will ensure that this is the case; if not, +the function will panic. +

+

+It is convenient to consider the complete param-list as having a type. This type +is described by a tuple-type-descriptor that has a member-type-descriptor for +each required-param, defaultable-param and included-record-param, and has a +tuple-rest-descriptor if and only if there is a rest-param. The i-th +member-type-descriptor of the tuple type descriptor is the same as the +type-descriptor of the i-th member of the param-list; for an +included-record-param, the type-descriptor is the type-reference; the +type-descriptor of the tuple-rest-descriptor, if present, is the same as the +type-descriptor of the rest-param. +

+

+An argument list consisting of values v1,..., vn conforms +to a param-list that has type P, if and only if for each i with 1 ≤ i ≤ +n, vi belongs to Ti, where Ti is defined to be the type +that contains a shape s if and only if P contains a list shape whose i-th member +is s. +

+

+A defaultable-param is a parameter for which a default value is specified. An +expression can be used to specify the default value; this expression may refer +to previous parameters. Each such expression is turned into a closure that +computes the default value for the parameter using the values of previous +parameters, and this closure is part of the type descriptor for the function. It +is also possible for the default to be specified as <>; this +means that the default value is a typedesc value that is to be +inferred by the caller from the contextually expected type of the function call. +It is allowed only when the parameter name to which the default value applies is +referenced in the return-type-descriptor, as described below, and is allowed for +at most one parameter in a function. The caller of the function uses the +function's type descriptor to compute default values for any defaultable +arguments that were not specified explicitly. These default values are included +in the argument list passed to the function. Whether a parameter is defaultable, +and what its default is, do not affect the shape of the function and thus do not +affect typing. The closures computing the defaultable parameters are created +when the type descriptor is resolved; the default value is computed by calling +the closure each time the function is called and the corresponding parameter is +not specified. Whether a parameter is defaultable is used at compile time, but +the closure that computes the default value is only used at runtime. If the +function-type-descriptor includes an isolated-qual, then an expression used as a +default-expression must meet the requirements for an isolated function. +

+

+The name of each parameter is included in the function's type descriptor. A +caller of the function may specify the name of the parameter that an argument is +supplying. In this case, the caller uses the parameter name at compile time in +conjunction with the type descriptor to create the argument list. The +parameter names do not affect the shape of the function and thus do not affect +typing. +

+

+The type-reference in an included-record-param must refer to a type defined by a +record-type-descriptor. Specifying an included-record-param *T +p is similar to specifying a required-param T +p. The difference is that the caller of the function may +specify the value for a field of an included-record-param using the field's name +as if it had been declared as a parameter. Any field of the +included-record-param not so specified is defaulted using the +record-type-descriptor. A field-descriptor is a parameter field +descriptor of a function if it is a field descriptor of a +record-type-descriptor referenced by an included-record-param of the function. +The field names of all the parameter field descriptors whose type is not +never must be distinct from each other and from the names of the +parameters. Whether a parameter is an included-record-param is part of the +function's type-descriptor, but does not affect the shape of the function and +thus does not affect whether a function value belongs to a function type. +

+

+The process by which the function caller creates an argument list, which may +make use of arguments specified both by position and by name, is described in +more detail in the section on function calls. +

+
return-type-descriptor := [ returns [annots] type-descriptor ]
+
+

+When the execution of a function returns to its caller, it returns exactly one +value. A function that would in other programming languages not return a value +is represented in Ballerina by a function returning (). Note that +the function definition does not have to explicitly return (); a +return statement or falling off the end of the function body will implicitly +return (). +

+

+The value returned by a function will belong to the type specified in the +return-type-descriptor. An empty return-type-descriptor is equivalent to +returns (). The type-descriptor in a return-type-descriptor may be +never. +

+

+A return-type-descriptor may be depend on the param-list in the following way. A +type-reference occurring in a return-type-descriptor can refer to a parameter +name if the type of the parameter is a subtype of typedesc. If p is +such a parameter, then a reference to p in the return-type-descriptor denotes +the type that is the value of p. If the default value for p is +<> and p occurs in the return-type-descriptor in a union p|T, +then for every basic type B, either the intersection of B and T must be empty, +or the intersection of typedesc<B> and the declared type of p must be +empty, or both. The return-type-descriptor thus denotes a +distinct set of shapes for each invocation of the function. A function-signature +with a return-type-descriptor that uses a type-reference to refer to a parameter +name in this way is said to be dependently-typed. Functions with +dependently-types signatures can be declared and used within Ballerina, but +Ballerina does not yet provide a mechanism to define such functions. +

+

+Function types are covariant in their return types and contravariant in the type +of their parameter lists. More precisely, a function type with return type R and +parameter list type P is a subtype of a function type with return type R' and +parameter list type P' if and only if R is a subtype of R' and P' is a subtype +of P. A function value f belongs to a function type T if the declared type of f +is a subtype of T. +

+

+If a function-type-descriptor includes an isolated-qual, then a +function value belongs to the type only if the value's isolated bit is set; if +the function type does not include an isolated-qual, then whether a +function value belongs to the type is not affected by the value's isolated bit. +

+

+All function values belongs to a function-type-descriptor function; +a function value belongs to the function-type-descriptor isolated +function if and only if it is an isolated function. +

+

+In addition to a readonly bit and an isolated bit, a function value also has a +transactional bit. A function value with its transactional bit set can only be +called in a transactional scope; this is enforced by +the type system. A function value with its transactional bit not set belongs to +the type described by a function-type-descriptor with a function-signature only +if the function-type-descriptor does not include a transactional +qualifier. This means that a function-type-descriptor with a function-signature +but without a transactional qualifier is a subtype of the +corresponding function-type-descriptor with a transactional +qualifier. Note that the subtyping relationship for transactional +is in the opposite direction from isolated. A function value's +transactional bit does not affect whether it belongs to the type described by a +function-type-descriptor without a function-signature. +

+
+
+

5.5.3 Objects

+

+An object value encapsulates data with functions that operate on the data. An +object consists of named members, where each member is either a field or a +method. A field of an object stores a value. A method of an object is a function +that can be invoked on the object using a method-call-expr; when a +method is invoked on an object, the function can access the object using the +self variable. An object's methods are associated with the object +when the object is constructed and cannot be changed thereafter. Fields and +methods have names that uniquely identify them within their object; fields and +methods share a single symbol space; it is not possible for an object to have a +field and a method with the same name. +

+

+The type of object values can be described using an +object-type-descriptor, as specified in this section. It can also +be described using a class. A class both describes an object type and +provides a way to construct an object belonging to the type; in particular, it +provides the method definitions that are associated with the object when it is +constructed. A class is defined using a module-level class definition. +

+

+The object basic type is selectively immutable. An object value has a read-only +bit, which is fixed when the object is constructed. An +object-type-descriptor does not describe whether the object's +read-only bit is set: whether a value belongs to the type described by an +object-type-descriptor is not affected by the object's read-only +bit. Whether an object is read-only can be described separately using a +readonly type descriptor, which can be combined with an +object-type-descriptor using the type intersection operator. +

+ +
object-type-descriptor :=
+   object-type-quals object {
+      object-member-descriptor*
+   }
+object-type-quals :=
+   isolated-qual [object-network-qual]
+   | [object-network-qual [isolated-qual]]
+object-member-descriptor :=
+   object-field-descriptor
+   | method-decl
+   | remote-method-decl
+   | resource-method-decl
+   | object-type-inclusion
+
+ +

+If an isolated-qual is specified, then an object belongs to the described type +only if the object's isolated bit is set. If an isolated-qual is not specified, +then an object's isolated bit does not affect whether it belongs to the +described type. +

+ +
+
5.5.3.1 Network interaction
+

+Objects are the basis for Ballerina's network interaction primitives. There are +two special kinds of object for network interaction: client objects and service +objects. A client object supports network interaction with a remote system that +is originated by the Ballerina program. A service object supports network +interaction with a remote system that is originated by the remote system. An +object may be a client object or a service object or neither; it cannot be both +a client object and a service object. An object that is a client object or a +service object is a network interaction object. +

+ +
object-network-qual := client | service
+
+ +

+If the object-network-qual is client, then an object +belongs to the type only if it is a client object. If the +object-network-qual is service, then an object belongs +to the type only if it is a service object. If object-network-qual +is not present, then an object belongs to the type regardless of whether it is a +client object or service object or neither. A object-network-qual +is not allowed in conjunction with public. +

+ +

+Network interaction objects can have, in addition to fields and methods, two +additional kinds of member: remote methods and resources; both of these are in a +different symbol space from fields and (non-remote) methods. +

+ +
+ +
+
5.5.3.2 Fields
+ +
object-field-descriptor :=
+   metadata [public] type-descriptor field-name ;
+
+

+An object-field-descriptor describes a field of the object. The +field-name of an object-field-descriptor must be +distinct from the field-name of every other +object-field-descriptor in the object-type-descriptor +and from the method-name of every method-decl in the +object-type-descriptor. +

+

+If an object's read-only bit is set, then the read-only bit of the value of +every field must also be set and the value of a field cannot be changed after +the object has been constructed. +

+
+ +
+
5.5.3.3 Methods
+ +
method-decl :=
+   metadata [public] method-quals
+   function method-name function-signature ;
+method-quals := function-quals
+method-name := identifier | special-method-name
+special-method-name := map | join | start
+
+

+A method-decl describes a method of the object. The +method-name of a method-decl must be distinct from the +method-name of every other method-decl in the +object-type-descriptor and from the field-name of +every object-field-descriptor in the +object-type-descriptor. Note that here is no method overloading. +The method-name in a method-decl must not be +init. The identifiers map, join and +start, which are usually reserved keywords, are allowed as method +names. +

+ +

+The isolated-qual together with the function-signature +give the function type of the method. An isolated method has the same access to +the object on which the method is invoked that it has to parameters. +

+
+ +
+
5.5.3.4 Remote methods
+
remote-method-decl :=
+   metadata remote-method-quals 
+   function remote-method-name function-signature ;
+remote-method-quals :=
+   remote-qual function-quals
+   | isolated-qual [transactional-qual] remote-qual
+   | transactional-qual [isolated-qual] remote-qual
+   | isolated-qual remote-qual transactional-qual
+   | transactional-qual remote-qual isolated-qual
+remote-qual := remote
+remote-method-name := identifier
+
+

+A remote-method-decl declares a remote method. An object can +include a remote-method-decl only if it is a network interaction +object. A remote method is a method for network interaction: a remote method of +a client object is for outbound network interaction; a remote method of a +service object is for inbound network interaction. The remote-method-name +of a remote-method-decl must be distinct from the +remote-method-name of every other remote-method-decl in the +object-type-descriptor. However, a method-decl and a +remote-method-decl can have the same name. A remote method cannot +be called using the normal method call syntax. A remote method of a client +object can only be invoked by a client-remote-method-call-action. +The return type of the remote method of a client object must not be +never. A remote method of a service object is invoked by a listener +object provided by a library module; Ballerina does not yet define a mechanism +to allow such a library module to be implemented completely in Ballerina. +

+ +
+ +
+
5.5.3.5 Resources
+ +
resource-method-decl :=
+   metadata resource-method-quals
+   function resource-method-name resource-path function-signature ;
+resource-method-quals :=
+   resource-qual function-quals
+   | isolated-qual [transactional-qual] resource-qual
+   | transactional-qual [isolated-qual] resource-qual
+   | isolated-qual resource-qual transactional-qual
+   | transactional-qual resource-qual isolated-qual
+resource-qual := resource
+resource-method-name := identifier
+resource-path :=
+   dot-resource-path
+   | resource-path-segment (/ resource-path-segment)* [/ resource-path-rest-param]
+   | resource-path-rest-param
+dot-resource-path := .
+resource-path-segment := resource-path-segment-name | resource-path-segment-param
+resource-path-segment-name := identifier
+resource-path-segment-param := [[annots] type-descriptor [param-name]]
+resource-path-rest-param := [[annots] type-descriptor ... [param-name]]
+
+

+As well as remote methods, a network interaction object may include members that +are resources. Resources support a more data-oriented style of network +interaction, which complements the RPC style supported by remote methods. A +resource of a client object is for outbound network interaction; a resource of a +service object is for inbound network interaction. A resource of a client object +can be accessed only using a client-resource-access-action. A +resource of a service object is accessed by a listener object provided by a +library module; Ballerina does not yet define a mechanism to allow such a +library module to be implemented completely in Ballerina. +

+

+Each resource is named within an object by a resource path, which +consists of a list of resource path segments. A resource path segment is most +commonly a string, but can be any value of type anydata. A resource has one or +more named methods. A resource method is thus uniquely identified within its +object by its path and method name. Each resource method corresponds to a way +that the resource can be accessed; the name get should be used for +a resource method that just fetches the resource. For a service object, the +supported resource method names are determined by the listener; a listener that +supports resources should always support the name get. +

+

+A resource-method-decl declares a resource method for one or more +resources. An object can include a resource-method-decl only if it +is a network interaction object. +

+

+A resource-path can be mapped onto a tuple type descriptor as +follows. A dot-resource-path maps to [] (an empty +tuple type). A resource-path-segment-name maps to a member type +descriptor that is a singleton string. A +resource-path-segment-param with type descriptor T +maps to a member type descriptor T. A +resource-path-rest-param with type descriptor T maps +to a tuple rest descriptor T.... +

+

+It is a compile error if a object-type-descriptor has two +resource-method-decls with the same name and with +resource-paths that map to the same tuple type descriptor. +

+

+When a resource with path [s1,...,sm] of a service object +S has a method get with a return value that includes a service +object type, then this has the semantics that the service object S delegates +each resource with a path [s1,...,sm,...,sn] to +a resource [sm+1,...,sn] of the service object returned by +the get method of S. Accordingly, if the return type of a +resource-method-decl with a method name of get and a +resource-path p includes a service object type: +

+
    +
  • the return type must not allow anything other than service objects and +errors;
  • +
  • the resource-path must not end with a +resource-path-rest-param;
  • +
  • there must be no resource-method-decl that has a +resource-path with p as a prefix.
  • +
+

+The set of resource method names applicable for a +resource-method-decl with resource-method-name m at a +resource path position is defined as follows: +

+
    +
  • if the position is not the last position of the resource path, then the +applicable set consists of just get +
  • +
  • otherwise, if the resource-path ends with a resource-path-segment, +then the applicable set consists of just m;
  • +
  • otherwise, the resource-path ends with +resource-path-rest-param and the applicable set consists of +get and m.
  • +
+

+Two resource-method-decls X and Y that map to tuple type descriptors +[X1,...,Xm] and [Y1,...,Yn] +diverge at position i if and only if: +

+
    +
  • i ≤ m;
  • +
  • i ≤ n;
  • +
  • the intersection of the sets of resource method names applicable for X and Y +at position i is non-empty;
  • +
  • for all j < i, Xj is the same type as as Yj;
  • +
  • Xi and Yi are not the same (to be the same, they must +both be a member-type-descriptor or both be a tuple-rest-descriptor, and the +types must be the same).
  • +
+

+If two resource-method-decls diverge at position i, then it is a +compile-time error unless the resource-path of at least one of them +maps to a tuple type descriptor that at position i has a +member-type-descriptor that denotes a singleton string. +

+

+A resource-path-segment that maps to a singleton string takes +priority over other types in the following sense. When a +resource-method-decl R has a resource path that has a +resource-path-segment at position i that maps to a +member-type-descriptor that denotes a type T that is not a +singleton string, then T is narrowed to a type T' by removing every singleton +string type S such that there is a resource-method-decl that +diverges from R at position i and has has a resource path that has a +resource-path-segment at position i that maps to a +member-type-descriptor that denotes S. The +resource-method-decl declares resources methods for resources that +whose corresponding path segment belongs to the narrowed type T' rather than T. +

+

+The return type of a resource method must not allow values belonging to the +function basic type and must not allow client object types. +

+ +
+ +
+
5.5.3.6 Visibility
+

+Each field and method of an object has a visibility region, which is +the region of code within which the field or method is visible and can be +accessed. The visibility region of a remote-method-decl or of +object-field-descriptor or method-decl that includes +public consists of all the modules of the program. Otherwise the +visibility region is the module containing this object type descriptor; this is +called module-level visibility. +

+
+
+
5.5.3.7 Typing
+ +

+The shape of an object consists of a read-only bit, an isolated bit, a network +interaction kind and an unordered collection of object field shapes and object +method shapes. A network interaction kind has one of three values: service, +client or empty. An object field shape or object method shape is a 4-tuple +consisting of the name of the field or method, the visibility region, a remote +flag and a shape for the value of the field or for the method's function. +

+

+An object type is inclusive, in a similar way to an +inclusive-record-type-descriptor: an object shape belongs to an object type if +it has at least the fields and methods described in the object-type-descriptor. +Thus all object values belong to the type object { }. +

+

+An object-type-descriptor that has a field with name f, visibility region R and +type T contains an object shape only if the object shape contains an object +field shape that has name f, visibility region R and a value shape that is +contained in T. An object-type-descriptor that has a method with name m, +visibility region R, remote qualifier r and function type T contains an object +shape only if the object shape contains an object method shape that has name m, +visibility region R, a remote flag that matches r and a function value that +belongs to type T. +

+

+Thus an object type T' is a subtype of an object type T only if for each field +or method f of T there is a corresponding field or method f' of T such that the +type of f' in T' is a subtype of the type of f in T and the visibility region of +f' in T' is the same as the visibility region of f in T. This implies that if an +object type descriptor T has fields or methods with module-level visibility, +then it is possible to define another object type descriptor that is a subtype +of T only within the same module as T. +

+ +
+
+
5.5.3.8 Inclusion and type-ids
+ +
object-type-inclusion := * type-reference ;
+
+

+Every type descriptor referenced directly or indirectly by a +type-reference in an object-type-inclusion must be an +object-type-descriptor, distinct-type-descriptor, +intersection-type-descriptor or +a class that has no private members and no readonly qualifier; the +referenced type descriptor will thus necessarily be definite and a subtype of +object. If a referenced object-type-descriptor or class has an +isolated, service or client qualifier +Q, then the referencing object-type-descriptor must also have the +qualifier Q. The object-field-descriptors and +method-decls from the referenced type are included in the type +being defined. A type-reference to a class is treated as a reference to the +class's type; only the types of the methods and fields are copied from the +referenced type. An object-field-descriptor or +method-decl in a object-type-descriptor can override +respectively an object-field-descriptor or method-decl +of the same name in an included object-type-descriptor, provided +the type declared for the field or method in the overriding descriptor is a +subtype of the type declared in the overridden descriptor. An +object-field-descriptor cannot override a method-decl, +nor can a method-decl override an +object-field-descriptor. It is an error if an +object-type-descriptor has two or more +object-type-inclusions that include an +object-field-descriptor with the same name, unless those +object-field-descriptors are overridden by an +object-field-descriptor in the including +object-type-descriptor. It is an error if an +object-type-descriptor has two or more +object-type-inclusions that include method-decls with +the same name but different function-signatures, unless those +method-decls are overridden by a method-decl in the +including object-type-descriptor. +

+

+An object-type-descriptor is always definite. The set of type-ids induced by an +object-type-descriptor is the union of the set of type-ids induced by the type +descriptors that it includes. An induced type-id is primary in an +object-type-descriptor if and only if it is primary in any of the included type +descriptors. It is an error if the induced set of type-ids includes a non-public +type-id from another module. +

+

+It is an error for an object-type-descriptor to directly or +indirectly include itself. +

+
+
+
+

5.5.4 Futures

+ +
future-type-descriptor := future [type-parameter]
+
+

+A future value refers to a named worker, which will return a value. A future +value belongs to a type future<T> if the return type of the +named worker is a subtype of T. +

+

+A value belongs to a type future (without the type-parameter) +if it has basic type future. +

+
+
+

5.5.5 Type descriptors

+
typedesc-type-descriptor := typedesc [type-parameter]
+
+

+A type descriptor value is an immutable value representing a resolved type +descriptor. The type typedesc contains all values with basic type typedesc. A +typedesc value t belongs to a type typedesc<T> if +and only if the type described by t is a subtype of T. +The typedesc type is thus covariant with its type parameter. +

+

+Referencing an identifier defined by a type definition in an expression context +will result in a type descriptor value. +

+ +
+
+

5.5.6 Handles

+
handle-type-descriptor := handle
+
+

+A handle value is a reference to storage managed externally to a Ballerina +program. Handle values are useful only in conjunction with functions that have +external function bodies; in particular, a new handle value can be created only +by a function with an external function body. Handle values are inherently +immutable. +

+

+A value belongs to a type handle if it has a basic type of handle. +

+ +
+ +
+

5.5.7 Streams

+ +
stream-type-descriptor := stream [stream-type-parameters]
+stream-type-parameters := < type-descriptor [, type-descriptor]>
+
+

+A stream is an object-like value that can generate a sequence of values. There +is also a value associated with the completion of the generation of the +sequence, which is either nil, indicating the generation of the sequence completed +successfully, or an error. A stream belongs to type +stream<T,C> if the values in the generated sequence all +belong to T and if the completion value belongs to C. The type +stream<T> is equivalent to stream<T,()>. A +value belongs to a type stream (without the type-parameter) if it +has basic type stream. A type stream<T,C> where C does not +include nil describes an unbounded stream. +

+

+A stream supports two primitive operations: a next operation and a close +operation. The next operation has the same semantics as the next method on the +Iterator object type. The close operation informs the stream that there will be +no more next operations and thus allows the stream to release resources used by +the stream; the close operation on a stream<T,C> has a result +of type C?, where nil means that the close operation was +successful. The close operation is idempotent: performing the close operation on +a stream on which the close operation has already been performed has no effect. +When the generation of the sequence is complete, the stream automatically +performs the close operation to release resources used by the stream. +

+

+The type descriptor stream<T,C> works like a class, in that +it can be used with new to construct stream values that belong to +the type. The normal implementation of a stream<T,C> is a +wrapper around an object belonging to object type +StreamImplementor<T,C>. The next and close operations on +the stream delegate to the next and close methods on the StreamImplementor. +

+

+The stream module of the lang library provides +additional operations on stream that can be implemented in terms of the +primitive next and close operations. +

+

+A stream is iterable. A stream of type stream<T,C> has value +type T and completion type C. Calling the next method +on the iterator created for an iteration has the same effect as performing the +next operation on the stream. The stream does not keep a copy of the sequence of +values returned by the next operation. Any subsequent iteration operation on the +same stream will not generate further values, so the iteration sequence for +iterations other than the first will be the empty sequence. +

+

+Note that in this version of Ballerina the stream type is not a class because +Ballerina does not yet support parameterized classes. +

+
+ +
+
+

5.6 Other type descriptors

+ +
other-type-descriptor :=
+   | type-reference
+   | singleton-type-descriptor
+   | any-type-descriptor
+   | never-type-descriptor
+   | readonly-type-descriptor
+   | distinct-type-descriptor
+   | union-type-descriptor
+   | intersection-type-descriptor
+   | optional-type-descriptor
+   | anydata-type-descriptor
+   | json-type-descriptor
+   | byte-type-descriptor
+   | ( type-descriptor )
+
+

+It is important to understand that the type descriptors specified in this +section do not add to the universe of values. They are just adding new ways to +describe subsets of this universe. +

+
+

5.6.1 Type reference

+
type-reference := identifier | qualified-identifier
+
+ +

+A type descriptor can use a type-reference to refer to a type definition in the +same module or another module. +

+

+A type-reference referring to a type descriptor T is definite if and +only if T. If it is, the type-ids induced by are the same as those +induced by T and a type-id is primary in t if and only if +it is primary in T. It is an error if the induced set of type-ids +includes a non-public type-id from another module. +

+ +
+
+

5.6.2 Singleton types

+ +
singleton-type-descriptor := simple-const-expr
+
+
+

+A singleton type is a type containing a single shape. A singleton type is +described using a compile-time constant expression for a single value: the type +contains the shape of that value. Note that it is possible for the +variable-reference within the simple-const-expr to reference a structured value; +in this case, the value will have its read-only bit set; a value without its +read-only bit set will thus not belong to any singleton type. +

+
+
+

5.6.3 Any type

+ +
any-type-descriptor := any
+
+

+The type descriptor any describes the type consisting of all values +other than errors. A value belongs to the any type if and only if its basic type +is not error. Thus all values belong to the type any|error. Note +that a structure with members that are errors belongs to the any +type. +

+

+The any-type-descriptor is not definite. +

+
+
+

5.6.4 Never type

+ +
never-type-descriptor := never
+
+

+The type descriptor never describes the type that does not contain +any shapes. No value ever belongs to the never. +

+

+This can be useful to describe for the return type of a function, if the +function never returns. It can also be useful as a type parameter. For example, +xml<never> describes the an xml type that has no +constituents, i.e. the empty xml value. +

+

+Note that for any type T, the type T|never is the same +as T. +

+
+
+

5.6.5 Readonly type

+
readonly-type-descriptor := readonly
+
+

+A shape belongs to the type readonly if its read-only bit is on. +

+

+A value belonging to an inherently immutable basic type will always have its +read-only bit on. These basic types are: +

+
    +
  • all simple types +
      +
    • nil
    • +
    • boolean
    • +
    • int
    • +
    • float
    • +
    • decimal
    • +
    +
  • +
  • string
  • +
  • error
  • +
  • function
  • +
  • typedesc
  • +
  • handle
  • +
+

+A value belonging to a selectively immutable basic type may have its read-only +bit on. These basic types are: +

+
    +
  • xml
  • +
  • list
  • +
  • mapping
  • +
  • table
  • +
  • object
  • +
+ +
+
+

5.6.6 Distinct types

+
distinct-type-descriptor := distinct type-descriptor
+
+

+Each occurrence of a distinct-type-descriptor describes a type that is distinct +from any other occurrence of a distinct-type-descriptor. Only object and error +values can belong to a type described by a distinct-type-descriptor. +

+

+The type denoted by a distinct-type-descriptor D, where +D is distinct T, and +d is the type-id of this occurrence of D, +contains a shape s of an object or error value if and only if both +T contains s and the set of type-ids of +s contains d. The set of type-ids induced by +D consists of d as the primary type-id and +the type-ids induced by T as the secondary type-ids. The +type T must be definite and must be a subtype of object +or a subtype of error. The type D is always definite. +Note that D is always a proper subtype of +T. +

+ +
+
+

5.6.7 Union types

+ +
union-type-descriptor := type-descriptor | type-descriptor
+
+

+The set of shapes denoted by an union type T1|T2 is the union of +the set of shapes denoted by T1 and the set of shapes denoted by +T2. Thus, the type T1|T2 contains a shape if and only +if either the type denoted by T1 contains the shape or the type +denoted by T2 contains the shape. A type descriptor +T1|T2 is not a class and cannot be used with new, +even if one or both of T1 and T2 are classes. +

+

+A union type T1|T2 is definite if and only if both T1 +and T2 are definite and the set of type-ids induced by +T1 and T2 are the same. If it is definite, then it +induces the same set of type-ids as T1 and T2, and a +type-id is primary if it is primary in either T1 or +T2. +

+
+
+

5.6.8 Intersection types

+ +
intersection-type-descriptor := type-descriptor & type-descriptor
+
+

+The set of shapes denoted by an intersection type is the +intersection of the set of shapes denoted by T1 and the set of +shapes denoted by T2. Thus, the type T1&T2 +contains a shape if and only if the types denoted by T1 and +T2 both contain the shape. It is a error to have an intersection +type that denotes an empty set of shapes. In an intersection type +T1&T2, it is an error if T1 and T2 +are both function types unless there is a single function-type-descriptor that +denotes a type that is a subtype of both T1 and T2. +A type descriptor T1&T2 is not a class and cannot be used +with new, even if one or both of T1 and T2 are classes. +

+

+An intersection type T1&T2 is definite if and only if both +T1 and T2 are definite. If it is definite, then it +induces the union of the set of type-ids induced by T1 and +T2, and a type-id is primary if it is primary in either +T1 or T2. +

+

+Intersection types are particularly useful in conjunction with +readonly. A set of readonly shapes can be described by +readonly&T, where T describes the primary aspect +of the shape. +

+

+When T is either R&readonly or readonly&R, +where R is a record type descriptor, and a field in R has a default value with +closure C, then, if the return type of C belongs to Cloneable, the field in T has a default value with a +closure that applies the ImmutableClone operation +to result of evaluating C; otherwise, the field in T does not have a default +value. +

+
+ +
+

5.6.9 Optional types

+ +
optional-type-descriptor := type-descriptor ?
+
+

+A type T? means the union of T +and (). It is completely equivalent to +T|(). +

+
+ +
+

5.6.10 Anydata type

+ +
anydata-type-descriptor := anydata
+
+

+The type descriptor anydata describes the type of plain data. The +type anydata contains a shape if and only if it is the shape of a +value that is plain data. The anydata type can thus be defined as: +

+ +
  () | boolean | int | float | decimal
+    | string | xml | regexp:RegExp
+    | anydata[] | map<anydata> | table<map<anydata>>
+
+ +

+In the above, regexp refers to the lang library module +lang.regexp. Since there is only one tagged data type defined in +this version of Ballerina, all tagged data values belong to +regexp:RegExp. +

+ +
+
+

5.6.11 JSON types

+ +
json-type-descriptor := json
+
+

+The json type is designed for processing data expression in JSON +format. It is a built-in name for a union defined as follows: +

+
type json = () | boolean | int | float | decimal | string | json[] | map<json>;
+
+

+In addition, the json type is defined to have lax static typing. +

+ +
+ +
+

5.6.12 Byte type

+ +
byte-type-descriptor := byte
+
+

+The byte type is a predefined name for a union of the int values in the range 0 +to 255 inclusive. It is equivalent to the built-in +subtype int:Unsigned8. +

+
+ +
+
+

5.7 Built-in object types

+

+There are several object types that are built-in in the sense that the +language treats objects with these types specially. There are two kinds of +object type: +

+
    +
  • purely structural types; the name of the type is internal to this +specification and not exposed to the language;
  • +
  • distinct types; the name of the type is defined in a lang library +module.
  • +
+ +
+

5.7.1 Iterator

+

+A value of iterable type with iteration value type T and iteration completion +type C provides a way of creating an iterator object that belongs to the object +type +

+ +
    object {
+       public function next() returns record {| T value; |}|C;
+    }
+
+

+In this specification, we refer to this type as Iterator<T,C>. +

+

+Conceptually an iterator is at a position between members of the iteration sequence. +Possible positions are at the beginning (immediately before the first member if +any), between members and at the end (immediately after the last member if any). +A newly created iterator is at the beginning position. For an empty sequence, +there is only one possible position which is both at the beginning and at the +end. +

+

+The next() method behaves as follows: +

+
    +
  • if the iteration has encountered an error, return an error value
  • +
  • otherwise, if the iterator has completed successfully by reaching the end +position without an error, return nil
  • +
  • otherwise +
      +
    • move the iterator to next position, and
    • +
    • return a record { value: v } where v is the member of the +sequence between the previous position and the new position
    • +
    +
  • +
+

+Mutation of a structured value during iteration is handled as follows. A call to +next() must panic if there has been any mutation to the structured +value since the iterator was created other than the following:

+
    +
  • removing a member of the structured value that a preceding call to the +iterator has already returned;
  • +
  • changing the member associated with an existing key.
  • +
+

+In the latter case, next() must return the value associated with +the key at the point when next() is called. +

+

+Note that it is not possible for the next() method simply to return +the values in the iteration sequence, since there would be no way to distinguish +a nil or error value that is part of the iteration sequence from a nil or error +value that represents the result of the iteration. +

+
+
+

5.7.2 Iterable

+

+An object belongs to the object type Iterable<T,C> if it has a +method named iterator with no arguments and a return type that is +subtype of Iterator<T,C> and it belongs to the distinct type +Iterable defined in lang.object. An object that +belongs to Iterable<T,C> is iterable: the object returned by the +iterator method determines the iteration sequence and iteration +completion value. +

+
+
+

5.7.3 StreamImplementor

+

+An object belongs to the object type StreamImplementor<T,C> if it +belongs to Iterator<T,C> and also optionally has a method +close() with return value C?. This is equivalent to +belonging to the following type. +

+ +
    object {
+       public isolated function next() returns record {| T value; |}|C;
+    }
+    | object {
+       public isolated function next() returns record {| T value; |}|C;
+       public isolated function close() returns C?;
+    }
+
+ +

+The close method says that there will be no more calls to the next method. Any +call to a next method after the close method has been called must result in a +panic. A missing close method behaves like a close method that puts the object +into a closed state, in which calls to next will result in a panic, and then +immediately returns (). +

+ +
+
+

5.7.4 Listener

+

+The object type Listener<T,A>, where T is a a subtype of service +object {} and A is a subtype of string[]|string|(), is +described by the following object type descriptor: +

+ +
object {
+   public function attach(T svc, A attachPoint) returns error?;
+   public function detach(T svc) returns error?;
+   public function start() returns error?;
+   public function gracefulStop() returns error?;
+   public function immediateStop() returns error?;
+}
+
+

+The role of a Listener is to handle incoming network messages by making +calls on service objects as described in Listeners and services. Each method is used +as follows: +

+
    +
  • the attach method is used to provide the Listener with a +service object that it can use to handle incoming network messages; the +attachPoint argument is used to identify which network messages the +service object should be used for;
  • +
  • the detach method tells the Listener to stop using a service +object that was previously provided using the attach method;
  • +
  • the start method tells the Listener to start handling incoming +network messages;
  • +
  • the gracefulStop and immediateStop messages tell +the Listener to stop handling incoming network messages; +
      +
    • in the case of gracefulStop, the listener should complete the +handling of any incoming messages that it has started to handle; in particular, +it should wait for the completion of any strands that it created to execute +service object methods;
    • +
    • in the case of immediateStop, the listener should not try to +complete the hanlding of any incoming messages that is has started to handle; in +particular, it should cancel any strands that it created to execute service +object methods.
    • +
    +
  • +
+

+Each method returns an error value if an error occurred, and return nil +otherwise. The listener object is responsible for creating and keeping track of +any strands that it needs. +

+

+A type is a listener object type if it is a subtype of the object type +Listener<T,A>, for some type T that is a subtype of service object +{} and some type A that is a subtype of string[]|string|(). +

+
+
+

5.7.5 RawTemplate

+

+The RawTemplate type describes the type of object constructed by a raw template +expression. The type is defined in lang.object as follows. +

+
distinct object {
+    public (readonly & string[]) strings;
+    public (any|error)[] insertions;
+}
+
+ +
+
+

5.7.6 RetryManager

+ +

+Classes of type RetryManager are defined by the application to allow control +over retries performed by the retry statement and retry transaction statement +The object type RetryManager<E>, where E is a a subtype of +error, is described by the following object type descriptor: +

+ +
object {
+   public function shouldRetry(E e) returns boolean;
+}
+
+

+Note that RetryManager<E> is contravariant in E i.e. RetryManager<E> +is a subtype of RetryManager<E'> if and only if E' is a subtype of E. +

+ +
+ +
+
+

5.8 Abstract operations

+

+These section specifies a number of operations that can be performed on values. +These operations are for internal use by the specification. These operations are +named in CamelCase with an initial upper-case letter to distinguish them from +functions in the lang library. +

+
+

5.8.1 FillMember

+

+The FillMember(s, k) operation is defined for a structured value s and an +out-of-line key value k. It can be performed when s does not have a member with +key k; if it succeeds, it will result in a member with key k being added to s. +It will succeed if the inherent type of s allows the addition of a member with +key k and there is a way to construct a filler value for the type descriptor +that the inherent type of s requires for member k. The following table specifies +when and how a filler value can be constructed for a type descriptor. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type descriptorFiller valueWhen available
()()
booleanfalse
int0
float+0.0f
decimal+0d
string""
array or tuple type descriptor[]if that is a valid constructor for the type
map or record type descriptor{ }if that is a valid constructor for the type
readonly & Tthe filler value for T constructed as read-onlyif that belongs to the type
tableempty table (with no rows)
objectnew T()if T is a class, where T is the type descriptor for the object, and the +static type of T's init method allows no arguments and does not include error
streamempty stream
xmlxml``
built-in subtype of xml +xml``if this belongs to the subtype, i.e. if the subtype is +xml:Text +
regexp:RegExpre``
singletonthe single value used to specify the type
union()if () is a member of the union
the filler value for basic type Bif all members of the union belong to a single basic type B, +and the filler value for B also belongs to the union
T?()
any()
anydata()
byte0
built-in subtype of int +0
json()
+ +
+
+

5.8.2 Cloning

+

+There are two cloning operations. Both of these operate on values belonging to the +Cloneable type defined as follows: +

+
+public type Cloneable readonly|xml|Cloneable[]|map<Cloneable>|table<map<Cloneable>>;
+
+

+This type is defined in the lang.value module of the lang library. In this document, +the type will be referred to as value:Cloneable. +

+ +
+
5.8.2.1 Clone
+

+Clone(v) is defined for any value v that belongs to the type +value:Cloneable. It performs a deep copy, recursively copying all +structural values and their members and recursively copying all sequence values +and their constituents. Clone(v) for an immutable value v returns v. If v is of +a basic type that has an inherent type, Clone(v) has the same inherent type as +v. The graph of references of Clone(v) must have the same structure as that of +v. This implies that the number of distinct references reachable from Clone(v) +must be the same as the number of distinct references reachable from v. Clone(v) +must terminate even if v has cycles. +

+

+Clone(v) cannot be implemented simply by recursively calling Clone on all +members of v. Rather Clone must maintain a map that records the result of +cloning each reference value. When a Clone operation starts, this map as empty. +When cloning a reference value, it must use the result recorded in the map if +there is one. +

+

+The Clone operation is exposed by the clone function in the +lang.value module of the lang library. +

+
+
+
5.8.2.2 ImmutableClone
+

+ImmutableClone(v) is defined for any value v that belongs to the type +value:Cloneable. It performs a deep copy of v similar to Clone(v), +except that newly constructed values will be constructed as immutable and so +have their read-only bit on. Any immutable value is not copied. So the result +of Immutable always has its read-only bit on. +

+

+Like Clone, ImmutableClone must preserve graph structure, including cycles. +Conceptually the whole graph is constructed before being made immutable. +

+

+The ImmutableClone operation is exposed by the cloneReadOnly +function in the lang.value module of the lang library. +

+
+
+
+

5.8.3 DeepEquals

+

+DeepEquals(v1, v2) is defined for any values v1, v2 that belong to type anydata. +It returns true or false depending of whether the primary aspect of the shape v1 +and of v2 are the same. In other words, DeepEquals returns true if and only if +the values are the same ignoring whether read-only bits are on or off. +DeepEquals(v1, v2) must terminate for any values v1 and v2 of type anydata, even +if v1 or v2 have cycles. DeepEquals(v1, v2) returns true if v1 and v2 have the +same shape, even if the graphs of references of v1 and v2 have different +structures. If two values v1 and v2 have different basic types, then +DeepEquals(v1, v2) will be false. +

+

+The possibility of cycles means that DeepEquals cannot be implemented simply by +calling DeepEquals recursively on members. Rather DeepEquals must maintain a +mapping that records for each pair of references whether it is already in +process of comparing those references. When a DeepEquals operation starts, this +map is empty. Whenever it starts to compare two references, it should see +whether it has already recorded that pair (in either order), and, if it has, +proceed on the assumption that they compare equal. +

+

+DeepEquals(Clone(x), x) is guaranteed to be true for any value of type anydata. +

+
+
+

5.8.4 NumericConvert

+

+NumericConvert(t, v) is defined if t is the typedesc for float, decimal or int, +and v is a numeric value. It converts v to a value in t, or returns an error, +according to the following table. +

+ + + + + + + + + + + + + + + + + + + + + + + + +
from \ tofloatdecimalint
floatunchangedclosest math valueround, error for NaN or out of int range
decimalclosest math valueunchanged
intsame math valuesame math valueunchanged
+
+
+

5.8.5 ToString

+

+ToString(v,style) converts a value to a string in one of three styles. The +conversion can be performed in one of three styles, specified by the style +parameter, which are as follows. +

+
    +
  • expression style: produces a string that looks like a Ballerina expression; there are +two cases +
      +
    • when v belongs to anydata and does not have cycles, it will produce a string that +is a valid Ballerina expression, such that evaluating that string will result in a value v' +for which DeepEquals(v, v') is true
    • +
    • otherwise, it will produce a string that is either not a valid Ballerina expression +or is a valid Ballerina expression that evaluates to a value that does not belong type type anydata
    • +
    +
  • +
  • informal style: similar to expression style, but does not preserve all the distinctions that +expression style does, and avoids syntax that requires a knowledge of Ballerina
  • +
  • direct style: this does a direct conversion of the value to a string rather than producing +a string that describes the value +
      +
    • if v is a string, then the result of ToString(v,direct) is v
    • +
    • if v is XML, then the result of ToString(v,direct) is v in XML syntax
    • +
    • direct style falls back to informal style for basic types where there is no +other natural more direct conversion
    • +
    +
  • +
+

+The following table summarizes the result of ToString(v,style) for each basic type. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic type of v + style +
expression + informal + direct +
nil + +() + +null + +
true + +true +
int + +2 +
float + +1.0 +
+float:NaN + +NaN +
+float:Infinity + +Infinity +
decimal + +1d + +1 +
+1.20d + +1.20 +
string + +"xyz" + +xyz +
xml + +xml`<d>t</d>` + +`<d>t</d>` + +<d>t</d> +
tagged data type + +re`xyz` + +`xyz` + +xyz +
array + +[X,Y] +
+X, Y expression style + +X,Y informal style +
map + +{"x":X,"y":Y} +
+X, Y expression style + +X,Y informal style +
table + +table key(k) [R1,R2] + +[R1,R2] +
+R1,R2 expression style + +R1,R2 informal style +
error + +error D1&D2 (M,C,F1=V1,F2=V2) +
V1, V2 expression style, D1,D2 in the form {module-id}local-id, M expression style, C expression style + V1, V2 informal style, just local id of D1,D2, M informal style, C informal style +
D1,D2 are type-ids, M is the error message, C is the error cause, F1=V1,F2=V2 are field names and values of the error detail +
object w/o toString method + +object D1&D2 U where U is an identifier that uniquely identifies the object (objects will have the same identifier only if they are ===) +
object with toString method + +object S + +S +
+S in direct style where S is the result of calling the toString method
behavioural type other than error or objectidentifier for behavioural type (function, + future, typedesc, stream or handle) followed + by implementation-dependent string +
+cycle detected + +...[N] + +... +
N is 0-based index down path from root object to object where cycle is detected + +
+
+
+

5.8.6 Ordering

+

+There are three abstract operations related to ordering: Compare(x, y), +CompareA(x, y), CompareD(x, y). CompareA(x, y) and CompareD(x, y), which are +used to define sorting, return one of the values LT, EQ, GT representing the +cases where x is less than, equal to or greater than y. Compare(x, y), which is +used to define the relational operators, can also return the value UN to +represent the case where x is unordered with respect to y; this is used to deal +with NaN. +

+

+The three operations are related as follows: Compare(x, y) is the same as +CompareA(x, y) and CompareD(x, y) unless Compare(x, y) is UN. +

+

+A type is ordered if all the values that belong to the type can be compared to +each other using the above three abstract operations. Thus each of the abstract +operations are defined when there is an ordered type to which both arguments +belong. +

+

+If C is any of the three abstract operations, and there is an ordered type to +which both x and y belong, then: +

+
    +
  • C(x, y) is LT if and only if C(y, x) is GT
  • +
  • C(x, y) is EQ if and only if C(y, x) is EQ
  • +
  • C(x, y) is UN if and only if C(y, x) is UN
  • +
+

+The most straightforward ordered types are basic types where all the values of +the type can be put into an order. These types are nil, boolean, int, string. For +each of these three types, for any pair of values x, y belonging to the type +

+
    +
  • Compare(x, y) is EQ if x and y are the same value
  • + +
  • Compare(x, y) is LT in the following cases: +
      +
    • for int, if x is mathematically less than y
    • +
    • for boolean, if x is false and y is true
    • +
    • for string, if x is lexicographically less than y in Unicode code point +order, more precisely, if +
        +
      • x is an proper initial substring of y, or
      • +
      • for the first index at which x and y differ, the code point at that index in +x is less than the code point at that index in y
      • +
      +
    • +
    +
  • +
  • CompareA(x,y), and CompareD(x,y) have the same value as Compare(x, y)
  • +
+

+The basic type decimal is ordered. The abstract operations are defined the same +as for int, except that Compare(x, y) is EQ if x and y have the same shape. In +other words, the compare operations ignore precision. +

+

+The basic type float is also ordered. Compare(x,y) is as defined by IEEE +754-2008 clause 5.11. In particular: +

+
    +
  • the Compare operation does not distinguish +0 from -0 i.e. +Compare(-0.0,+0.0) is EQ
  • +
  • Compare(x, y) is UN if x or y or both is NaN
  • +
+

+When x and y belong to type float, CompareA(x, y) and CompareD(x, y) differ from +Compare(x, y) as follows: +

+
    +
  • CompareA(NaN,NaN) and CompareD(NaN, NaN) are EQ
  • +
  • CompareA(x, NaN) is LT if x is not NaN
  • +
  • CompareD(NaN, x) is LT if x is not NaN
  • +
+

+If type T is ordered, then type T? Is also ordered. Comparison operations +involving nil are defined as follows: +

+
    +
  • Compare((),()), CompareA((),()) and CompareD((),()) are all EQ
  • +
  • Compare(x,()) is UN if x is not ()
  • +
  • CompareA(x,()) is LT if x is not ()
  • +
  • CompareA((), x) is LT if x is not ()
  • +
+

+The CompareA operation is used for sorting in ascending order; the CompareD +operation is used in reverse for sorting in descending order. The net effect of +the above rules is thus that both () and NaN will appear at the end of a sorted +list, with NaN before (), in both ascending and descending order. +

+

+The following rules determine when a subtype of list is ordered: +

+
    +
  • [T...] is ordered, if T is ordered;
  • +
  • [] is ordered;
  • +
  • [T, rest] is ordered if T is ordered and [rest] is ordered.
  • +
+

+Each of the three abstract operations C are extended to apply to lists as +follows: +

+
    +
  • C([], []) is EQ;
  • +
  • C([], [y1,...]) is LT;
  • +
  • C([x1,x2,...],[y1, y2...]) is r unless r is EQ and otherwise C([x2,...],[y2,...]), where r is C(x1, y1).
  • +
+
+
+
+

5.9 Binding patterns, variables and identifiers

+
+

5.9.1 Binding patterns

+

+Binding patterns are used to support destructuring, which allows different parts +of a single structured value each to be assigned to separate variables at the +same time. +

+ +
binding-pattern :=
+   capture-binding-pattern
+   | wildcard-binding-pattern
+   | list-binding-pattern
+   | mapping-binding-pattern
+   | error-binding-pattern
+capture-binding-pattern := variable-name
+variable-name := identifier
+wildcard-binding-pattern := _
+list-binding-pattern := [ list-member-binding-patterns ]
+list-member-binding-patterns :=
+   binding-pattern (, binding-pattern)* [, rest-binding-pattern]
+   | [ rest-binding-pattern ]
+mapping-binding-pattern := { field-binding-patterns }
+field-binding-patterns :=
+   field-binding-pattern (, field-binding-pattern)* [, rest-binding-pattern]
+   | [ rest-binding-pattern ] 
+field-binding-pattern :=
+   field-name : binding-pattern
+   | variable-name
+rest-binding-pattern := ... variable-name
+error-binding-pattern := error [error-type-reference] ( error-arg-list-binding-pattern )
+error-type-reference := type-reference
+error-arg-list-binding-pattern :=
+   error-message-binding-pattern [, error-cause-binding-pattern] [, error-field-binding-patterns]
+   | [error-field-binding-patterns]
+error-message-binding-pattern := simple-binding-pattern 
+error-cause-binding-pattern := simple-binding-pattern | error-binding-pattern
+simple-binding-pattern := capture-binding-pattern | wildcard-binding-pattern
+error-field-binding-patterns :=
+   named-arg-binding-pattern (, named-arg-binding-pattern)* [, rest-binding-pattern]
+   | rest-binding-pattern
+named-arg-binding-pattern := arg-name = binding-pattern
+
+

+A binding pattern may succeed or fail in matching a value. A successful match +causes values to be assigned to all the variables occurring the binding-pattern. +

+

+A binding pattern matches a value in any of the following cases. +

+
    +
  • a capture-binding-pattern always matches a value and causes the matched +value to be assigned to named variable;
  • +
  • a wildcard-binding-pattern matches a value if the value belongs to type any, +in other words if the basic type of the value is not error; it does not cause +any assignments to be made;
  • +
  • a list-binding-pattern with m binding patterns matches a list with n +members if m is less than or equal to n, and the i-th binding pattern matches +the i-th member of the list for each i in 1 to m, and either m is equal to n or +the list-binding-pattern includes a rest-binding-pattern; if there is a +rest-binding-pattern ...v, then a successful match causes a new +list value consisting of all members of the matched list except for the the +first m values to be assigned to v;
  • +
  • a mapping-binding-pattern { f1: p1, f2: +p2, ..., fn: pn, r } matches a mapping value m +if each field-binding-pattern fi: pi matches m for each i +in 1 to n; if r is ...v then a successful match causes a new +mapping value consisting of all fields other than f1 to fn +to be assigned to v;
  • +
  • a field-binding-pattern f: p matches a mapping value m if +
      +
    • m contains a field f and p matches its value; or
    • +
    • m does not have a field f and p matches nil; this case is applied only when +the field-binding-pattern is used in a context where it is known at compile-time +that the field f is optional and cannot have the value nil;
    • +
    +
  • +
  • a field-binding-pattern consisting of just a variable-name x +is equivalent to a field-binding-pattern x: x;
  • +
  • an error-binding-pattern error ET(pm, pc, +f1 = p1, f2 = p2, ..., fn += pn, r) matches an error value e if +
      +
    • e has a message that matches pm,
    • +
    • if pc is present, e has a cause that matches pc,
    • +
    • e has a detail record that has fields f1, f2, ... , +fn such that pi matches the value of field fi +for each i in 1 to n,
    • +
    • if ET is present, the shape of e is in ET,
    • +
    • if r is ...v, then a successful match causes a new mapping +value consisting of all fields of the detail record other than f1, +f2, ... , fn to be assigned to v;
    • +
    +
  • +
+

+All the variables in a binding-pattern must be distinct e.g. [x, x] is not +allowed. +

+

+Given a type descriptor for every variable in a binding-pattern, there is a type +descriptor for the binding-pattern that will contain a value just in case that +the binding pattern successfully matches the value causing each variable to be +assigned a value belonging to the type descriptor for that variable. +

+
    +
  • for a capture-binding-pattern, the type descriptor is the type descriptor +for that variable;
  • +
  • for a wildcard-binding-pattern, the type descriptor is any
  • +
  • for a list-binding-pattern, the type descriptor is a tuple type descriptor;
  • +
  • for a mapping-binding-pattern, the type descriptor is a record type +descriptor;
  • +
  • for an error-binding-pattern, the type descriptor is an error type +descriptor.
  • +
+ +
+
+

5.9.2 Typed binding patterns

+ +
typed-binding-pattern := inferable-type-descriptor binding-pattern
+inferable-type-descriptor := type-descriptor | var
+
+

+A typed-binding-pattern combines a type-descriptor and a binding-pattern, and is +used to create the variables occurring in the binding-pattern. If +var is used instead of a type-descriptor, it means the type is +inferred. +

+

+There are two ways in which a typed-binding-pattern can be used. +

+
    +
  • +Single use. In the language syntax, this kind of use of a +typed-binding-pattern is usually followed by = (the only case where +it is not followed by = is when it follows on fail). +The typed-binding-pattern is matched once against the result of evaluating an +expression. When var is used, the type is inferred from the static +type of the expression (in the on fail case there can be multiple +expressions from which it is inferred); in this case, it is an error if the +intersection of error and the inferred type is non-empty, the +binding-pattern of the typed-binding-pattern is a capture-binding-pattern, and +the variable referenced in the capture-binding-pattern is not used. It is an +error if the type-descriptor in the typed-binding-pattern is +never.
  • +
  • +Iterative use. In the language syntax, this kind of use of a +typed-binding-pattern is followed by the in keyword. An iterator is +created from the result of evaluating an expression, and the +typed-binding-pattern is matched against each value returned by the iterator. +When var is used, the type is inferred to be T, where the static +type of the expression is an iterable type with value type T.
  • +
+

+The simplest and most common form of a typed-binding-pattern is for the binding +pattern to consist of just a variable name. In this case, the variable is +constrained to contain only values matching the type descriptor. +

+

+When the binding pattern is more complicated, the binding pattern must be +consistent with the type-descriptor, so that the type-descriptor unambiguously +determines a type for each variable occurring in the binding pattern. A binding +pattern occurring in a typed-binding-pattern must also be irrefutable with +respect to the type of value against which it is to be matched. In other words, +the compiler will ensure that matching such a binding pattern against a value +will never fail at runtime. +

+
+
+

5.9.3 Variable and identifier scoping

+

+For every variable, there is place in the program that declares it. Variables +are lexically scoped: every variable declaration has a scope which determines +the region of the program within which the variable can be referenced. +

+

+There are two kinds of scope: module-scope and block-scope. A variable with +module-scope can be referenced anywhere within a module; if declared +public, it can also be referenced from outside the module. +

+

+Identifiers with module-scope are used to identify not only variables but other +module-level entities such as functions. Within module-scope, identifiers are +separated into three symbol spaces: +

+
    +
  • the main symbol space includes identifiers for variables, +constants, types, functions and other identifiers that do not belong to any of +the other two symbol spaces;
  • +
  • the prefix symbol space contains prefixes declared by import +declarations and XML namespace declaration statements;
  • +
  • the annotation tag symbol space contains annotation tags declared +by annotation declarations.
  • +
+

+The prefix symbol space is special in that it is associated with a source part +rather than a module. +

+

+Block-scope is divided into symbol spaces in the same way as module-scope, +except that block-scope does not have a symbol space for annotation tags, since +annotation tags cannot be declared with block-scope. +

+

+An identifier declared with block-scope can be referenced only within a +particular block (always delimited with curly braces). Block-scope variables are +created by a variety of different constructs, many of which use a +typed-binding-pattern. Parameters are treated as read-only variables with +block-scope. +

+

+It is not an error if an identifier is declared with block-scope and there is +already a declaration of the same identifier in the same symbol space with +module-scope. In this case, the block-scope declaration will hide the +module-scope declaration for the region where the block-scope declaration is in +scope. However, it is a compile error if an identifier is declared with +block-scope and its scope overlaps with the scope of another declaration of the +same identifier in the same symbol space also with block-scope. +

+ +
qualified-identifier := module-prefix NoSpaceColon identifier
+module-prefix := identifier | predeclared-prefix
+
+

+A module-prefix is a name that is used locally within the source of +a module to refer to another module. A module-prefix in a +qualified-identifier must refer to a module-prefix specified in an +import declaration in the same source part. +

+ +
+
+
+
+

6. Expressions

+ +
expr-only := 
+   literal
+   | template-expr
+   | structural-constructor-expr
+   | object-constructor-expr
+   | new-expr
+   | variable-reference-expr
+   | field-access-expr
+   | optional-field-access-expr
+   | xml-attribute-access-expr
+   | annot-access-expr
+   | member-access-expr
+   | function-call-expr
+   | method-call-expr
+   | error-constructor-expr
+   | anonymous-function-expr
+   | let-expr
+   | typeof-expr
+   | unary-logical-expr
+   | nil-lifted-expr
+   | range-expr
+   | relational-expr
+   | is-expr
+   | equality-expr
+   | logical-expr
+   | conditional-expr
+   | xml-navigate-expr
+   | transactional-expr
+
+expression :=
+   expr-only
+   | type-cast-expr
+   | checking-expr
+   | trap-expr
+   | query-expr
+   | ( expression )
+
+

+For simplicity, the expression grammar is ambiguous. The following table shows +the various types of expression in decreasing order of precedence, together with +associativity. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OperatorAssociativity
+m:x +
+x.k +
+x.@a +
+f(x) +
+x.f(y) +
+x[y] +
+new T(x) +
++x +
+-x +
+~x +
+!x +
+<T> x +
+typeof x +
+check x +
+checkpanic x +
+x * y +
+x / y +
+x % y +
left
+x + y +
+x - y +
left
+x << y +
+x >> y +
+x >>> y +
left
+x ... y +
+x ..< y +
non
+x < y +
+x > y +
+x <= y +
+x >= y +
+x is y +
+x !is y +
non
+x == y +
+x != y +
+x === y +
+x !== y +
left
x & yleft
x ^ yleft
+x | y + left
x && yleft
x || yleft
x ?: yright
x ? y : zright
+(x) => y +
+let x = y in z +
+from x in y select z +
+trap x +
right
+
+

6.1 Expression evaluation

+

+When the evaluation of an expression completes normally, it produces a result, +which is a value. The evaluation of an expression may also complete abruptly. +There are two kinds of abrupt completion: check-fail and panic. With both kinds +of abrupt completion there is an associated value, which always has basic type +error. +

+

+The following sections describes how each kind expression is evaluated, assuming +that evaluation of subexpressions complete normally. Except where explicitly +stated to the contrary, expressions handle abrupt completion of subexpressions +as follows. If in the course of evaluating an expression E, the evaluation of +some subexpression E1 completes abruptly, then the evaluation of E also +completes abruptly in the same way as E1. +

+
+
+

6.2 Static typing of expressions

+

+A type is computed for every expression at compile time; this is called the +static type of the expression. The compiler and runtime together guarantee that +if the evaluation of an expression at runtime completes normally, then the +resulting value will belong to the static type. A type is also computed for +check-fail abrupt completion, which will be a (possibly empty) subtype of error; +however, for panic abrupt completion, no type is computed. +

+

+It is an error if the static type of an expression is never, except +in cases where the expression is one that this specification explicitly permits +to have static type never and the expression occurs in a context +where this specification explicitly permits an expression with static type +never to occur. +

+

+The detailed rules for the static typing of expressions are quite elaborate and +are not yet specified completely in this document. +

+ +
+

6.2.1 Lax static typing

+

+In some situations it is convenient for static typing to be less strict than +normal. One such situation is when processing data in Ballerina using a static +type that is less precise than the type that the data is in fact expected to +belong to. For example, when the Ballerina json type is used for +the processing of data in JSON format, the Ballerina static type will not +capture the constraints of the particular JSON format that is been processed. +

+

+Ballerina supports this situation through the concept of lax static typing, +which has two parts: the first part is that a type descriptor can be classified +as lax; the second part is that particular kinds of expression can have less +strict static typing rules when the static type of a subexpression is described +by a lax type descriptor. With these less strict rules, a potential type error +that would have been a compile-time error according to the normal strict static +typing rules would instead be allowed at compile-time and result in an error +value at runtime; the effect is thus that some static type-checking is instead +done dynamically. +

+

+In this version of Ballerina, only the first step has been taken towards +supporting this concept. There is a fixed set of type descriptors that are +classified as lax: specifically json is lax, and +map<T> is lax if T is lax. The only kinds of expression for +which lax typing rules are specified are field-access-expr, +optional-field-access-expr and checking-expr. +

+ +
+
+

6.2.2 Contextually expected type

+

+For a context in which an expression occurs, there may be a type descriptor that +describes the static type that the expression is expected to have. This is +called the contextually expected type. For example, if a variable is +declared by a type descriptor TD, then TD will be the contextually expected type +for the expression initializing the variable. A type descriptor must be +resolved before it can be used to provide a contextually expected type.

+

+Many kinds of expression that construct values use the contextually expected +type to determine the type of value constructed, rather than requiring the type +to be specified explicitly. For each such kind of expression, there is a set of +basic types (most often consisting of a single basic type) that the value +constructed by that kind of expression will always belong to. In this case, the +contextually expected type is narrowed by intersecting it with this set of basic +types; this narrowed type is called the applicable contextually +expected type. The narrowing is performed on the type descriptor by first +normalizing the type descriptor into a union, where each member of the union is +not a union and describes shapes from a single basic type, and then eliminating +any members of the union with the wrong basic type; if this leaves no members, +then it is a compile-time error; if it leaves a single member of the union, then +the the applicable contextually expected type is this single member, otherwise +it is a union of the remaining members. +

+

+Note the language provides a way to say that the type of a variable is to be +inferred from the static type of the expression used to initialize the variable. +In this case, there is no contextually expected type for the evaluation of the +expression. Not having a contextually expected type is different from having a +contextually expected type that allows all values. +

+
+
+

6.2.3 Precise and broad types

+

+There is an additional complexity relating to inferring types. Expressions in +fact have two static types, a precise type and a broad type. Usually, the +precise type is used. However, in a few situations, using the precise type would +be inconvenient, and so Ballerina uses the broad type. In particular, the broad +type is used for inferring the type of an implicitly typed non-final variable. +Similarly, the broad type is used when it is necessary to infer the member type +of the inherent type of a structured value. +

+

+In most cases, the precise type and the broad type of an expression are the +same. For a compound expression, the broad type of an expression is computed +from the broad type of the sub-expressions in the same way as the precise type +of the expression is computed from the precise type of sub-expressions. +Therefore in most cases, there is no need to mention the distinction between +precise and broad types. +

+

+The most important case where the precise type and the broad type are different +is literals. The precise type is a singleton type containing just the shape of +the value that the literal represents, whereas the broad type is the precise +type widened to contain the entire basic type of which it is a subtype. For +example, the precise type of the string literal "X" is the +singleton type "X", but the broad type is string. +

+
+
+

6.2.4 Singleton typing

+

+The specification of a particular kind of compound expression may say that the +static type of the result of an expression E is a type T modified by the +usual singleton typing rules. This means that when all subexpressions of +the compound expression have a singleton type, then the static type of E is a +singleton subtype of T. This subtype is computed by evaluating the expression at +compile-time with operands whose values belong to the corresponding singleton +types. +

+
+
+

6.2.5 Nil lifting

+ +
nil-lifted-expr := 
+  unary-numeric-expr
+  | multiplicative-expr
+  | additive-expr
+  | shift-expr
+  | binary-bitwise-expr
+
+

+A nil-lifted-expr supports nil lifting for its operands. This means +that the operators used in a nil-lifted-expr have two forms: an +underlying form and a lifted form. The underlying form of the operator is used +when the static type of the subexpressions for all operands does not allow nil; +this form of the operator is described in the section for each kind of operator. +The lifted form of the operator is used when the static type of the +subexpressions for one or more operands does allow nil; the semantics of this +form of the operator are derived from the underlying form as described in this +section. +

+

+A nil-lifted-expr is evaluated by evaluating the subexpressions for +every operand. If the result of any of these evaluations is nil, then the result +of the nil-lifted-expr is nil. Otherwise, the evaluation is +completed in the same way as with the underlying form of the operator. +

+

+The static types of the operand subexpressions with nil removed must be valid +for the underlying form of the operator. The static type of the +nil-lifted-expr is T?, where T is what the static type +of the nil-lifted-expr would be if nil was removed from the static +type of the operand subexpressions, except that the usual singleton typing rules are not applied in computing +T. (The singleton typing rules are applied to the static types before the +removal of nil and thus have no effect, because the lifted form of the operator +is never applicable when all operands have singleton type.) +

+ +
+ +
+

6.2.6 Isolated expressions

+

+Ballerina defines requirements for when an expression is isolated. If +an expression meets the requirements, then it is compile-time guaranteed that +the value of the expression will be an isolated root and will not be aliased. +

+

+If the static type of an expression is immutable, i.e. a subtype of +readonly, or an isolated object, i.e. a subtype of isolated +object {}, then the expression is isolated. +

+

+Also, an expression of one of the following syntactic kinds is isolated if all +its subexpressions are isolated (regardless of its static type): +

+
    +
  • list-constructor-expr
  • +
  • table-constructor-expr
  • +
  • mapping-constructor-expr
  • +
  • template-expr
  • +
  • type-cast-expr
  • +
  • checking-expr
  • +
  • trap-expr
  • +
  • conditional-expr
  • +
+

+The section for each kind of expression will describe any alternative conditions +under which that kind of expression is also isolated. +

+
+
+
+

6.3 Casting and conversion

+

+Ballerina makes a sharp distinction between type conversion and type casting. +

+

+Casting a value does not change the value. Any value always belongs to multiple +types. Casting means taking a value that is statically known to be of one type, +and using it in a context that requires another type; casting checks that the +value is of that other type, but does not change the value. +

+

+Conversion is a process that takes as input a value of one type and produces as +output a possibly distinct value of another type. Note that conversion does not +mutate the input value. +

+

+Ballerina always requires programmers to make conversions explicit, even between +different types of number; there are no implicit conversions. +

+
+
+

6.4 Constant expressions

+ +
const-expr := 
+   literal
+   | template-expr
+   | structural-constructor-expr
+   | constant-reference-expr
+   | type-cast-expr
+   | unary-logical-expr
+   | nil-lifted-expr
+   | range-expr
+   | relational-expr
+   | is-expr
+   | equality-expr
+   | logical-expr
+   | conditional-expr
+   | ( const-expr )
+
+

+A value resulting from the evaluation of a const-expr always has +its read-only bit on. +

+

+Within a const-expr, any nested expression must also be a +const-expr. +

+ +
constant-reference-expr := variable-reference-expr
+
+

+A constant-reference-expr must reference a constant defined with +module-const-decl. +

+

+A const-expr is evaluated at compile-time. Constructors called +within a const-expr construct their values as immutable. Note that +the syntax of const-expr does not allow for the construction of error values. +The result of a const-expr is always immutable. +

+ +
simple-const-expr :=
+  nil-literal
+  | boolean-literal
+  | [Sign] int-literal
+  | [Sign] floating-point-literal
+  | string-literal
+  | constant-reference-expr
+
+

+A simple-const-expr is a restricted form of const-expr used in contexts where +various forms of constructor expression would not make sense. Its semantics are +the same as a const-expr. +

+
+
+

6.5 Literals

+ +
literal :=
+   nil-literal
+   | boolean-literal
+   | numeric-literal
+   | string-literal
+   | byte-array-literal
+numeric-literal := int-literal | floating-point-literal
+
+

+A numeric-literal represents a value belonging to one of the basic types int, +float or decimal. The basic type to which the value belongs is determined in +three stages. +

+
    +
  1. The syntactic form of numeric literal determines which of int, float and +decimal are candidates: +
      +
    • if the numeric-literal includes a FloatTypeSuffix or is a +HexFloatingPointLiteral, then the the only candidate is float;
    • +
    • if the numeric-literal includes a DecimalTypeSuffix, then the +only candidate is decimal;
    • +
    • otherwise, if the numeric-literal is a floating-point-literal, +the candidates are float and decimal;
    • +
    • otherwise, all three basic types are candidates.
    • +
    +
  2. +
  3. Any candidate basic type N such that the intersection of N with the +contextually expected type is empty is eliminated, unless this would eliminate +all candidates remaining after the first stage.
  4. +
  5. From remaining candidates, the first in the order int, float, decimal is +selected.
  6. +
+

+The precise type of a numeric-literal is the singleton type containing just the +shape of the value that the numeric-literal represents. The broad type is +the basic type of which the precise type is a subset. +

+ +
byte-array-literal := Base16Literal | Base64Literal
+Base16Literal := base16 WS ` HexGroup* WS `
+HexGroup := WS HexDigit WS HexDigit
+Base64Literal := base64 WS ` Base64Group* [PaddedBase64Group] WS `
+Base64Group :=
+   WS Base64Char WS Base64Char WS Base64Char WS Base64Char
+PaddedBase64Group :=
+   WS Base64Char WS Base64Char WS Base64Char WS PaddingChar
+   | WS Base64Char WS Base64Char WS PaddingChar WS PaddingChar
+Base64Char := A .. Z | a .. z | 0 .. 9 | + | /
+PaddingChar := =
+WS := WhiteSpaceChar*
+
+

+Let N be number of bytes encoded by the Base16Literal or Base64Literal. If the +applicable contextually expected type is a subtype of readonly or if the +byte-array-literal occurs within a const-expr, then the literal constructs a +list value with its read-only bit set; in this case, the static type of the +byte-array-literal is a singleton subtype of readonly & +byte[N]. Otherwise, the static type of byte-array-literal is +byte[N], and the inherent type of the list value created is also +byte[N]. +

+
+
+

6.6 Template expressions

+

+Template expressions make use of strings enclosed in backticks with interpolated +expressions. +

+
BacktickString :=
+  ` BacktickItem* Dollar* `
+BacktickItem :=
+   BacktickSafeChar
+   | BacktickDollarsSafeChar
+   | Dollar* interpolation
+interpolation := ${ expression }
+BacktickSafeChar := ^ ( ` | $ )
+BacktickDollarsSafeChar :=  $+ ^ ( { | ` | $)
+Dollar := $
+
+ +
template-expr := 
+   string-template-expr
+   | xml-template-expr
+   | tagged-data-template-expr
+   | raw-template-expr
+
+ +
+

6.6.1 String template expression

+ +
string-template-expr := string BacktickString
+
+

+A string-template-expr interpolates the results of evaluating +expressions into a literal string. The static type of the expression in each +interpolation must be a subtype of +boolean|int|float|decimal|string. Within a +BacktickString, every character that is not part of an +interpolation is interpreted as a literal character. A +string-template-expr is evaluated by evaluating the expression in each +interpolation in the order in which they occur, and converting the result of the +each evaluation to a string using the ToString abstract +operation with the direct style. The result of evaluating the +string-template-expr is a string comprising the literal characters +and the results of evaluating and converting the interpolations, in the order in +which they occur in the BacktickString. +

+

+The static type of the result of the string-template-expr is +string, modified by the usual singleton +typing rules. +

+

+A literal ` can be included in string template by using an +interpolation ${"`"}. +

+
+
+

6.6.2 XML template expression

+ +
xml-template-expr := xml BacktickString
+
+

+An XML template expression constructs an xml value as follows: +

+
    +
  1. The backtick string is parsed to produce a string of literal characters with +interpolated expressions
  2. +
  3. The result of the previous step is parsed as XML content. More precisely, it +is parsed using the production content in the W3C XML +Recommendation. For the purposes of parsing as XML, each interpolated expression +is interpreted as if it were an additional character allowed by the CharData and +AttValue productions but no other. The result of this step is an XML Infoset +consisting of an ordered list of information items such as could occur as the +[children] property of an element information item, except that interpolated +expressions may occur as Character Information Item or in the [normalized value] +of an Attribute Information Item. Interpolated expressions are not allowed in +the value of a namespace attribute.
  4. +
  5. This infoset is then converted to an xml value, as described in the XML type section, together with an ordered list of interpolated +expressions, and for each interpolated expression a position within the XML +value at which the value of the expression is to be inserted.
  6. +
  7. The static type of an expression occurring in an attribute value must be a +simple type and must not be nil. The static type type of an expression occurring +in content can either be xml or a non-nil simple type.
  8. +
  9. When the xml-template-expr is evaluated, the interpolated expressions are +evaluated in the order in which they occur in the BacktickString, +and converted to strings if necessary. A new copy is made of the xml value and +the result of the expression evaluations are inserted into the corresponding +position in the newly created xml value. This xml value is the result of the +evaluation. The contextually expected type for an interpolated expression that +occurs within an Attribute Information Item is string, and otherwise is xml; +this ensures that a query expr will work as expected. Note that if the static +type is not a subtype of the contextually expected type, it is not an error: +rather the value will be converted to a string.
  10. +
+

+An xml-template-expr occurring within a const-expr will construct an xml value +that has its read-only bit on. +

+
+ +
+

6.6.3 Tagged data template expression

+ +
tagged-data-template-expr := data-tag BacktickString
+data-tag := identifier
+
+

+A tagged-data-template-expr with data tag t constructs a tagged data +value of the basic type corresponding to t. The data-tag identifier +must be the name of a data tag by this specification or the Ballerina platform. +

+

+The BacktickString is parsed in two stages: +

+
    +
  1. the BacktickString is parsed resulting in a sequence of literal characters +and interpolations, represented as an array of n expressions, one for +each interpolation, and an array of n + 1 strings, where the +interpolations occur between the strings;
  2. +
  3. the array of strings is parsed using the abstract parsing function defined +for the data tag; it is a compile-time error if the abstract parsing function +returns an error.
  4. +
+

+The static type of the expression in an interpolation must be the data tag's +basic type. When the tagged-data-template-expr is evaluated, each expression in +an interpolation is evaluated in order. The result of evaluating the +tagged-data-template-expr is the result of applying the function that was +created by the abstract parsing function at compile-time to the values resulting +from the evaluation of these expressions. Note that the result of evaluating a +tagged-data-template-expr cannot be an error. +

+ +
+ + +
+

6.6.4 Raw template expression

+ +
raw-template-expr := BacktickString
+
+

+A raw-template-expr constructs an object belonging to the abstract RawTemplate +object type. +

+

+A raw-template-expr is evaluated by +

+
    +
  • constructing an array v whose members are the result of +evaluating each interpolation's expression in the order in which they occur in +the BacktickString;
  • +
  • constructing an object with two fields +
      +
    • an insertions field with value v +
    • +
    • a strings field consisting of a read-only array of strings +containing the characters in BacktickString outside of interpolations, split at +the interpolation points; the length of the this array is one more than the +length of v.
    • +
    +
  • +
+

+The result of the raw-template-expr is the newly constructed object. +

+

+For each raw-template-expr there is a separate class, which +is a subtype of the RawTemplate type. The objects constructed by a +raw-template-expr belong to this class. The type of the +insertions field is determined from the contextually expected type +or the static type of the expressions in the BacktickString in the same way as +with a list-constructor-expr. The strings and +insertions fields will be read-only if required by the contextually +expected type. The value of the strings field is constructed once +by the class. The value of the insertions is +constructed once for each evaluation of the raw-template-expr. +

+ +
+
+ +
+

6.7 Structural constructors

+

+Each basic type of structure has its own expression syntax for constructing a +value of the type. +

+
structural-constructor-expr := list-constructor-expr | table-constructor-expr | mapping-constructor-expr
+
+ +

+An structural-constructor-expr occurring within a const-expr will construct a +structural value that has its read-only bit on. +

+ +
+

6.7.1 List constructor

+ +
list-constructor-expr := [ [ list-member-list ] ]
+list-member-list := list-member (, list-member)*
+list-member := single-list-member | spread-list-member
+single-list-member := expression
+spread-list-member := spread | aggregated-variable-reference
+spread := ... expression
+
+

+A list-constructor-expr creates a new list value. It is a compile-time error if +the static type of the expression in a spread in a spread-list-member is not a +subtype of list. The list is constructed by processing each list-member in the +order specified as follows. If the list-member is a single-list-member, then the +expression in the list-member is first evaluated resulting in a value +v and v is added to the list being constructed. If the +list-member is a spread, then the expression in the spread is evaluated and each +member of the resulting list is added in order to the list being constructed. An +aggregated-variable-reference is handled like the equivalent spread. +

+

+If there is a contextually expected type, then the inherent type of the newly +created list is derived from the applicable contextually expected type. If the +applicable contextually expected type is a list type descriptor, then that used +as the inherent type. If the applicable contextually expected type is a union +type descriptor, then it is a compile-time error unless there is exactly one +member of the union that is a list type descriptor and that allows list shapes +of a length that the static types of the expressions in the list-member-list +make it possible for the constructed list to have; this list type descriptor is +used as the inherent type. If there is a spread, and the type of its +expression is not fixed length, then the minimum of the total number of members +that may be added to the list being constructed by this spread-list-member and +any previous list-member must be greater than or equal to the minimum length +required by the inherent type. The static type of the list-constructor-expr will +be the same as the inherent type. +

+

+If there is no contextually expected type, then the inherent type will be a +tuple-type-descriptor derived from the static type of each expression in the +list-member-list. Each single-list-member that does not have a preceding +spread-list-member contributes a member-type-descriptor to the +tuple-type-descriptor; the type of the member-type-descriptor will be the broad +type of the expression in the single-list-member. If there is a +spread-list-member, then a tuple-rest-descriptor T... is added +where T is the smallest type such that the broad type of the expression in every +other single-list-member is a subtype of T, and the type of the +expression in each spread-list-member is a subtype of T[]. +

+

+If the list-constructor-expr does not have a contextually expected type, then +the contextually expected type for the expression in a spread-list-member is +(any|error)[], and the expression in a single-list-member does not +have a contextually expected type. Otherwise the contextually expected type for +each list-member is derived from the contextually expected type of the +list-constructor-expr. If there is a spread-list-member that is not the last +list-member in the list-member-list, then the contextually expected type used +from that point on is approximated with a tuple-rest-descriptor. +

+

+A member of a list can be filled in automatically if the FillMember abstract operation would succeed on it. The +inherent type of a list establishes either a fixed length for the list or just a +minimum length for the list, which may be zero. In either case, a list +constructor may specify only the first k members, provided that for +each i from k + 1 up to the fixed length of the list, the +i-th member can be filled in automatically. +

+ +
+
+

6.7.2 Mapping constructor

+ +
mapping-constructor-expr := { [field (, field)*] }
+field := 
+  specific-field
+  | computed-name-field
+  | spread-field
+specific-field :=
+   [readonly] (field-name | string-literal) : value-expr
+   | [readonly] variable-name
+value-expr := expression
+computed-name-field := [ field-name-expr ] : value-expr
+field-name-expr := expression
+spread-field := spread
+
+

+A mapping-constructor-expr creates a new mapping value. +

+

+A specific-field specifies a single field, where the field name is known at +compile-time. A specific-field that consists of just a variable name +x is equivalent to a field x: +x. +

+

+The static type of the expression in a spread-field must allow only mapping +values, i.e. must be a subtype of map<any|error>. All the +fields of the mapping value that results from evaluating that expression are +included in the mapping value being constructed. It is a compile-time error if +the static type of the expression in a spread-field allows a field that +duplicates a specific-field or that could also occur in another spread-field. +Note that a spread-field with an inclusive record type of record { never +x?; } cannot duplicate a specific field for x. +

+

+If there is a contextually expected type, then the inherent type of the newly +created mapping is derived from the applicable contextually expected type. If +the applicable contextually expected type is a mapping type descriptor, then +that used as the inherent type. If the applicable contextually expected type is +a union type descriptor, then any members of the union that are inconsistent +with the field names specified in a specific-field in the +mapping-constructor-expr will be ignored; it is a compile-time error if this +does not leave a single mapping type descriptor, which is then used as the +inherent type. The static type of the mapping-constructor-expr will be the same +as the inherent type. +

+

+If there is no contextually expected type, then the inherent type will be an +exclusive-record-type-descriptor with an individual-field-descriptor for each +specific-field; the type of each field-descriptor will be the broad type of the +value-expr in the field, unless the field is read-only in which case the type of +the field-descriptor will be the precise type. The static type of the expression +in every spread-field will also be added to the inherent type. If there are +fields specified as a computed-name-field, then there will also be a +record-rest-descriptor T..., where T is the union of +the broad types of the value-expr in all such fields. +

+

+If a specific-field does not use a string-literal for the name of the field and +the inherent type descriptor is a record type descriptor, then the record type +descriptor must include an individual-field-descriptor for that field. +

+

+If there is a specific-field with name x and there is a +contextually expected type that allows an x field but +does not allow a nil value for the x field, then the +static type of the value-expr for the x field may +include nil; if the result of evaluating the value-expr is nil, then no field +will be added to the constructed value. +

+

+Default values are added to the mapping value being constructed after fields +have been added for every specific-field and spread-field: if the inherent type +descriptor is a record type descriptor, then for each field-descriptor with name +f having a default-expression, if the mapping value so far +constructed does not have a field with name f, then the closure for +the default-expression is evaluated resulting in a value v, and +a field with name f and value v is added to the mapping +value. +

+

+If there is a contextually expected type, then the type that the inherent type +requires for each field provides the contextually expected type for the +value-expr in a field; otherwise there is no contextually expected type for the +value-expr for fields. If there is a contextually expected type, the +contextually expected type for the expression in a spread-field is map<T>, +where the T is the smallest type such that the inherent type is a subtype of +map<T>. The contextually expected type for a field-name-expr is string. +

+

+A computed-name-field specifies a single field, where the name of the field is +specified by an expression enclosed in square brackets. A +mapping-constructor-expr first constructs a mapping value without considering +any computed-name-field. The effect of a computed-name-field is to modify the +member of the mapping with the specified name after the mapping has been +constructed. If the modification is incompatible with the inherent type, then +the mapping-constructor-expr will panic. The modifications are performed in the +order in which the computed-name-fields occur in the mapping-constructor-expr. +

+

+When the inherent type is equivalent to a map-type-descriptor, the order in +which fields are added to mapping value being constructed (and thus the +iteration order of the fields) is the same as the order of the fields in the +mapping-constructor-expr, except that all fields specified by a +computed-named-field are added after all other fields. +

+

+If the applicable contextually expected type is a subtype of readonly, then the +mapping will be constructed with its read-only bit on. If the inherent type +makes a specific field readonly, then that field will be constructed with its +read-only bit on. A specific-field that starts with readonly will +also be constructed with its read-only bit on. The read-only bit of the +mapping value or field will be set only after the mapping value has been fully +constructed, including any field specified by a computed-name-field. +

+ +
+
+

6.7.3 Table constructor

+ +
table-constructor-expr := table [key-specifier] [ [row-list] ]
+row-list := mapping-constructor-expr (, mapping-constructor-expr)*
+
+

+A table-constructor-expr creates a new table value. The members of the table +come from evaluating each mapping-constructor-expr in the row-list in order. +

+

+For example, +

+ +
table key(email) [
+   { email: "sanjiva@weerawarana.org", firstName: "Sanjiva", lastName: "Weerawarana" },
+   { email: "jjc@jclark.com", firstName: "James", lastName: "Clark" }
+]
+
+

+The inherent type of the constructed table is a table type descriptor including +a key-specifier table<T> key(ks), where +T is the member type and ks is +the key sequence. The inherent type is determined from the contextually expected +type together with the table-constructor-expr. The static type of the +table-constructor-expr will be the same as this inherent type. +

+

+If there is a contextually expected type, then the member type of inherent type +of the newly created table is derived from the applicable contextually expected +type, which must be a table-type-descriptor. If there is no contextually +expected type, then the member type of the inherent type is derived from the the +static type of the expressions for the members: the member type will be the +smallest record type that is a supertype of the static types of all the +expressions in the row-list. It is an error if there is no contextually expected +type and the row-list is empty. +

+

+The key sequence of the inherent type comes from the key-specifier of applicable +contextually expected type or the key-specifier in the table-constructor-expr. +If both of these are present, then they must be the same. If neither of them are +present, then the key sequence is empty. The key sequence of the table value is +the same as that of its inherent type. The key sequence and member type must +meet the same consistency requirements as if they were specified together in a +table type descriptor. For every field-name in the key +sequence of the inherent type every mapping-constructor-expr in the row-list +must include a specific-field that has a value-expr that is a const-expr. It is +a compile-time error if two or more rows of the table have the same key value. +

+

+If there is a contextually expected type, then the type that the inherent type +requires for each table member provides the contextually expected type for the +expressions in the row-list; otherwise there is no contextually expected type +for these expressions. +

+ +
+
+ +
+

6.8 Object construction

+

+There are two kinds of expression that can be used to construct an object: with +an object constructor expression, the methods and fields of the constructed +object are defined within the expression; with a new expression, the methods and +fields come from a separate, named class definition. +

+ +
+

6.8.1 Object constructor

+ +
object-constructor-expr :=
+   [annots] object-type-quals object [type-reference] object-constructor-block
+object-constructor-block := { object-member* }
+object-member := object-field | method-defn | remote-method-defn | resource-method-defn
+
+

+The resulting of evaluating an object-constructor-expr is an +object. The object-constructor-expr must specify +client if any method-defn includes a +remote-qual. +

+

+The annotations applying to the object-constructor-expr and its +members are evaluated when the object-constructor-expr is +evaluated. This means that every object resulting from the evaluation of an +object-constructor-expr has its own type descriptor. +

+

+If there is a type-reference, then the referenced type is included +in the object's type in the same was as an object-type-inclusion, +and the type-ids of the constructed object are type-ids of the referenced type. +If there is no type-reference, then the applicable contextually +expected type T, if any, must be definite, and the type-ids of the constructed +object are the type-ids, if any, induced by T. +

+

+The object-constructor-expr is implicitly read-only if the +applicable contextually expected type is a subtype of readonly or if the +type-reference is present and references a type that is a subtype +of readonly. If the object-constructor-expr is implicitly +read-only, then the object will be constructed with its read-only bit on; +furthermore, in this case an object-type-inclusion is allowed to +directly or indirectly reference a readonly class. +

+

+The object-constructor-expr is explicitly isolated if +object-type-quals includes isolated or if the +type-reference is present and references an isolated object type. An +object-constructor-expr that is explicitly isolated will construct +an object with its isolated bit set. +

+ +
object-visibility-qual := public|private
+
+ +

+A visibility qualifier of private can be used within an +object-constructor-expr expression; this means that the visibility +region consists of every method-defn-body in the object-constructor-expr. +

+ +
+
6.8.1.1 Fields
+
object-field :=
+   metadata [object-visibility-qual] [final]
+   type-descriptor field-name [= field-initializer] ;
+field-initializer := expression
+
+

+An object-field declares and initializes a field of the object. +

+

+If a field does not specify a field-initializer, then there must be an +init method and the init method must initialize the +field. The field-initializer must meet the requirements for an isolated function +unless the init method is present and not declared as +isolated. +If the init method is not present, +it is a compile-time error if the expression in an +individual-field-descriptor contains a checking-expr with a checking-keyword of +check, i.e. if evaluation of the expression could complete abruptly +with a check-fail. +If the object-constructor-expr is implicitly +read-only, then the contextually expected type for a field-initializer will be +the intersection of readonly and the type specified in the type-descriptor of +the object-field. +

+

+If final is present, then the field must be assigned to exactly +once, either by its initializer or in the init method. +

+

+An object-constructor-expr will construct an object with its +read-only bit set if every object-field is declared as final and +has a type-descriptor that is a subtype of readonly. In this case, +the static type of the object-constructor-expr will be intersected +with readonly. +

+

+An object field is isolated if it is declared as final and +has a type-descriptor that is a subtype of readonly or +isolated object {}, or if the object-constructor-expr +is implicitly read-only. An object-constructor-expr is +implicitly isolated if it is implicitly readonly or if every object +field is isolated. An object-constructor-expr that is implicitly +isolated will construct an object with its isolated bit set. In this case, the +static type of the object-constructor-expr will be intersected with +isolated object {}. If the object-constructor-expr is +explicitly isolated, then every field-initializer must be an +isolated expression and any field that is not isolated must be declared as +private. +

+
+ +
+
6.8.1.2 Methods
+ +
method-defn :=
+   metadata object-visibility-qual method-quals
+   function method-name function-signature method-defn-body
+
+ +

+A method-defn defines a method of an object. +

+ +
method-defn-body := function-defn-body
+
+

+Within a method-defn-body, the fields and methods of the object are +not implicitly in-scope; instead the variable self is bound to the +object and can be used to access fields and methods of the object. The +self variable is implicitly final and cannot be modified. If the +object-constructor-expr is explicitly isolated, then the +self variable must be accessed only within the scope of a lock +statement, except when self is part of a +field-access-expr of the form self.f, where +f is the name of an isolated field. +

+

+If isolated-qual is present, then the method has its isolated bit +set and its method-defn-body must satisfy the requirements for an +isolated function. +

+ +
+ +
+
6.8.1.3 Remote methods
+ +
remote-method-defn :=
+   metadata remote-method-quals
+   function remote-method-name function-signature method-defn-body
+
+

+A remote-method-defn defines a remote method. This is allowed only +when an object-network-qual is present in the +object-constructor-expr. +

+ +
+ +
+
6.8.1.4 Resources
+ +
resource-method-defn :=
+   metadata resource-method-quals
+   function resource-method-name resource-path function-signature method-defn-body
+
+ +

+A resource-method-defn defines a resource method for one or more +resources. This is allowed only when an object-network-qual is +present in the object-constructor-expr. The semantics of +resource-method-defn extends the semantics of a +resource-method-decl by associating a function with each declared +resource method. +

+

+A network interaction object uses resource-method-defns to provide +a resource access operation. The inputs to the resource access operation are a +string giving the resource method name, a list of values for the resource path, +and a list of values for the argument list. The operation looks up the function +associated with the resource method name and resource path, and then invokes the +function with the supplied argument list. +

+

+The list of values supplied for the resource path are used to bind parameters +specified in the resource-path before the function is invoked. +These parameters are in scope in the method-defn-body. A parameter +in a resource-path-segment-param will be bound to the value at the +corresponding position in the list; a parameter in a +resource-path-rest-param will be bound to a list of all the values +from the corresponding position onwards. +

+

+The resource access operation of a service object is responsible for +implementing the delegation semantics of a resource method that returns a +service object. A resource-path is delegated if it occurs +in a resource-method-defn with a resource-method-name +of get and a return value that includes a service object type that +has one or more resources. If a resource access operation has a resource path +r, which has a prefix p (which may be the entire path) +that is delegated, then the get method that provides the delegation +is first called with no arguments but with resource parameters bound as usual +resulting in a value v; if v is an error, then the result +of the resource access operation is v; otherwise a resource access +operation is performed on the v with the resource path being +r with p removed. +

+ +
+ +
+
6.8.1.5 Initialization
+

+A method-defn with a method-name of init +is used to initialize the object and is treated specially. The return type of +the init method must be a subtype of the union of error and nil, +and must contain nil; if init returns an error, it means that +initialization of the object failed. +If the evaluation of a field-initializer completes abruptly with a check-fail +with associated value v, then the init method +returns v before its method-defn-body is executed; +the return type of the init method must be consistent with this. +

+

+The parameter list of an init method within an +object-constructor-expr must be empty. +

+

+At any point in the body of a init method, the compiler +determines which fields are potentially uninitialized. A field is potentially +uninitialized at some point if that field does not have an initializer and it +is not definitely assigned at that point. It is a compile error if a +init method: +

+
    +
  • accesses a field at a point where it is potentially initialized, or
  • +
  • at a point where there is any potentially uninitialized field +
      +
    • returns nil, or
    • +
    • uses the self variable other than to access or modify the value of a field.
    • +
    +
  • +
+

+If the object-constructor-expr is explicitly isolated, then a field +can only be assigned to by an assignment-stmt with a right hand +side that is an isolated expression. The requirement to access self +within a lock statement does not apply to the init method at any +point where there is any potentially uninitialized field. +

+

+The visibility of the init method cannot be private. +

+

+Any init method is not part of the shape of an object, and so does +not affect when an object value belongs to a type. The init method +can be called in a method-call-expr only when the expression +preceding the . is self. +

+

+A missing init method is equivalent to an isolated +init method with no parameters and an empty body (which will always +return nil). +

+
+ +
+
+

6.8.2 New expression

+ +
new-expr := explicit-new-expr | implicit-new-expr
+explicit-new-expr := new class-descriptor ( arg-list )
+class-descriptor := identifier | qualified-identifier | stream-type-descriptor
+
+

+A new-expr constructs a new object or stream. The class-descriptor in an +explicit-new-expr must refer to a class or a stream type. +

+

+When the class-descriptor refers to a class, the explicit-new-expr allocates +storage for an object of the type defined by the class and initializes it by +passing the supplied arg-list to the init method defined by the +class. It is a compile error if the type-descriptor if the arg-list does not +match the signature of the class's init method. If the result of +calling the init method is an error value e, then the result of +evaluating the explicit-new-expr is e; otherwise the result is the newly +initialized object. The explicit-new-expr is isolated if the type of the +init is isolated and the expression for every argument in the +arg-list is isolated. +

+

+When the class-reference refers to a stream type stream<T,E>, +the arg-list must either be empty or be a single argument belonging to object +type StreamImplementor<T,E?>. When the arg-list is empty, the result will +be an empty stream (i.e. a stream whose next method returns nil). When the +arg-list evaluates to a StreamImplementor object, the result will be a stream +that wraps that object. The explicit-new-expr is isolated if the the arg-list is +empty or if the expression for the single argument is isolated. +

+

+An explicit-type-expr specifying a class-descriptor T has static type T, except +that if T is an class type and the type of the init method is +E?, where E is a subtype of error, then it has static type T|E. +

+
implicit-new-expr := new [( arg-list )]
+
+

+An implicit-new-expr is equivalent to an explicit-new-expr that specifies the +applicable contextually expected type as the class-descriptor. An +implicit-new-expr consisting of just new is equivalent to +new(). It is an error if the applicable contextually expected type +is not a class or stream type. +

+
+
+
+

6.9 Variable reference expression

+ +
variable-reference-expr := variable-reference
+variable-reference := identifier | qualified-identifier | xml-qualified-name
+xml-qualified-name := xml-namespace-prefix NoSpaceColon identifier
+
+

+A variable-reference can refer to a variable, a parameter, a constant (defined +with a module constant declaration), a function, a type (defined with a module +type definition) or a class (defined with a module class definition). +

+

+When the variable reference has a prefix and the prefix has been declared using +an xmlns-decl rather than an import-decl, then the result of evaluating the +variable-reference-expr is a string of the form: +

+
+   {namespace-uri}local-name
+
+

+where the namespace-uri comes from xml-namespace-uri specified in the +xmlns-decl, and the local-name comes from the identifier following the colon. +

+

+If the variable-reference references a type defined with a module type +definition or a class defined with a module class definition, then the result of +evaluating the variable-reference-expr is a typedesc value for that type or +class. +

+

+A variable-reference-expr is isolated if it refers to an identifier bound by a +let-expr to an expression that is isolated. +

+

+A variable-reference-expr that refers to a variable declared by a +module-var-decl that includes isolated is only allowed within a +lock-stmt. +

+

+A variable-reference-expr cannot refer to an aggregated variable; an aggregated variable can +be referenced only by an aggregated-variable-reference. +

+
+
+

6.10 Field access expression

+ +
field-access-expr := expression . field-name
+
+

+A field-access-expr is typically used to access a field of an object or a field +of a record. More generally, it can be used to access a member of an object or a +member of a mapping. The semantics depends on the static type T of expression. A +field-access-expr where T is a subtype of xml is interpreted as an +xml-required-attribute-access-expr. +

+

+If T is a subtype of the object basic type, then T must have a member with name +field-name. The field-access-expr is evaluated by first evaluating the +expression to get a value obj. If the member is a field, then the +result of the expression if the value of that field of obj and the +static type of the field-access-expr is the type of that field of T. If that +member is a method, then the result of the expression is a new function value +that when called will call the method with self bound to +obj; the isolated bit of the new function value is set if and only if +the isolated bits of both obj and the method are set; the type +descriptor of the new function value will have the same annotations as the type +descriptor of the method. +

+

+Let T' be the intersection of T and basic type mapping, let K be the singleton type +containing just the string field-name, and let M be the member type for K in T'. +

+

+If the following all apply: +

+
    +
  • the type descriptor for T is not lax;
  • +
  • T is a subtype of the mapping basic type (i.e. T' is the same as T);
  • +
  • K is not a required key type for T;
  • +
  • the type descriptor for T includes field-name as an +individual-field-descriptor (or, if the type descriptor is a union, at least one +member of the union does so);
  • +
  • M does not include nil;
  • +
+

+then the field-access-expr is treated as an optional-field-access-expr. +Otherwise, the rest of this section applies. +

+

+The compile-time requirements on the field-access-expr depend on whether the +type descriptor describing T is lax: +

+
    +
  • if it is lax, then the only compile-time requirement is M is non-empty;
  • +
  • if it is not lax, then T must be a subtype of the mapping basic type and K +must be a required key type for T.
  • +
+

+The static type of field-access-expr is M|E, where E is empty if K is a required +key type and T' is a subtype of T, and error otherwise (E can only be error in +the lax case.) In the lax case, if M is lax, then the static type of the +field-access-expr is lax even if E is an error. +

+

+A field-access-expr is evaluated as follows: +

+
    +
  1. expression is evaluated resulting in a value v +
  2. +
  3. if v has basic type error, the result is v (this can +only happen in the lax case)
  4. +
  5. otherwise, if v does not have basic type mapping, the result is a +new error value (this can only happen in the lax case)
  6. +
  7. otherwise, if v does not have a member whose key is field-name, +the result is a new error value (this can only happen in the lax case)
  8. +
  9. otherwise, the result is the member of v whose key is +field-name.
  10. +
+ +
+
+

6.11 Optional field access expression

+ +
optional-field-access-expr := expression ?. field-name
+
+

+An optional-field-access-expr accesses a possibly undefined mapping member, +returning () if the member does not exist. +

+

+An optional-field-access-expr where the static type of expression is +a subtype of xml is interpreted as an xml-optional-attribute-access-expr. +

+

+Let T be the static type of expression, let T' be the intersection of T and +basic type mapping, let K be the singleton type containing just the string +field-name and let M be the member type of K in T'. The compile-time +requirements on the optional-field-access-expr depend on whether the type +descriptor describing T is lax: +

+
    +
  • if it is lax, then the only compile-time requirement is that M is +non-empty;
  • +
  • if it is not lax, then, in addition, T must be a subtype of the union of +() and the mapping basic type, and the type descriptor for T must +include field-name as an individual-field-descriptor (if the type +descriptor is a union, then this requirement must be satisfied by at least one +member of the union).
  • +
+

+The static type of the optional-field-access-expr is M|N|E where +

+
    +
  • N is () if () is a subtype of T or K is not a +required key type for T', and empty otherwise;
  • +
  • E is error if T' is not a subtype of T?, and empty otherwise (E +can only be error in the lax case).
  • +
+ +

+An optional-field-access-expr is evaluated as follows: +

+
    +
  1. expression is evaluated resulting in a value v +
  2. +
  3. if v is (), the result is () +
  4. +
  5. otherwise, if v has basic type error, the result is v +(this can only happen in the lax case)
  6. +
  7. otherwise, if v does not have basic type mapping, the result is a +new error value (this can only happen in the lax case)
  8. +
  9. otherwise, if v does not have a member whose key is field-name, +the result is () +
  10. +
  11. otherwise, the result is the member of v whose key is +field-name.
  12. +
+ +
+ +
+

6.12 XML attribute access expression

+ +
xml-attribute-access-expr := xml-required-attribute-access-expr | xml-optional-attribute-access-expr
+xml-required-attribute-access-expr := expression . xml-attribute-name
+xml-optional-attribute-access-expr := expression ?. xml-attribute-name
+xml-attribute-name := xml-qualified-name | qualified-identifier | identifier
+
+ +

+An XML attribute access expression provides convenient access to an attribute of +an XML element. It is a compile-time requirement that the static type of the +expression is a subtype of xml. +

+

+A string representing the name of the attribute is computed at compile-time from +the xml-attribute-name. When the xml-attribute-name is an identifier without a +prefix, the attribute name string is the identifier. When the xml-attribute-name +has a prefix, normally the xml-attribute-name is an xml-qualified-name, in which +the prefix is an xml-namespace-prefix declared using an xmlns-decl. In this +case, the xml-qualified-name is expanded at compile-time into an attribute name +string of the form +

+
+   {namespace-uri}local-name
+
+

+where the namespace-uri comes from xml-namespace-uri specified in the +xmlns-decl, and the local-name comes from the identifier following the colon. +

+

+It is also allowed for the xml-attribute-name to be specified as a +qualified-identifier, in which the prefix is a module-prefix declared using an +import-decl. In this case the qualified-identifier must refer to a +module-const-decl of type string, and the attribute name string is the value of +the referenced constant. This allows e.g. xml:lang to work. +

+

+An xml-optional-attribute-access-expr is evaluated as follows. The expression is +evaluated resulting in an xml value v. If v is an empty +xml value, the result is (). Otherwise, if v is not a +singleton element, the result is an error. Otherwise, let m be that +element's attribute map and let k be the attribute name string +computed at compile-time from the xml-attribute-name. If m has a +member s with key k, the the result is s. +Otherwise, the result is (). +

+

+An xml-required-attribute-access-expr is evaluated the same as an +xml-optional-attribute-expr, except that for cases where the result of the +xml-optional-attribute-expr would be (), the result of the +xml-required-attribute-access-expr is an error. +

+

+The static type of an xml-required-attribute-access-expr is +string|error The static type of an +xml-optional-attribute-access-expr is string|error|(). +

+ +
+
+

6.13 Annotation access expression

+ +
annot-access-expr := expression .@ annot-tag-reference
+
+

+The annot-tag-reference must refer to an annotation tag declared with an +annotation declaration. The static type of expression must be a subtype of +typedesc. +

+

+An annot-access-expr is evaluated by first evaluating +expression resulting in a typedesc value t. If t +has an annotation with the tag referenced by annot-tag-reference, +then the result of the annot-access-expr is the value of that +annotation; otherwise, the result is nil. +

+

+The static type of the annot-access-expr is T? where T is the type +of the annotation tag. +

+
+
+

6.14 Member access expression

+ +
member-access-expr := container-expression [ (key-expression | multi-key-expression) ]
+container-expression := expression
+key-expression := expression
+multi-key-expression := expression (, expression)+
+
+

+A member-access-expr accesses a member of a structured value using its key, +or a constituent of a sequence value using its index. +

+

+The requirements on the static type of container-expression and key-expression are as +follows: +

+
    +
  • if the static type of container-expression is a subtype of string or of xml +or of basic type list, then the contextually expected type for key-expression is +int and the static type of key-expression must be a subtype of int;
  • +
  • if the static type of container-expression is a subtype of table, then the +contextually expected type for key-expression is K and +the static type of key-expression must be a subtype of +K, where the static type of container-expression is +table<R> key<K>;
  • +
  • otherwise the static type of container-expression must be a subtype of the +union of nil and basic type map; in this case the contextually expected type for +key-expression is string and the static type of key-expression must be a subtype +of string.
  • +
+

+A multi-key-expression is allowed only when the static type of a +container-expression is a subtype of table. A multi-key-expression +E1, E2,..., En is equivalent to a +list-constructor-expr [E1, E2,..., +En]. +

+ +

+A member-access-expr is evaluated as follows: +

+
    +
  1. the container-expression is evaluated to get a value c;
  2. +
  3. the key-expression is evaluated to get a value k;
  4. +
  5. depending on the basic type of c +
      +
    • if it is string, and k is < 0 or ≥ the length of +c, then the evaluation completes abruptly with a panic; otherwise, +the result is a string of length 1 containing the character with index +k in c;
    • +
    • if it is xml, and k is < 0, then the evaluation completes +abruptly with a panic; if k is ≥ the length of c, then +the result is an empty xml value; otherwise, the result is a singleton xml +value containing the item with index k in c;
    • +
    • if it is list, and k is < 0 or ≥ the length of +c, then the evaluation completes abruptly with a panic; otherwise, +the result is the member of c with index k;
    • +
    • if it is table, then if c does not contain a member with key +k, the result is (); otherwise, the result is the member +of c with key k.
    • +
    • if it is mapping, then if c is () or c +does not contain a member with key k, the result is (); +otherwise, the result is the member of c with key k.
    • +
    +
  6. +
+

+Let T the static type of container-expression. If T is a subtype of string, then +the static type of the member-access-expr is string:Char, that is the subtype of +strings containing strings of length 1. If T is a subtype of xml<M>, then +the static type of the member-access-expr is M|E, where E is the type of the +empty xml value. If T is a subtype of table<R>, then the static type of +member-access-expr is R?. Otherwise, let K be the static type of key-expression +and let M be the member type of K in T; if T contains nil, or T is a subtype of +mapping and K is an optional key type for T, then the static type of the +member-access-expr is M?, otherwise the static type is M. +

+ +
+
+

6.15 Function call expression

+ +
function-call-expr := function-reference ( arg-list )
+function-reference := variable-reference
+arg-list :=
+   positional-args [, other-args]
+   | [other-args]
+other-args := named-args | rest-arg
+
+

+A function-call-expr is evaluated by constructing an argument list and passing +the argument list to the function referred to by the variable-name. The argument +list will be used to bind the parameters of the function before the body of the +function is executed. If the function terminates normally, then the result of +the function-call-expr is the return value of the function; otherwise the +function-call-expr completes abruptly with a panic. The static type of the +function-call-expr is the return type of the function type; this type is +permitted to be never. +

+

+The function-reference must refer to a variable with function type. The type +descriptor of that function type is used to construct an argument list from the +specified arg-list. Note that it is the type descriptor of the declared type of +the variable that is used for this purpose, rather than the runtime type +descriptor of the referenced function value. The expressions occurring in the +arg-list are evaluated in the order in which they occur in the arg-list; the +contextually expected type for the expression comes from the static type +required for the expression as specified below. +

+

+If the function-reference is an unqualified identifier +f, the arg-list has a rest-arg and no positional-args, +and the rest-arg is an aggregated-variable-reference of type T, then the +function-reference is treated as referring to a function +f in a module lang.M of the lang library, where M is +selected as follows. +

+
    +
  • If T is a subtype of B[], where B is a basic type with with corresponding +langlib module lang.B and the module lang.B contains a function +f, then M is B. The module corresponding to each basic +type is listed in the Lang library modules +section.
  • +
  • Otherwise, M is value.
  • +
+

+In this case, if the langlib function requires at least one argument, but T +allows the empty list, then the evaluation of the function-call-expr will first +check whether the aggregated-variable-reference refers to an empty list, and, if +so, the result of the function-call-expr will be nil; the return type of the +langlib function will accordingly be unioned with nil. +

+
positional-args := positional-arg (, positional-arg)*
+positional-arg := expression
+
+

+The result of evaluating the i-th positional-arg becomes the +i-th member of the argument list. The static type of the expression +for the i-th positional-arg must be a subtype of the type declared +for the i-th parameter that is not a rest-param, if there is such a +parameter; otherwise, there must be a rest-param and the static type must be a +subtype of the type declared for the rest-param. +

+
named-args := named-arg (, named-arg)*
+named-arg := arg-name = expression
+arg-name := identifier
+
+

+The arg-name of every named-arg must be distinct. Each named-arg must correspond +to either a parameter that is not a rest-param or to a field of an +included-record-param. In the latter case, there are two possibilities. +

+
    +
  • The field is described by an individual-field-descriptor with a type that is not +never.
  • +
  • The field is described by a record-rest-descriptor, either explicitly as +part of an exclusive-record-type-descriptor or implicitly as part of an +inclusive-record-type-descriptor. In this case: +
      +
    • for every parameter name and every individual-field-descriptor of an +included-record-param with a type that is not never, the +record-type-descriptor must include an individual-field-descriptor that has type +never and is optional, and so disallows a field with that +name;
    • +
    • the record-type-descriptor must not include any other +individual-field-descriptor; and
    • +
    • there must be no other included-record-param with a +record-rest-descriptor.
    • +
    +
  • +
+

+It is an error if there is a named-arg and a positional-arg that correspond to +the same parameter. If there is a named-arg or positional-arg corresponding to +an included-record-param, it is an error for a named-arg to specify a field of +that included-record-param. The static type of the expression of the named-arg +must be a subtype of the type declared for the corresponding parameter or +field-descriptor. +

+
rest-arg := spread | aggregated-variable-reference
+
+

+The static type of the expression in a spread in a rest-arg must be either a +list type or a mapping type. If it is a list type, then the rest-arg is +equivalent to specifying each member of the list as a positional-arg. If it is a +mapping type, then the rest-arg is equivalent to specifying each field of the +mapping as a named-arg, with the name and value of the named-arg coming from the +name and value of the field. In either case, the static type of the expression +must be such as to ensure that the equivalent named-args or positional-args +would be valid. An aggregated-variable-reference is handled like the equivalent spread. +

+

+If there is neither a named-arg nor a positional-arg for a parameter that is not +a rest-param, then a default value is computed for the parameter, if possible; +otherwise, it is an error. Default values are computed in parameter declaration +order. +

+
    +
  • If the parameter is a required-param, it is an error.
  • +
  • If the parameter is a defaultable-param, then the value for the parameter is +computed from the default value in the function's type descriptor. +
      +
    • If the default value for a defaultable-param was specifed +using an expression, then it is computed by calling the closure stored in the +type descriptor, passing it the previous arguments in the argument list.
    • +
    • If the default value for a defaultable-param was specified as +<>, then the value for the parameter will be a typedesc value +determined at compile-time from the contextually expected type of the +function-call-expr as follows. Let the name of the parameter for which a default +of <> was specified be t. Let the type of +t be typedesc<T>. Let the return type descriptor for +the function be R, which will have references to t. Let +the contextually expected type for the function-call-expr be C. Then +the default value is found by unifying C and R: the +default value is a typedesc value that describes the maximal type S, +such that S is a subtype of T, and R with +S substituted for t is a subtype of C.
    • +
    +
  • +
  • If the parameter is an included-record-param, then a new mapping value is +constructed for it using its record-type-descriptor. The mapping value will have +a field for each named-arg that corresponds to a field of this +included-record-param, with the name and value of the field coming from the name +and value of the named-arg. The mapping value will also have a field for each +individual-field-descriptor with a default-expr for which there was no +corresponding named-arg. It is an error if the record-type-descriptor has an +individual-field-descriptor that is not optional and has no default and there is +not corresponding named-arg.
  • +
+

+A function-call-expr is isolated if the type of the function being called is +isolated and the expression for every argument is isolated. In addition, a call +to the clone or cloneReadOnly functions defined by the +lang.value module of the lang library is always isolated. +

+

+When there is a need to call a function value resulting from the evaluation of +an expression, the result of the expression evaluation can be assigned to a +variable and then the function called by using a reference to the variable. +

+
+
+

6.16 Method call expression

+ +
method-call-expr := expression . method-name ( arg-list )
+
+

+A method-call-expr either calls an object's method, calls an +object's field where the type of the field is a function or calls a function in +the lang library. The static type of the method-call-expr is the return type of +the function type of the function that is called; this type is permitted to be +never. The evaluation of the method-call-expr starts by evaluating +expression resulting in some value v. There is no +contextually expected type for expression. +

+

+If the static type of expression is a subtype of object, and the +object type includes a method named method-name, then the +method-call-expr is executed by calling that method on +v. The arg-list is used to construct an argument list +that is passed to the method in the same way as with a +function-call-expr. A method-call-expr cannot be used +to call a remote method. A remote method of a client object can be called by a +client-remote-method-call-action. In this case, a method-call-expr +is isolated if the expression preceding . is isolated, the +expression for each argument in the arg-list is isolated and the type of the +method being called is isolated. +

+

+Otherwise, if the static type of expression is a subtype of object, +and the object type includes a field named method-name with a +function type, then the method-call-expr is executed by calling the +value of that field. The arg-list is used to construct an argument +list that is passed to the method in the same way as with a +function-call-expr. In this case, a method-call-expr is isolated if +the type of the function is isolated and the expression for each argument in the +arg-list is isolated. +

+

+Otherwise, the method-call-expr will be turned into a call to a +function in the lang library m:method-name(expression, arg-list), +where m is an automatically created module prefix for a module lang.M of the lang +library, where M is selected as follows. +

+
    +
  • If the static type of expression is a subtype of basic type +with corresponding langlib module lang.B and the module lang.B contains a +function method-name, then M is B. The module corresponding to each +basic type is listed in the Lang library +modules section.
  • +
  • Otherwise, M is value.
  • +
+

+It is a compile-time error if the resulting function call does not satisfy all +the constraints that would apply if it has been written explicitly as a +function-call-expr. The method-call-expr expression is +isolated under the same conditions that the corresponding +function-call-expr would be isolated. +

+
+
+

6.17 Error constructor

+ +
error-constructor-expr := error [error-type-reference] ( error-arg-list )
+error-arg-list := positional-arg [, positional-arg] (, named-arg)*
+
+

+An error constructor constructs a new error value. If an error-type-reference is +specified, it must denote a type that is a subtype of error; the effect is the +same as making the contextually expected type be that specified by the +error-type-reference. If there is no applicable contextually expected type, then +it is the same as if there were a contextually expected type of +error. +

+

+The applicable contextually expected type E must be definite. The type-ids of +the constructed error value are those induced by E. Note that it is allowed for +E to refer to an intersection-type-descriptor. +

+

+The first positional-arg is of type string and specifies the error message; the +second positional-arg, if present, is of type error?, with a +default of nil, and specifies the cause. +

+

+Evaluating the error-constructor-expr constructs a new detail mapping. Each +named-arg specifies a field of the error detail mapping; the static type of each +named-arg must be a subtype of value:Cloneable. The type descriptor +E implies a type descriptor D for the detail mapping. The arg-name of every +named-arg must be specified as the field-name of an individual-field-descriptor +occurring in D, unless there are no such field names. Fields with default +values will also be added to the detail record based on D in the same way as the +mapping-constructor-expr adds fields with default values based on the +contextually expected type. The contextually expected type for each named-arg is +determined from D in the same way as for a mapping-constructor-expr. The detail +mapping is constructed as immutable, with its members being the result of +applying the ImmutableClone abstract operation to the result of evaluating each +named-arg and every defaultable arg. +

+

+The stack trace in the constructed error value describes the execution stack at +the point where the error constructor was evaluated. +

+ +
+
+

6.18 Anonymous function expression

+ +
anonymous-function-expr := explicit-anonymous-function-expr | infer-anonymous-function-expr
+explicit-anonymous-function-expr := [annots] function-quals function function-signature (block-function-body|expr-function-body)
+
+

+Evaluating an anonymous-function-expr creates a closure, whose basic type is +function. With an explicit-anonymous-function-expr, the type of the function is +specified explicitly as usual with a function-signature. With an +infer-anonymous-function-expr, the type of the function is inferred. +

+

+If a variable-reference-expr within an anonymous-function-expr refers to a local +variable defined outside of the anonymous-function-expr, the closure will +capture a reference to that variable; the captured reference will refer to the +same storage as the original reference rather than to a copy. +

+ +
infer-anonymous-function-expr := infer-param-list expr-function-body
+infer-param-list :=
+   identifier
+   | ([identifier (, identifier)*])
+
+

+An infer-anonymous-function-expr can only be used in a context where a function +type is expected. Both the types of the parameters and whether the function type +is isolated are inferred from the expected function type. The +function type will be inferred to be transactional if the +expr-function-body calls any functions with a transactional type. +The scope of the parameters is expr-function-body. +The static type of the infer-anonymous-function-expr will be a function type +whose return type is the static type of the expression in +expr-function-body. If the contextually expected type for the +anonymous-function-expr is a function type with return type T, then +the contextually expected type for expression in +expr-function-body is T. +

+
+ +
+

6.19 Let expression

+ +
let-expr := let let-var-decl [, let-var-decl]* in expression
+let-var-decl := [annots] typed-binding-pattern = expression
+
+ +

+A let-expr binds variables and then evaluates an expression with those variables in scope. +

+

+A let-expr let T B = E1 in E2 is evaluated as +follows. E1 is evaluated resulting in a value v. The typed binding +pattern T B is matched to v, causing assignments to the variables occuring in B. +Then E2 is evaluated with those variables in scope; the resulting +value is the result of the let-expr. +

+

+A let-expr let D1, D2,...,Dn in E +is transformed into let D1 in let D2 in ... let +Dn in E. +

+

+The typed-binding-pattern is used unconditionally, meaning that it is a compile +error if the static types do not guarantee the success of the match. If the +typed-binding-pattern uses var, then the type of the variable is +inferred from the precise static type of the expression following +=. +

+

+Since expressions cannot modify variables, the variables bound in a let-var-decl +are implicitly final. A let-expr is isolated if the expression following +in is isolated; a reference in that expression to a variable bound +by a let-var-decl will be treated as isolated if the expression initializing the +variable in the let-var-decl is isolated. +

+ +
+ +
+

6.20 Type cast expression

+ +
type-cast-expr := < type-cast-param > expression
+type-cast-param := [annots] type-descriptor | annots
+
+

+A type-cast-expr casts the value resulting from evaluating +expression to the type described by the type-descriptor, performing +a numeric conversion if required. +

+

+Normally, the parameter for a type-cast-expr includes a type-descriptor. +However, it is also allowed for the parameter to consist only of annotations; in +this case, the only effect of the type cast is for the contextually expected +type for expression to be augmented with the specified annotations. The rest of +this subsection describes the normal case, where the type-cast-expr includes a +type-descriptor. +

+

+A type-cast-expr is evaluated by first evaluating expression +resulting in a value v. Let T be the type described by +type-descriptor. If v belongs T, then the result of the +type-cast-expr is v. Otherwise, if T includes shapes from exactly one basic +numeric type N and v belongs to another basic numeric type, then let n be +NumericConvert(N, v); if n is not an error and n belongs to T, then the result +of the type-cast-expr is n. Otherwise, the evaluation of the type-cast-expr +completes abruptly with a panic. +

+

+Let T be the static type described by type-descriptor, and let TE +be the static type of expression. Then the static type of the +type-cast-expr is the intersection of T and TE', where TE' is TE +with its numeric shapes transformed to take account of the possibility of the +numeric conversion specified in the previous paragraph. +It is a compile-time error to attempt to use a type cast to +cast away an error: if the intersection of TE and error is +non-empty, then the intersection of T and error must also be +non-empty. A checkpanic expression can be used instead to assert +that the result of an expression will never be an error. +

+

+The contextually expected type for expression is the intersection +of the contextually expected type of the type-cast-expr and the +type described by the type-descriptor. +

+

+Note that a type-cast-expr of <readonly> can be +used both to cause constructors withing the expression to construct +values with the read-only bit on and to verify that the value resulting from +the evaluation of expression has its read-only bit on. +

+ +
+
+

6.21 Typeof expression

+ +
typeof-expr := typeof expression
+
+

+The result of a typeof-expr is a typedesc value for the runtime +type of v, where v is the result of evaluating expression. +

+

+The runtime type of v is the narrowest type to which v belongs. +

+
    +
  • When v is a simple value, the resulting typedesc will describe a type +consisting of a single shape, which is the shape of the value. The typedesc will +not have any annotations. Each evaluation of typeof with a simple +value produces a new typedesc value.
  • +
  • When v is a reference value, each evaluation of typeof with an +identical reference value produces an identical typedesc value. The type +descriptor resulting from typeof will be the same as the type +descriptor used to construct the value. For containers, this is the same as the +inherent type; when the container is immutable, it will be a singleton type. For +an object, this is the same as the type descriptor used with new. For an error, +this is the same as the type descriptor used in the functional-constructor-expr. +Any annotations that were attached to the type descriptor used to construct the +value will this be available on the constructed value.
  • +
+

+The static type of typeof-expr is typedesc<T>, where T is the +static type of expression. +

+
+
+

6.22 Unary expression

+ +
+

6.22.1 Unary numeric expression

+
unary-numeric-expr :=
+   + expression
+   | - expression
+   | ~ expression
+
+

+The operators occurring in a unary-numeric-expr have both lifted +form, which is specified in the Nil lifting section, +and an underlying form, which is specified in this section. +

+

+The unary - operator performs negation. The static type of the +operand must be a number; the static type of the result is the basic type of the +static type of the operand, modified by the usual singleton typing rules. The semantics for each +basic type are as follows: +

+
    +
  • int: negation for int is the same as subtraction from zero; a panic will +occur on overflow, which happens when the operand is -263)
  • +
  • float, decimal: negation for floating point types corresponds to the negate +operation as defined by IEEE 754-2008 (this is not the same as subtraction from +zero);
  • +
+

+If the contextually expected type for a - expression is T, then the +contextually expected type for the operand expressions is T', where a value v is +in T' if it belongs to int, decimal or float, and T contains a value with the +same basic type as v. +

+

+The unary + operator returns the value of its operand expression. The static +type of the operand must be a number, and the static type of the result is the +same as the static type of the operand expression, modified by the usual singleton typing rules. +

+

+The ~ operator inverts the bits of its operand expression. The +static type of the operand must be int, and the static type of the result is +int, modified by the usual singleton typing +rules. +

+
+ +
+

6.22.2 Unary logical expression

+
unary-logical-expr := ! expression
+
+

+The ! operator performs logical negation. The static type of the +operand expression must be boolean. The ! operator returns true if +its operand is false and false if its operand is true. The static type of the +result is boolean, modified by the usual singleton +typing rules. +

+
+
+ +
+

6.23 Multiplicative expression

+ +
multiplicative-expr :=
+   expression * expression
+   | expression / expression
+   | expression % expression
+
+

+The * operator performs multiplication; the / operator +performs division; the % operator performs remainder. These +operators have both lifted form, which is specified in the Nil lifting section, and an underlying form, which is +specified in this section. +

+

+The static type of each operand must be a subtype of int, +float or decimal. If the static type of both operands +is not a subtype of the same basic type, then either the second operand must be +a subtype of int, or the operator must be * and the +first operand must be a subtype of int; in either case, the +int operand is first converted to the type of the other operand. +

+

+The operation performed depends on the basic type of the operands as follows: +

+
    +
  • int +
      +
    • +* performs integer multiplication; a panic will occur on overflow
    • +
    • +/ performs integer division, with any fractional part discarded +ie with truncation towards zero; a panic will occur on division by zero or +overflow, which happens if the first operand is -263 and the second +operand is -1
    • +
    • +% performs integer remainder consistent with integer division, +so that if x/y does not result in a panic, +then (x/y)*y + +(x%y) is equal to x; a +panic will occur if the second operand is zero; if the first operand is +-263 and the second operand is -1, then the result is 0
    • +
    +
  • +
  • float, decimal +
      +
    • +* performs the multiplication operation with the destination +format being the same as the source format, as defined by IEEE 754-2008; this +never causes a panic to occur
    • +
    • +/ performs the division operation with the destination format +being the same as the source format, as defined by IEEE 754-2008; this never +causes a panic to occur
    • +
    • +% performs a remainder operation; the remainder is not the +IEEE-defined remainder operation but is instead a remainder operation analogous +to integer remainder; more precisely, +
        +
      • if x is NaN or y is NaN or +x is an infinity or y is a zero, +then x % y is NaN
      • +
      • for finite x, and infinite y, x % +y is x +
      • +
      • for finite x and finite non-zero +y, x % y is equal to +the result of rounding x - (y × n) +to the nearest representable value using the roundTiesToEven rounding mode, +where n is the integer that is nearest to the +mathematical quotient of x and y +without exceeding it in magnitude; if the result is zero, then its sign is that +of x +
      • +
      • no exceptions are thrown
      • +
      +
    • +
    +
  • +
+

+The static type of the result of a multiplicative-expr is the basic type of its +subexpressions, after conversion, modified by the usual singleton +typing rules, except that the result type is always float in +the case where the operator is / and the right-hand operand is +singleton float 0.0. (This is a consequence of the fact that +0.0 == -0.0, but 1.0/0.0 != 1.0/-0.0.) +

+

+If the contextually expected type for a multiplicative-expr is T, then the +contextually expected type for both operand expressions is T', where a value v is +in T' if it belongs to int, decimal or float, and T contains a value with the +same basic type as v. +

+
+
+

6.24 Additive expression

+ +
additive-expr :=
+   expression + expression
+   | expression - expression
+
+

+The + operator is used for both addition and concatenation; the +- operator is used for subtraction. These operators have both +lifted form, which is specified in the Nil lifting +section, and an underlying form, which is specified in this section. +

+

+It is required that either: +

+
    +
  • the static type of both operand expressions is a subtype of the same basic +type, in which case the static type of the result will be this basic type, +modified by the usual singleton typing rules; +or
  • +
  • the static type of one operand expression must be a subtype of xml and of +the other operand expression must be a subtype of string, in which case the +static type of the result is xml.
  • +
+

+The semantics for each basic type is as follows: +

+
    +
  • int +
      +
    • ++ performs integer addition; a panic will occur on +overflow
    • +
    • +- performs integer subtraction; a panic will occur on +overflow
    • +
    +
  • +
  • float, decimal +
      +
    • ++ performs the addition operation with the destination format +being the same as the source format, as defined by IEEE 754-2008; this never +causes a panic to occur
    • +
    • +- performs the subtraction operation with the destination +format being the same as the source format, as defined by IEEE 754-2008; this +never causes a panic to occur
    • +
    +
  • +
  • string, xml +
      +
    • if both operands are a string, then the result is a string that is the +concatenation of the operands
    • +
    • if both operands are xml, then the result is a new xml value that is the +concatenation of the operands; this does not perform a copy on +the constituents of the operand values
    • +
    • if one operand is an empty string and one is xml, then +the result is the xml value operand
    • +
    • if one operand is a non-empty string and one is xml, then the string is +treated as if it were an xml singleton text value whose characters are the same +as the characters of the string;
    • +
    +
  • +
+

+If the contextually expected type for an additive-expr is T, then the +contextually expected type for both operand expressions is T', where a value v is +in T' if it belongs to int, decimal, float, string or xml and T contains a value +with the same basic type as v. +

+ +
+
+

6.25 Shift expression

+ +
shift-expr :=
+   expression << expression
+   expression >> expression
+   expression >>> expression
+
+

+A shift-expr performs a bitwise shift. The shift operators have both lifted +form, which is specified in the Nil lifting section, +and an underlying form, which is specified in this section. +

+

+Both operand expressions must have static type that is a subtype of int. The +left hand operand is the value to be shifted; the right hand value is the shift +amount; all except the bottom 6 bits of the shift amount are masked out (as if +by x & 0x3F). Then a bitwise shift is performed depending on the operator: +

+
    +
  • +<< performs a left shift, the bits shifted in on the +right are zero
  • +
  • +>> performs a signed right shift; the bits shifted in on the +left are the same as the most significant bit
  • +
  • +>>> performs a unsigned right shift, the bits shifted in on the +left are zero
  • +
+

+If the operator is >> or >>> and the left hand operand is a +subtype of int:UnsignedK when K +is 8, 16 or 32, then the static type of the result is +int:UnsignedN where N is the +smallest such K; otherwise, the static type of the +result is int. In all cases the static type of the result is +modified by the usual singleton typing rules. +

+
+
+

6.26 Range expression

+ +
range-expr :=
+   expression ... expression
+   | expression ..< expression
+
+

+The result of a range-expr is a new object belonging to the object type +Iterable<int,()> that will iterate over a sequence of integers in increasing +order, where the sequence includes all integers n such that +

+
    +
  • the value of the first expression is less than or equal to n, and
  • +
  • n is +
      +
    • if the operator is ..., less than or equal to the value of the +second expression
    • +
    • if the operator is ..<, less than the value of the second +expression
    • +
    +
  • +
+

+It is a compile error if the static type of either expression is not a subtype +of int. +

+

+A range-expr is designed to be used in a foreach statement, but it can be used +elsewhere. +

+

+A range-expr is always isolated. +

+
+
+

6.27 Relational expression

+ +
relational-expr :=
+   expression < expression
+   | expression > expression
+   | expression <= expression
+   | expression >= expression
+
+

+A relational-expr tests the relative order of two values. There must be an ordered type to which the static type of both operands +belong. The static type of the result is boolean, modified by the usual singleton typing rules. +

+

+A relational-expr is evaluated by first evaluating the two expressions, +resulting in values x and y. The result of relational-expr is true if and only +if the result of the Compare(x,y) operation is +

+
    +
  • LT, if the operator is < +
  • +
  • GT, if the operator is > +
  • +
  • LT or EQ, if the operator is <= +
  • +
  • GT or EQ, if the operator is >= +
  • +
+

+and otherwise false. +

+
+
+

6.28 Type test expression

+ +
is-expr :=
+   expression is type-descriptor
+   | expression ! is type-descriptor   
+
+

+An is-expr tests whether a value belongs to a type. +

+

+An is-expr is evaluated by evaluating the expression yielding a result v. +If the operator is is, then the result of the expression is true if +v belongs to the type denoted by the type-descriptor, and otherwise false. If +the operator is !is, then the result of the expression is false if +v belongs to the type denoted by the type-descriptor, and otherwise true. +

+
+
+

6.29 Equality expression

+ +
equality-expr :=
+   expression == expression
+   | expression != expression
+   | expression === expression
+   | expression !== expression
+
+

+An equality-expr tests whether two values are equal. For all four operators, it +is a compile time error if the intersection of the static types of the operands +is empty. +

+

+The === operator tests for exact equality. The !== operator results in the +negation of the result of the === operator. Two values v1 and +v2 are exactly equal if they have the same basic type T and +

+
    +
  • T is simple type, and v1 and v2 are identical values +within the possible of values allowed for T;
  • +
  • T is a sequence type, and the length of v1 is the same as the length of v2 and +
      +
    • the length is 1, and either +
        +
      • v1 and v2 both have storage identity and that storage +identity is the same, or
      • +
      • v1 and v2 both do not have storage identity and the +shape of v1 is the same as the shape of v2 +
      • +
      +
    • +
    • the length is not 1, and every constituent of v1 is exactly equal +as the corresponding constituent of v2;
    • +
    +
  • +
  • T is a structural or behavioural type, and the storage identity of +v1 is the same as the storage identity of v2.
  • +
+

+The == operator tests for deep equality. The != operator results in the negation +of the result of the == operator. For both == and !=, at least one of the operands must have a +static type that is a subtype of anydata. Two values v1, v2 are deeply equal if +DeepEquals(v1, v2) is true. +

+

+The static type of the result of expression is boolean; in the case of the == +and != operators, the static type is modified by the usual singleton typing rules; in the case of the === and +!== operators, the static type is not so modified. +

+

+Note that === and == are the same for simple values except for floating point types. +

+

+For the float type, the operators differ as regards floating point zero: == +treats positive and negative zero from the same basic type as equal whereas === +treats them as unequal. Both == and === treat two NaN values from the same basic +type as equal. This means that neither of these operators correspond to +operations defined by IEEE 754-2008, because they do not treat NaN in the +special way defined for those operations. +

+

+For the decimal type, the operators differ in whether they consider the +precision of the value. For example, 1.0 == 1.00 is true but +1.0 === 1.00 is false. +

+ +
+
+

6.30 Binary bitwise expression

+ +
binary-bitwise-expr :=
+   bitwise-and-expr
+   | bitwise-xor-expr
+   | bitwise-or-expr
+bitwise-and-expr := expression & expression
+bitwise-xor-expr := expression ^ expression
+bitwise-or-expr := expression | expression
+
+

+A binary-bitwise-expr does a bitwise AND, XOR, or OR operation on its operands. +These operators have both lifted form, which is specified in the Nil lifting section, and an underlying form, which is +specified in this section. +

+

+The static type of both operands must be a subtype of int. The static type of +the result is as follows: +

+
    +
  • for AND, if the type of either operand is a subtype of +int:UnsignedK when K is 8, 16 or +32, then the static type of the result is int:UnsignedN +where N is the smallest such K; +otherwise, the static type of the result is int;
  • +
  • for XOR or OR, if the type of both operands is a +subtype of int:UnsignedK when K +is 8, 16 or 32, then the static type of the result is +int:UnsignedN where N is the +smallest such K; otherwise, the static type of the result +is int.
  • +
+

+In all cases, the static type of the result is modified by the usual singleton typing rules. +

+
+ +
+

6.31 Logical expression

+ +
logical-expr := logical-and-expr | logical-or-expr
+logical-and-expr := expression && expression
+logical-or-expr := expression || expression
+
+ +

+The static type of each expression in a logical-expr must be a subtype of +boolean. +

+

+A logical-and-expr is evaluated as follows: +

+
    +
  1. the left-hand expression is evaluated, resulting in a value x;
  2. +
  3. if x is false, then the result of the +logical-and-expr is x, and the right-hand expression is not +evaluated;
  4. +
  5. otherwise, the result of the logical-and-expr is the result of evaluating +the right-hand expression.
  6. +
+

+A logical-or-expr is evaluated as follows: +

+
    +
  1. the left-hand expression is evaluated, resulting in a value x;
  2. +
  3. if x is true, then the result of the +logical-or-expr is x, and the right-hand expression is not +evaluated;
  4. +
  5. otherwise, the result of the logical-or-expr is the result of evaluating +the right-hand expression.
  6. +
+ +

+The static type of the result of a logical-expr is boolean, modified by the +usual singleton typing rules. Furthermore: +

+
    +
  • if the expression is a logical-and-expr and the static type of left-hand +expression is singleton false, then the static type of the result is singleton +false, regardless of the static type of the right-hand-expression;
  • +
  • if the expression is a logical-or-expr and the static type of left-hand +expression is singleton true, then the static type of the result is singleton +true, regardless of the static type of the right-hand-expression.
  • +
+ +
+ +
+

6.32 Conditional expression

+ +
conditional-expr :=
+  ternary-conditional-expr
+  | nil-conditional-expr
+ternary-conditional-expr := expression ? expression : expression
+nil-conditional-expr := expression ?: expression
+
+

+A ternary-conditional-expr C ? T : F is evaluated as +follows: +

+
    +
  1. evaluate C to get a value boolean value v;
  2. +
  3. if v is true, then the result is the result of evaluating T.
  4. +
  5. Otherwise, the result is the result of evaluating F.
  6. +
+

+In a ternary-conditional-expr C ? T : F, the static +type of C must be a subtype of boolean, and the static type of the result is +determined from ther static types of C, T and F as follows: +

+
    +
  1. if the static type of C is singleton true, then the static +type of the result is the static type of T;
  2. +
  3. if the static type of C is singleton false, then the static +type of the result is the static type of F;
  4. +
  5. otherwise, the static type of the result is the union of the static types of +T and F.
  6. +
+

+A nil-conditional-expr L ?: R is evaluated as follows: +

+
    +
  1. evaluate L to get a value v;
  2. +
  3. if v is not nil, then the result is v;
  4. +
  5. otherwise, the result is the result of evaluating R.
  6. +
+

+The static type of the result of L ?: R is determined from the +static types of L and R as follows: +

+
    +
  1. if the static type of L is nil, then the static type of +the result is the static type of R;
  2. +
  3. if the static type of L does not include nil, then the static type of +the result is the static type of L;
  4. +
  5. otherwise, the static type of the result is the union of the difference of +the static type of L and (), and the static type of R.
  6. +
+
+ +
+

6.33 Checking expression

+ +
checking-expr := checking-keyword expression
+checking-keyword := check | checkpanic
+
+

+Evaluates expression resulting in value v. If v has basic type error, then +

+
    +
  • if the checking-keyword is check, then the checking-expr +completes abruptly with a check-fail with associated value v;
  • +
  • if the checking-keyword is checkpanic, then the checking-expr +completes abruptly with a panic with associated value v.
  • +
+

+If the static type of expression Expr is T|E, where E is +a subtype of error, then the static type of check Expr +or checkpanic Expr is T. However, if: +

+
    +
  • the checking-keyword is check,
  • +
  • the above rules would result in a compile-time error,
  • +
  • the static type of Expr is lax,
  • +
  • T is a subtype of json, and
  • +
  • there is a contextually expected type S, where S is a subtype of +()|boolean|int|float|decimal|string,
  • +
+

+then instead check Expr is treated as check +val:ensureType(Expr, s), where +s is a typedesc value representing S and +val refers to the value module in langlib. +

+
+
+

6.34 Trap expression

+

+The trap expression stops a panic and gives access to the error value associated +with the panic. +

+
trap-expr := trap expression
+
+

+Semantics are: +

+
    +
  • Evaluate expression resulting in value v +
      +
    • If evaluation completes abruptly with panic with associated value e, then +result of trap-exp is e
    • +
    • Otherwise result of trap-expr is v
    • +
    +
  • +
  • If type of expr is T, then type of trap expr is +T|error. It is permitted for T to be never.
  • +
+
+ +
+

6.35 Query expression

+

+Query expressions provide a language-integrated query feature using SQL-like +syntax. +

+
query-expr := query-select-expr | query-collect-expr
+query-select-expr := [query-construct-type] query-pipeline select-clause [on-conflict-clause]
+query-collect-expr := query-pipeline collect-clause
+query-pipeline := from-clause intermediate-clause*
+intermediate-clause :=
+   from-clause
+   | where-clause
+   | let-clause
+   | join-clause
+   | limit-clause
+   | order-by-clause
+   | group-by-clause
+
+

+A query expression consists of a sequence of clauses. The semantics of clauses +is specified in terms of transforming a sequence of frames, where a frame is a +binding of variables to values. The input to each clause is a sequence of +frames. +

+

+The initial part of a query expression is a pipeline, where each clause outputs +a sequence of frames; the sequence of frames output by one clause become the +input to the next clause. As each clause in the pipeline is executed, it +iterates over its input frames and emits output frames. The pipeline is executed +lazily, with each clause pulling input from its preceding clause. The input to +the first clause is a single empty frame. The output of the pipeline is the +output of its last clause. +

+

+The remainder of the query expression says how to compute the result of the +query expression using the sequence of frames output by the query pipeline. +There are two kinds of query expression: query-select expressions and +query-collect expressions. In a query-select expression the pipeline is followed +by a select clause; in a query-collect expression, the pipeline is +followed by a collect clause. +

+

+The execution of certain intermediate clauses can result in the pipeline being +terminated prematurely. Specifically, when a from or +join clause is executed, it makes calls to the next +method of an Iterator object; if any of these calls return an error value +e, then the clause is said to complete early with error +value e. A query-select or query-collect expression will handle this +early completion by terminating the execution of the pipeline, as described +below. +

+

+Variables bound by the clauses of a query-pipeline are implicitly final, and +cannot be modified. +

+ +
+

6.35.1 From clause

+
from-clause := from typed-binding-pattern in expression
+
+

+A from clause is executed as follows: +

+
    +
  • for each input frame f +
      +
    • evaluate the in expression with f in scope resulting +in an iterable value c;
    • +
    • create an Iterator object i from c +
    • +
    • do the following in a loop L +
        +
      • call i.next() resulting in a value r;
      • +
      • if r is an error, then complete execution of the from-clause +early with error r;
      • +
      • if r is (), stop loop L;
      • +
      • let v be r.value;
      • +
      • emit a frame consisting of f augmented with the variables +resulting from binding typed-binding-pattern to v.
      • +
      +
    • +
    +
  • +
+
+ +
+

6.35.2 Where clause

+
where-clause := whereNR expression
+
+

+A where clause is executed as follows: +

+
    +
  • for each input frame f +
      +
    • execute the expression with f in scope resulting in +value b;
    • +
    • if b is true, emit f.
    • +
    +
  • +
+
+ +
+

6.35.3 Let clause

+
let-clause := let let-var-decl [, let-var-decl]* 
+
+

+A let clause consisting of a single let-var-decl is executed as follows: +

+
    +
  • for each input frame f +
      +
    • evaluate the expression with f in scope resulting in a value v;
    • +
    • emit a frame consisting of f augmented with the result of binding +type-binding-pattern to v.
    • +
    +
  • +
+

+A let clause with more than one let-var-decl is +transformed into multiple let clauses: let x1 = +E1, x2 = E2 is transformed into +let x1 = E1 let x2 = +E2. +

+
+ +
+

6.35.4 Join clause

+
join-clause := [outerNR] joinNR typed-binding-pattern in expression join-on-condition
+join-on-condition := on expression equals expression
+
+

+A join clause performs an inner or left outer equijoin. +

+

+A join clause is executed as follows: +

+
    +
  • compute a mapping for the right side of the join; during this computation +variable bindings from input frames are not in scope: +
      +
    • create an empty mapping m that maps from keys to lists of frames +(using DeepEquals to compare keys);
    • +
    • evaluate the expression following in resulting in an iterable +value c;
    • +
    • create an Iterator object i from c;
    • +
    • do the following in a loop L +
        +
      • call i.next() resulting in a value r;
      • +
      • if r is an error, then complete execution of the join-clause +early with error r;
      • +
      • if r is (), stop loop L;
      • +
      • let v be r.value;
      • +
      • let f be a frame with the result of binding the +typed-binding-pattern to v;
      • +
      • evaluate the expression to right of equals with f +in scope resulting in a value k;
      • +
      • add an entry to m with key k and and frame f;
      • +
      +
    • +
    +
  • +
  • for each input frame f +
      +
    • evaluate the expression to the left of equals with frame f +in scope resulting in a value k;
    • +
    • let fs be the list of frames for key k in m;
    • +
    • for each frame f' in fs +
        +
      • emit a frame consisting of f augmented with f';
      • +
      +
    • +
    • if outer was specified and fs is empty, then emit a +single frame consisting of f augmented with a frame that binds every +variable occurring in typed-binding-pattern to (). +
    • +
    +
  • +
+

+In the above, if c evaluates to a table, and the result of evaluating +the expression to the right of equals for a member of the table +will always be the key value for that member of the table, then the above can be +optimized by using the table instead of creating a new mapping. +

+

+Variables bound by previous clauses are not in scope for the expression +following in, nor for the expression on the right of +equals. Variables bound by the typed-binding-pattern are not in +scope for the expression following in, nor for the expression on +the left of equals. +

+

+When outer is specified, the typed-binding-pattern is treated +specially: the inferable-type-descriptor in the typed-binding-pattern must be +var, and for each variable occurring in the typed-binding-pattern, +if the type that would be inferred usually for the variable would be +T, then the type inferred in this case will be +T?. +

+ +
+ +
+

6.35.5 Limit clause

+
+limit-clause := limitNR expression
+
+

+A limit clause limits the number of frames emitted by a query pipeline. +

+

+A limit clause is executed as follows: +

+
    +
  • evaluate expression resulting in a value n; variable bindings +from input frames are not in scope for this evaluation;
  • +
  • if n is less than zero, then panic;
  • +
  • for each input frame f, while n is greater than 0 +
      +
    • decrement n;
    • +
    • emit f.
    • +
    +
  • +
+ +

+The static type of expression must be a subtype of int. +

+ +
+ +
+

6.35.6 Order by clause

+
+order-by-clause := orderNR byNR order-key [, order-key]*
+order-key := expression [order-direction]
+order-direction := ascending | descending
+
+

+The static type of the expression in an order-key must be an ordered type. The order-direction is ascending +if not explicitly specified. +

+

+An order-by clause is executed by constructing a list +of entries, where each entry consists of: +

+
    +
  • a frame
  • +
  • a list of keys, one for each order-key in the order-by-clause, and
  • +
  • an integer index
  • +
+

+In order to define the correct ordering of the list, we first define a CompareK +operation that compares two keys with a specified direction: CompareK(x,y,d) is +CompareA(x,y) if d is ascending and otherwise (d is descending) is +Reverse(CompareD(x,y)), where Reverse applied to LT, EQ, GT is GT, EQ, LT +respectively. Now define an operation CompareKL(x,y,d) applying to two lists of +keys and a list of directions as follows. Let x be +[x1,x2,...,xn], y be +[y1,y2,...,yn], and d be [d1, +d2,...,dn]. Then let r be +CompareK(x1,y1,d1). Then the result of +CompareKL(x,y,d) is: +

+
    +
  • r, if r is not EQ
  • +
  • otherwise, EQ, if n is 1
  • +
  • otherwise, +CompareKL([x2,...,xn],[y2,...,yn],[d2,...,dn]).
  • +
+

+Then in a correct ordering of the list of entries when the list of directions is +d, an entry with keys with keys x and index i is before an entry with keys y and +index j if CompareKL(x,y,d) is LT or if CompareKL(x,y,d) is EQ and i is less +than j. +

+

+An order-by clause is executed as follows: +

+
    +
  • create an empty list E of entries
  • +
  • for each input frame f add an entry to E in which +
      +
    • the frame is f +
    • +
    • the list of keys is a list of the results of evaluating each order-key's +expression with f in scope
    • +
    • the index is the length of E +
    • +
    +
  • +
  • sort E so that it is ordered correctly as described above
  • +
  • for each entry in E, emit the entry's frame
  • +
+ +
+ +
+

6.35.7 Aggregated variable bindings

+ +

+Frames constructed by collect and group-by clauses can contain +aggregated variable bindings. The type of an aggregated variable +binding is always a list type; as usual, the +value bound to the variable belongs to this type. An aggregrated variable is +special in that it is only allowed to be referenced by an +aggregated-variable-reference; the semantics of such a reference are different +from the semantics of a variable-reference-expr. +

+

+An aggregated variable binding for a variable x is aggregated +from a sequence of frames S, by binding x to a list +with the same length as S, where the i-th member of the +list is the value bound to x in the i-th frame in +S. The type of the aggregated variable binding is derived from the +type T of x in S and the kind of clause +C that is constructing the binding. When C is a collect +clause, S can be empty and the type is T[]. +When C is a group-by clause, S cannot be empty and so the +type is [T,T...]. +

+ +
aggregated-variable-reference := identifier
+
+

+A reference to an aggregated variable binding is implicitly spread: an +identifier x that refers to an aggregated variable +binding is treated like a spread ...y, where the +variable y has the same type and value as +x but is not aggregated. +

+

+The grammar shows this by using the aggregated-variable-reference production. A +reference to an aggregated variable is allowed only in a syntactic context where +the grammar allows an aggregated-variable-reference. In each such syntactic +context, the grammar also allows both a variable-reference-expr and a spread. +When a reference to an aggregated variable occurs in an allowed context, it +should be parsed as a aggregated-variable-reference rather than as a +variable-reference-expr, and should be transformed into the equivalent spread. +Any other reference to an aggregated variable should be parsed as a +variable-reference-expr, and then rejected as semantically incorrect. +

+
+ +
+

6.35.8 Group by clause

+
group-by-clause := groupNR byNR grouping-key (, grouping-key)*
+grouping-key :=
+   variable-name
+   | inferable-type-descriptor variable-name = expression
+
+

+A group-by-clause that uses an inferable-type-descriptor is transformed into a a +let-clause followed by a group-by-clause where every grouping-key is a +variable-name. For example: +

+
group by var x1 = E1, var x2 = E2
+
+

+is transformed to +

+
let x1 = E1, x2 = E2 group by x1, x2
+
+

+A group-by clause where every grouping-key is a variable-name is executed by +first partitioning the sequence of input frames S into a set +P of non-empty sequences of frames, such that: +

+
    +
  • every member P is a subsequence (not necessarily consecutive) of S;
  • +
  • every constituent of S is a constituent of exactly one member of P;
  • +
  • two constituents f1 and f2 of +S are constituents of the same member of P if and only if +for every variable x that is a grouping-key, +DeepEquals(x1,x2) is true, where +x1 is the value bound to x in +f1, and x2 is the value bound to +x in f2.
  • +
+

+Next, for each sequence G in P, ordered by the order in +which the first constituent of G occurs in S, an output +frame is constructed from G and emitted. An output frame g +is constructed from a sequence of input frames G as follows. The same +variables are bound by g as are bound by G. For each +variable that is a grouping-key, the value and type in g will be the +same as the value and type in the first constituent of G. The binding +for every other variable is aggregated from +G. +

+ +
+ +
+

6.35.9 Collect clause

+
collect-clause := collectNR expression
+
+ +

+A query-collect expression is used to perform aggregation. It is evaluated as +follows. +

+ +
    +
  1. The query-pipeline is executed to produce a sequence of frames S. +If during this any clause completes early with error value e, then +the result of evaluating the query-collect-expr is e. In addition, +the normal rules apply if the execution of any clause results in the evaluation +of an expression completing abruptly.
  2. +
  3. A frame f is constructed. For each variable x that is +bound by S, f has a variable binding for x that +is aggregated from S.
  4. +
  5. The expression in the collect-clause is evaluated with f in scope +resulting in a value v.
  6. +
  7. The result of the query-collect expression is v.
  8. +
+ +

+The contextually expected type for the expression in the collect-clause is the +contextually expected type for the query-collect-expr. +

+
+ +
+

6.35.10 Select clause

+ +
+select-clause := selectNR expression
+
+

+When a query-select expression is evaluated, the select clause is +executed as follows, so as to emit a sequence of values: +

+
    +
  • for each frame f output by the query pipeline +
      +
    • evaluate the expression that follows select with f +in scope resulting in value v +
    • +
    • emit v +
    • +
    +
  • +
+

+The sequence of values emitted by the execution of the select +clause is used to construct a value, which becomes the result of the +query-select-expr. The constructed result value must be one of the following +basic types: +

+
    +
  • list - the constructed list has a member for each emitted value; every +emitted value must belong to type T, where T[] is the type of the constructed +value;
  • +
  • mapping - the constructed mapping has a member for each emitted value; every +emitted value must belong to type [string, T], where map<T> is the type +of the constructed value; an emitted value [k, +v] results in adding a field with key +k and value v;
  • +
  • table - the constructed table has a member for each emitted value; every +emitted value must belong to type T, where table<T> is the type of the +constructed value;
  • +
  • string - the constructed string is the concatenation of the emitted values; +every emitted value must be of type string;
  • +
  • xml - the constructed xml value is the concatenation of the emitted values; +every emitted value must be of type xml;
  • +
  • stream - the stream generates the emitted values.
  • +
+

+The clauses in a query-select-expr are executed either eagerly or lazily. If a +query-select-expr is constructing a stream, they are executed lazily; otherwise, +they are executed eagerly. When the clauses in a query-select-expr are being +executed eagerly, the execution happens during the evaluation of the +query-select-expr. When the clauses are being executed lazily, the evaluation of +the query-select-expr constructs a stream object without executing any of the +clauses; the clauses becomes closures, which are called later as a result of +next operations being performed on the stream. +

+

+With eager execution, if any clause completes early with error value +e, then the result of evaluating the query-select-expr is +e. In addition, the normal rules apply if the execution of any clause +results in the evaluation of an expression completing abruptly. +

+

+With lazy execution, when a next operation on the stream results in the +execution of a clause that completes early with error value e, then +that next operation returns e. Similarly, if the next operation +results in the evaluation of an expression within the query-select-expr +completing abruptly with a check-fail, the associated error value will be +returned as the result of the next operation; if the next operation results in +the evaluation of an expression within the query-select-expr completely abruptly +with a panic, then the next operation will complete abruptly with a panic. +

+ +
query-construct-type :=
+  map
+  | table key-specifier
+  | stream
+
+

+If a query-construct-type is specified, then it determines the basic type of the +result. A query-select-expr that constructs a mapping must specify a +query-construct-type of map. +When constructing a table, the key-specifier specifies the key +sequence of the constructed table in the same way as with a +table-constructor-expr. +

+

+If no query-construct-type is specified, the applicable contextually expected +type determines the basic type of the value constructed. If there is no +contextually expected type, then the basic type of the value constructed is the +basic type of expression following in; it is a compile-time error +if the static type of this expression is not a subtype of one of the basic types +list, table, string, stream or xml. +

+

+When the query-select-expr is constructing a value of basic type list, mapping, table +or xml, and the applicable contextually expected type is a subtype of readonly, +then the query-select-expr will construct a value with its read-only bit set and the +static type of the query-select-expr will be a subtype of readonly. Furthermore, the +contextually expected type for the expression in the select-clause will also be +a subtype of readonly. +

+
+ +
+

6.35.11 On conflict clause

+
+on-conflict-clause := on conflictNR expression
+
+

+During the execution of the select clause of query-select-expr that is +constructing a map or table, when value emitted by the select clause is added as +a new member of the map or table being constructed, it replaces any existing +member with the same key value; when a new member replaces an existing member, +it will have the same position in the order of members as the existing member. +This behavior may be controlled by an on conflict clause. +

+

+An on conflict clause is allowed only for a query-select-expr that +constructs a table with a key sequence or a map. The expression is evaluated +when the select clause emits a value that conflicts with a previous +value, in the sense that both values have the same key value in the map or +table. The expression is evaluated with the same frame in scope as the select +clause that emitted the value that conflicts with the previous value. The static +type of the expression must be a subtype of error?. If the result +of evaluating the expression is an error e, then the result of +evaluating the query-select-expr is e. Otherwise, the result must be +nil, and the earlier new value replaces the earlier conflicting value, in the +same way as if there not been an on conflict clause. +

+

+Note that the expression in an on-conflict-clause may have side-effects; for +example, it may call a function that logs an error. +

+
+ +
+
+

6.36 XML navigation expression

+

+XML navigation expressions allow for convenient navigation of XML element structure, +in a similar way to XPath. +

+ +
xml-navigate-expr := xml-filter-expr | xml-step-expr
+
+
+

6.36.1 XML name pattern

+
xml-name-pattern := xml-atomic-name-pattern [| xml-atomic-name-pattern]*
+
+xml-atomic-name-pattern :=
+  *
+  | identifier
+  | xml-namespace-prefix NoSpaceColon identifier
+  | xml-namespace-prefix NoSpaceColon *
+
+ +

+An XML name pattern matches a string specifying the name of an XML element. +

+

+An xml-atomic-name-pattern that is * matches any name. +

+

+An xml-namespace-prefix in an xml-atomic-name-pattern must be declared by an +xmlns-decl. If there is an in-scope default namespace (declared by an +xmlns-decl), an xml-atomic-pattern that is just an identifier specifies a +name in that default namespace. +

+
+
+

6.36.2 XML filter expression

+
xml-filter-expr := expression .< xml-name-pattern >
+
+

+An xml-filter-expr selects constituents of a sequence that are elements with a +name matching a specified name pattern. The static type of the expression must +be a subtype of xml. The static type of the xml-filter-expr is +xml<xml:Element>. +

+
+
+

6.36.3 XML step expression

+

+An xml-step-expr provides access to the children or descendants of an element, +similar to a location path in XPath. +

+
xml-step-expr := expression xml-step-start xml-step-extend*
+
+xml-step-start :=
+   xml-all-children-step
+   | xml-element-children-step
+   | xml-element-descendants-step
+xml-all-children-step := /*
+xml-element-children-step := /< xml-name-pattern >
+xml-element-descendants-step := /**/< xml-name-pattern >
+
+xml-step-extend :=
+   .< xml-name-pattern >
+   | [ expression ]
+   | . method-name ( arg-list )
+
+

+The production for xml-step-expr is ambiguous with the productions for +member-access-expr and method-call-expr: this must be resolved by preferring the +parse that includes as much as possible in the xml-step-expr. +

+

+The static type of the expression must be a subtype of xml. +

+

+An xml-step-expr that starts with an xml-all-children-step +

+
+   E /* X
+
+

+is equivalent to +

+
+   xml:map(xml:elements(E), v => xml:getChildren(v) X)
+
+

+where v is a variable name not used in X. +

+

+An xml-step-expr that starts with an xml-element-children-step +

+
+   E /< NP > X
+
+

+is equivalent to +

+
+   xml:map(xml:elements(E), v => xml:getChildren(v) .<NP> X)
+
+

+where v is a variable name not used in X. +

+

+An xml-step-expr that starts with an xml-element-descendants-step +

+
+   E /**/< NP > X
+
+

+is equivalent to +

+
+   xml:map(xml:elements(E), v => xml:getDescendants(v) .<NP> X)
+
+

+where v is a variable name not used in X. +

+
+
+
+

6.37 Transactional expression

+ +
transactional-expr := transactional
+
+

+A transactional-expr evaluates to true if the expression is being +evaluated in transaction mode and false otherwise. +

+ +
+ +
+
+

7. Actions and statements

+
+

7.1 Actions

+ +
action :=
+   start-action
+   | wait-action
+   | send-action
+   | receive-action 
+   | flush-action
+   | client-remote-method-call-action
+   | client-resource-access-action
+   | query-action
+   | commit-action
+
+action-or-expr :=
+   expr-only
+   | action
+   | type-cast-action-or-expr
+   | checking-action-or-expr
+   | trap-action-or-expr
+   | query-action-or-expr
+   | ( action-or-expr )
+
+type-cast-action-or-expr := < type-cast-param > action-or-expr
+checking-action-or-expr := checking-keyword action-or-expr
+trap-action-or-expr := trap action-or-expr
+
+

+Actions are an intermediate syntactic category between expressions and +statements. Actions are similar to expressions, in that they yield a value. +However, an action cannot be nested inside an expression; it can only occur as +part of a statement or nested inside other actions. This is because actions are +shown in the sequence diagram in the graphical syntax. +

+

+As with the grammar for expression, the grammar for action-or-expr is ambiguous. +The precedence for action-or-expr is the same as for expression, with the +addition that the -> operator used in a +client-remote-method-call-action has the same precedence as the . +operator used in a method-call-expr. +

+

+An action is evaluated in the same way as an expression. Static typing for +actions is the same as for expressions. +

+

+A type-cast-action-or-expr, checking-action-or-expr or +trap-action-or-expr is evaluated in the same way as a +type-cast-expr, checking-expr or +trap-expr respectively. +

+ +
query-action-or-expr := query-select-action-or-expr | query-collect-action-or-expr
+query-select-action-or-expr := [query-construct-type] query-action-pipeline select-action-clause [on-conflict-clause]
+query-collect-action-or-expr := query-action-pipeline collect-action-clause
+query-action-pipeline := from-action-clause intermediate-action-clause*
+intermediate-action-clause :=
+   from-action-clause
+   | let-action-clause
+   | join-action-clause
+   | where-clause
+   | limit-clause
+   | order-by-clause
+   | group-by-clause
+
+from-action-clause := from typed-binding-pattern in action-or-expr
+let-action-clause := let let-action-var-decl [, let-action-var-decl]*
+let-action-var-decl := [annots] typed-binding-pattern = action-or-expr
+join-action-clause := [outerNR] joinNR typed-binding-pattern in action-or-expr join-on-condition
+select-action-clause := selectNR action-or-expr
+collect-action-clause := collectNR action-or-expr
+
+

+A query-action-or-expr is a query-expr in which +certain subexpressions are allowed to be an action-or-expr. It is +evaluated in the same way as a query-expr. +

+ +
+
+

7.2 Threads and strands

+ +

+Ballerina's concurrency model supports both threads and coroutines. A Ballerina +program is executed on one or more threads. A thread may run on a separate core +simultaneously with other threads, or may be pre-emptively multitasked with +other threads onto a single core. +

+

+Each thread is divided into one or more strands. No two strands +belonging to the same thread can run simultaneously. Instead, all the strands +belonging to a particular thread are cooperatively multitasked. Strands within +the same thread thus behave as coroutines relative to each other. A strand +enables cooperative multitasking by yielding. When a strand yields, +the runtime scheduler may suspend execution of the strand, and switch its thread +to executing another strand. The following actions cause a strand to yield: +

+
    +
  • worker-receive-action
  • +
  • wait-action
  • +
  • flush-action
  • +
  • sync-send-action
  • +
+

+In addition, any function with an external-function-body can potentially yield; +it should only do so if it performs a system call that would block or calls a +Ballerina function that itself yields. The sleep function in +lang.runtime will make the strand yield. Other functions in the +lang library do not themselves yield, although if they call a function passed as +an argument, that function may result in yielding. +

+

+There are two language constructs whose execution causes the creation of new +strands: named-worker-decl and start-action. Except in the cases explicitly +allowed by this specification, the new strand must be part of the same thread as +the current strand. An implementation may also allow annotations to be used to +indicate that the newly created strand should be in a separate thread from the +current strand. +

+ +
+
+

7.3 Function bodies

+ +
+

7.3.1 Function parameters

+

+Before the block-function-body of a function-defn is executed, the parameters +declared in the function-signature of the function-defn are initialized from the +argument list that was constructed by the function-call-expr. The non-rest +parameters are initialized from the arguments in the argument list in order. The +conformance of the argument list to the param-list declared for the function +ensures that each parameter will be initialized to a value that belongs to the +declared type of the parameter. If there is a rest-param, then that is a +initialized to a newly created list containing the remaining arguments in the +argument-list; the inherent type of this list will be T[] where T is the type of +the rest-param. The conformance of the argument list ensures that the members of +this list will belong to type T. +

+

+The parameters are in scope for the block-function-body. They are implicitly +final: they can be read but not modified. +

+
+ +
+

7.3.2 Workers

+ +
block-function-body :=
+   { [default-worker-init named-worker-decl+] default-worker }
+default-worker-init := statement*
+default-worker := statement*
+named-worker-decl :=
+   [annots] [transactional-qual] worker worker-name return-type-descriptor statement-block [on-fail-clause]
+worker-name := identifier
+
+

+A worker represents a single strand of a function invocation. A statement +is always executed in the context of a current worker. A worker is in one of +three states: active, inactive or terminated. When a worker is in the +terminated state, it has a termination value. A worker terminates either +normally or abnormally. An abnormal termination results from a panic, and in +this case the termination value is always an error. If the termination value of +a normal termination is an error, then the worker is said to have terminated +with failure; otherwise the worker is said to have terminated with success. Note +that an error termination value resulting from a normal termination is +distinguished from an error termination value resulting from an abnormal +termination. +

+

+A function always has a single default worker, which is unnamed. The strand for +a function's default worker is the same as the strand of the worker on which +function was called. When a function is called, the current worker becomes +inactive, and a default worker for the called function is started. When the +default worker terminates, the function returns to its caller, and the caller's +worker is reactivated. Thus only one worker in each strand is active at any +given time. If a function's default worker terminates normally, then its +termination value provides the return value of the function. If a function's +default worker terminates abnormally, then the evaluation of the function call +expression completes abruptly with a panic and the worker's termination value +provides the associated value for the abrupt completion of the function call. +The function's return type is the same as the return type of the function's +default worker. +

+

+A function also has zero or more named workers. Each named worker runs on its +own new strand. The strand can run on a separate thread from the default worker if the +function is isolated. The termination of a function is independent of the termination +of its named workers. The termination of a named worker does not automatically +result in the termination of its function. When a function's default worker +terminates, causing the function to terminate, the function does not +automatically wait for the termination of its named workers. +

+

+A named worker has a return type. If the worker terminates normally, the +termination value will belong to the return type. If the return type of a worker +is not specified, it defaults to nil as for functions. +

+

+A named-worker is a transactional scope only if it is declared as +transactional. This is allowed only if the block-function-body is a +transactional scope, i.e. if it is the body of a function declared as +transactional. +

+

+When a function has named workers, the function's default worker executes in +three stages, as follows: +

+
    +
  1. The statements in default-worker-init are executed.
  2. +
  3. All the named workers are started. Each named worker executes its +statement-block on its strand.
  4. +
  5. The statements in default-worker are executed. This happens without waiting +for the termination of the named workers started in stage 2.
  6. +
+

+Parameters and variables declared in default-worker-init are in scope within +named workers, whereas variables declared in default-worker are not. +

+

+The execution of a worker's statements may result in the execution of a +statement that causes the worker to terminate. For example, a return statement +causes the worker to terminate. If this does not happen, then the worker +terminates as soon as it has finished executing its statements. In this case, +the worker terminates normally, and the termination value is nil. In other +words, falling off the end of a worker is equivalent to return;, +which is in turn equivalent to return ();. +

+

+The scope of a worker-name in a named-worker-decl that is part of a +block-function-body is the entire block-function-body with the exception of the +default-worker-init. When a worker-name is in scope, it can be used in a +variable-reference-expr. The result of evaluating such a variable reference is a +future value that refers to the value to be returned by that named worker. The +static type of the result is future<T>, where T is the return type of the +worker. +

+

+A strand can initiate a wait on another strand by using a wait-action with a +value of type future. Only one wait on a strand can succeed; this wait receives +the value returned by the strand. Any other waits on that strand fail. It is a +compile-time error if for any named worker it is possible for the name of that +worker to be evaluated as a variable-reference more than once for any execution +of that worker. This ensures that wait operations that use just a worker-name to +identify the strand to wait on cannot fail at runtime. +

+

+In the above, function includes method, and function call includes method call. +

+
+ +
+

7.3.3 Expression-bodied functions

+ +
expr-function-body := => expression
+
+ +

+An expr-function-body is used for an expression-bodied function, that is a +function whose body is specified by an expression. An expr-function-body of the +form => E is short for a block-function-body { +return E}. +

+ +
+ +
+

7.3.4 Functions with external bodies

+ +
external-function-body := = [annots] external 
+
+ +

+An external-function-body means that the implementation of the +function is not provided in the Ballerina source module. A function-defn-body +with a function-signature that is dependently-typed must be an +external-function-body. +

+ +
+
+

7.3.5 Isolated functions

+

+The body of a function or method declared as isolated must meet the +following requirements. +

+
    +
  • Only isolated functions can be called: +
      +
    • in a function-call-expr, the function-reference must refer to a function +whose static type is isolated;
    • +
    • in a method-call-expr, the method-name must refer to a method or +function whose static type is isolated;
    • +
    • in a new-expr or object-constructor-expr, the init method that is called +must be declared as isolated (a missing init method is equivalent is implicitly +isolated).
    • +
    +
  • +
  • Non-isolated module-level state can only be read in two cases, specifically +a variable-reference can refer to an an identifier declared by a +module-var-decl or listener-decl only if: +
      +
    • the identifier is declared by a module-var-decl that includes +final or configurable but does not include +isolated, or is declared by a listener-decl or a service-decl, +and
    • +
    • the static type of the variable is a subtype of isolated object +{} or of readonly (which will always be the case if the +identifier is declared as configurable).
    • +
    +
  • +
  • Non-isolated module-level state cannot be mutated: an identifier in a +variable-reference-lvexpr or in a capture-binding-pattern in a +destructuring-assignment-stmt must not refer to a variable defined by a +module-var-decl that does not include isolated.
  • +
  • A variable reference to a captured variable must refer to variables that are +both final (either explicitly or implicitly) and have a static type that is a +subtype of readonly|isolated object {}, where a variable reference +is captured if it occurs within an anonymous-function-expr or named-worker-decl +and refers to a variable declared within the function but outside of that +anonymous-function-expr or named-worker-decl.
  • +
  • A start-action is allowed only if its call-action-or-expression is isolated.
  • +
+

+If an isolated function has an external-function-body, then the +above requirements also apply to the external implementation as regards its +access to the mutable state of the Ballerina program, in the sense that it must +only access the mutable state that is reachable from the parameters passed to +the function. In addition, the function should have well-defined behaviour if it +is called concurrently on multiple strands. +

+
+
+
+

7.4 Statements

+ +
statement := 
+   action-stmt
+   | local-var-decl-stmt
+   | xmlns-decl-stmt
+   | assignment-stmt
+   | compound-assignment-stmt
+   | destructuring-assignment-stmt
+   | call-stmt
+   | checking-stmt
+   | if-else-stmt
+   | regular-compound-stmt
+   | continue-stmt
+   | break-stmt
+   | stmt-with-on-fail
+   | fail-stmt
+   | rollback-stmt
+   | panic-stmt
+   | return-stmt
+   | fork-stmt
+
+ +
+regular-compound-stmt :=
+   do-stmt
+   | match-stmt
+   | foreach-stmt
+   | while-stmt
+   | lock-stmt
+   | retry-stmt
+   | transaction-stmt
+   | retry-transaction-stmt
+
+

+A regular-compound-stmt can be combined with an +on-fail-clause to make a stmt-with-on-fail. +

+ +
+

7.4.1 Statement execution

+

+The execution of a statement completes in one of three ways: +

+
    +
  • it may complete normally;
  • +
  • it may complete by terminating the current worker; or
  • +
  • it may complete by transferring control within the same worker.
  • +
+

+When the execution of a statement involves the evaluation of an action or an +expression, and that evaluation completes abruptly, then, except where +explicitly stated to the contrary, the execution of the statement completes as +follows. +

+
    +
  • If the abrupt completion is a check-fail with associated value e, then +control flow is transferred as if by a fail-stmt with an expression +that evaluates to e.
  • +
  • If the abrupt completion is a panic with associated value e, then the +current worker is terminated as if by a panic-stmt with an +expression that evaluates to e.
  • +
+

+The following sections describe for each kind of statement any other cases in +which the execution of that kind of statement does not completely normally. +

+
+ +
+

7.4.2 Statement blocks

+
+statement-block := { statement* }
+
+

+A statement-block is executed by executing its +statements sequentially. This means that when the execution of one +statement completes normally, the immediately following +statement is executed. However, when the executon +statement does not complete normally, then none of the following +statements in the statement-block are executed. The +execution of the statement-block completes normally if and only if +the execution of all of its statements completes normally. +

+
+ +
+

7.4.3 Unreachability

+

+A statement is reachable if the analysis described in this section +determines that there is a possibility that the statement will be executed. It +is a compile error if a statement other than a +panic-stmt is not reachable. +

+

+The analysis proceeds by determining recursively for each statement whether it +is possible for the statement to complete normally, assuming that the statement +is reachable. Each statement in a statement-block +after the first statement is reachable only if it is possible for +all of the preceding statements to complete normally. +

+

+When the execution of a statement or a transfer of control is conditional on the +result of evaluating an expression, then the analysis assumes that it is +possible for the statement to be executed or control to be transferred, unless +the static type of the expression makes it impossible. Similarly, when the +evaluation of a subexpression is conditional on the result of previously +evaluating another subexpression, then the analysis assumes that the second +evaluation is possible unles the static type of the first subexpression makes it +impossible. +

+
+ +
+ + +
+

7.5 Fork statement

+ +
fork-stmt := fork { named-worker-decl+ }
+
+

+The fork statement starts one or more named workers, which run in parallel with +each other, each in its own new strand. The strand can run on a separate thread +from the current worker if the fork-stmt occurs in an isolated function. +

+

+Variables and parameters in scope for the fork-stmt remain in scope within the +workers (similar to the situation with parameters and workers in a function +body). +

+

+The scope of the worker-name in a named-worker-decl that is part of a fork-stmt +consists of both other workers in the same fork-stmt and the block containing +the fork-stmt starting from the point immediately after the fork-stmt. Within +its scope, the worker-name can be used in a variable-reference-expr in the same +way as the worker-name of a named-worker-decl that is part of a +block-function-body. +

+
+
+

7.6 Start action

+ +
start-action := [annots] start call-action-or-expr
+call-action-or-expr :=
+   function-call-expr
+   | method-call-expr
+   | client-remote-method-call-action
+   | client-resource-access-action
+
+ +

+The keyword start causes the following function or method +invocation to be executed on a new strand. The arguments for the function or +method call are evaluation on the current strand. A start-action returns a value +of basic type future immediately. If the static type of the call expression or +action C is T, then the static type of start +C is future<T>; it is permitted for T to be +never. +

+

+A call-action-or-expr is isolated if the function or method it calls +has a type that is isolated and the expression for every argument is an isolated expression; for this purpose, the +object whose method is called by the method-call-expr or +client-remote-method-call-action is treated as an argument. When a start-action +has a call-action-or-expr that is isolated then +

+
    +
  • the start-action is allowed in an isolated function, and
  • +
  • the strand created by the start-action may run in a separate thread from the +current thread.
  • +
+ +
+
+

7.7 Wait action

+

+A wait-action waits for one or more strands to terminate, and gives access to +their termination values. +

+ +
wait-action :=
+   single-wait-action
+   | multiple-wait-action
+   | alternate-wait-action
+
+wait-future-expr := expression but not mapping-constructor-expr
+
+

+A wait-future-expr is used by a wait-action to refer to the worker to be waited +for. Its static type must be future<T> for some T. As elsewhere, a +wait-future-expr can use an in-scope worker-name in a variable-reference-expr to +refer to named worker. +

+

+Evaluation of a wait-action performs a wait operation on the future value that +results from evaluating a wait-future-expr. This wait operation may complete +normally or abruptly. The wait operation initiates a wait for the strand that +the future refers to. If the wait fails, then the wait operation completes +normally and the result is an error. If the wait succeeds, and the strand +completed normally, then the wait operation completes normally, and the result +is the termination value of the strand. If the wait succeeds, but the strand +completed abnormally, then the wait operation completes abruptly with a panic +and the associated value is the termination value of the strand. +

+

+In addition to a static type, a wait-future-expr has a compile-time eventual +type. If a wait-future-expr is a variable-reference-expr referring to the +worker-name of a named worker with return type T, then the eventual type of the +wait-future-expr is T. Otherwise, the eventual of a wait-future-expr with static +type future<T> is T|error. The result of a wait operation that completes +normally will belong to the eventual type of the wait-future-expr, since the +compiler ensures that a wait for a wait-future-expr that is a variable reference +to a named worker cannot fail. +

+

+Note that it is only possible to wait for a named worker, which will start its +own strand. It is not possible to wait for a function's default worker, which +runs on an existing strand. +

+

+A mapping-constructor-expr is not recognized as a wait-future-expr (it would not +type-check in any case). +

+
+

7.7.1 Single wait action

+ +
single-wait-action := wait wait-future-expr
+
+

+A single-wait-action waits for a single future. +

+

+A single-wait-action is evaluated by first evaluating wait-future-expr resulting +in a value f of basic type future; the single-wait-action then performs a wait +operation on f. +

+

+The static type of the single-wait-action is the eventual type of the +wait-future-expr. +

+
+
+

7.7.2 Multiple wait action

+ +
multiple-wait-action := wait { wait-field (, wait-field)* }
+wait-field :=
+  variable-name
+  | field-name : wait-future-expr
+
+

+A multiple-wait-action waits for multiple futures, returning the result as a +record. +

+

+A wait-field that is a variable-name v is equivalent to a +wait-field v: v, where v must be the name of an +in-scope named worker. +

+

+A multiple-wait-action is evaluated by evaluating each wait-future-expr +resulting in a value of type future for each wait-field. The +multiple-wait-action then performs a wait operation on all of these futures. If +all the wait operations complete normally, then it constructs a record with a +field for each wait-field, whose name is the field-name and whose value is the +result of the wait operation. If any of the wait operations complete abruptly, +then the multiple-wait-action completes abruptly. +

+

+The static type of the multiple-wait-action is a record where the static type of +each field is the eventual type of the corresponding wait-future-expr. +

+
+
+

7.7.3 Alternate wait action

+ +
alternate-wait-action := wait wait-future-expr (| wait-future-expr)+
+
+

+An alternate-wait-action waits for one of multiple futures to terminate. +

+

+An alternate-wait-action is evaluated by first evaluating each wait-future-expr, +resulting in a set of future values. The alternate-wait-action then performs a +wait operation on all of these members of this set. As soon as one of the wait +operations completes normally with a non-error value v, the +alternate-wait-action completes normally with result v. If all of the wait +operations complete normally with an error, then it completes normally with +result e, where e is the result of the last wait operation to complete. If any +of the wait operations completely abruptly before the alternate-wait-action +completes, then the alternate-wait-action completes abruptly. +

+

+The static type of the alternate-wait-action is the union of the eventual type +of all of its wait-future-exprs. +

+
+
+
+

7.8 Worker message passing

+

+Messages can be sent between workers. A message is a value, which must belong to +value:Cloneable. +

+

+Messages can only be sent between workers that are peers of each other. A +function's default worker and its named workers are peers of each other. The +workers created in a fork-stmt are also peers of each other. The workers created +in a fork-stmt are not peers of a function's default worker nor of its named +workers. +

+ +
peer-worker := worker-name | function
+
+

+A worker-name refers to a worker named in a named-worker-decl, which must be in +scope; function refers to the function's default worker. The +referenced worker must be a peer worker. +

+

+Each worker maintains a separate queue for each peer worker to which it sends +messages; thus for each queue a sending worker and a receiving worker, which +must be distinct. A queue has an array of slots together with two integers +w and r that index into the array. Each slot is either +empty or contains a message. The length of each queue's array is determined at +compile-time. When a message is sent, the sending worker writes it to a slot in +the queue. The receiving worker receives the message by reading it from a slot. +Each slot is written to at most once and is read from at most once. +The slots in a queue's array are written to in increasing order, +and are read from in increasing order. +The w and r indices are used to coordinate the sending and +receiving worker: w is incremented by the sending worker as it writes +messages to successive slots in the array; r is incremented by the +receiving worker as it reads messages from successive slots in the array. +The minimum value w and r is 0, and the maximum +is the length of the array of slots. +

+

+A message is sent by a send-action and received by a receive-action. The index +of the slot used by each send-action and receive-action is determined at compile +time. This allows the connection between the send-action and the receive-action +to be shown in the sequence diagram. +There is a one-to-one correspondence between slots and send-actions; there is +a many-to-one correspondence between slots and receive-actions. +It is a compile-time error if a send-action or receive-action occurs in a +syntactic context, such as within the body of a foreach statement, where it +could be executed more than once. +

+

+There are four types determined at compile-time for each slot: +

+
    +
  • a message type: if a message v is written to the slot, then v belongs to the +slot's message type
  • +
  • a no message type: if it is possible for the index w of the queue +to be > i while the slot with index i is empty, then +the no message type of the slot with index i is +error:NoMessage, otherwise it is empty;
  • +
  • a send failure type: this is the type of termination failure in the sending +worker that caused the corresponding message not to be sent; more precisely, for +any slot index i, if it is possible for i to be ≥ +the index w of the queue at the time when the sending worker +completes normally with termination value e, then e +belongs to the send failure type of the slot with index i; it is a +compile-time error if the send failure type is not a (possibly empty) subtype of +error;
  • +
  • a receive failure type: this is the type of termination failure in the +receiving worker that caused the corresponding message not to be received; more +precisely, for any slot index i, if it is possible for i +to be ≥ the index r of the queue at the time when the +receiving worker completes normally with termination value e, then +e belongs to the receive failure type of the slot with index +i; it is a compile-time error if the receive failure type is not a +(possibly empty) subtype of error
  • +
+

+The sections below on Sending messages and +Receiving messages describe +how the sending worker and receiving worker respectively increment the w +and r indices of a queue. +Note that the w index of a queue is updated to the length of the queue's +slot array upon successful termination of the sending worker, but the r +index is not similarly updated by the receiving worker. +The overall effect of this in conjunction with the typing rules is that +a send-action may occur in a conditional context where it may never be executed +but a receive-action may not. +

+ +
+

7.8.1 Sending messages

+ +
send-action := async-send-action | sync-send-action
+
+ +

+A send-action sends a message to the worker that is identified by peer-worker. A +send-action with peer-worker R occurring within worker W is associated with the +queue with sending worker W and receiving worker R. There is a one-to-one +correspondence between the slots in a queue and the send-actions associated with +that queue. The order of the slots in the queue is the same as the syntactic +order of the send-actions. +

+

+An async-send-action sends a message without waiting for it to be received by +the receiving worker. A flush-action on a queue waits until the receiving worker +has received all messages that have been send to the queue. A sync-send-action +is equivalent to an async-send-action followed by a flush-action. +

+

+It is possible that a send-action is not evaluated. This can happen when the +worker containing the send-action terminates with an error or abnormally. It can +also happen when the send-action occurs within a conditional or match statement; +in this case, when there is no longer a possibility that the send-action will be +evaluated, the w index in queue needs to be incremented past the +index of the corresponding slot so as to ensure that a corresponding +receive-action does not wait any longer than necessary. This is achieved by +performing a queue update for every queue for whenever execution of the +sending worker reaches specific points. A queue update is performed for a worker +at a particular execution point by setting the w index to the least +k such that k is > i for every i +where the send-action corresponding to the slot with index i is +syntactically before the execution point. There is a queue update execution +point immediately before every statement that might result in the worker's +strand yielding. A final queue update is also performed if the worker terminates +successfully, by setting w to the length of the queue's array. +

+

+If a worker W is about to terminate normally, and any final queue updates have +been performed, then for each queue for which W is the sending worker, W waits +until either the receiving worker has terminated or the r index is +≥ the w index. If after waiting, the r index is +still < the w index in some queue with receiving worker R, R must +have terminated abnormally, because the rule in the preceding paragraph. In this +case, W terminates abnormally and W will use R's termination value as its +termination value. +

+ + +
+
7.8.1.1 Async send action
+
async-send-action := expression -> peer-worker ;
+
+ +

+The evaluation of a async-send-action starts by evaluating the expression, resulting +in a value v; the Clone abstract operation is then +applied to v resulting in value +c. This value c is then written +to the slot in the associated queue corresponding to the send-action. The index +w in the queue is set to 1 greater than the index of that slot in the +queue. The result of an async-send-action is always (). +

+

+The static type of the expression must be a subtype of +value:Cloneable. The contextually expected type used to interpret +expression is the contextually expected type from the corresponding +receive-action. +

+

+If the slot corresponding to an async-send-action has a non-empty receive +failure type, then it is a compile-time error unless it can be determined that a +sync-send-action or a flush-action will be executed before the sending worker +terminates with success. +

+
+
+
7.8.1.2 Flush action
+ +
flush-action := flush [peer-worker]
+
+

+A flush-action with peer-worker R occurring within worker W is associated with the +queue with sending worker W and receiving worker R. Evaluating +the flush-action flushes the queue up to index +i where i is the number of send-actions in W that syntactically +precede the flush-action. More precisely, the evaluation of a flush-action waits +until either the index r of the queue is ≥ +i or the receiving worker has terminated. It then completes as +follows: +

+
    +
  • if index r of the queue is ≥ i, then normally with +result () +
  • +
  • otherwise +
      +
    • if the receiving worker terminated with failure, then normally with the +result being the the termination value of the receiving worker, which will be an +error;
    • +
    • if the receiving worker terminated abnormally, then abruptly with a panic, +with the associated value being the termination value of the receiving worker.
    • +
    +
  • +
+

+If the flush-action has a preceding async-send-action without any intervening +sync-send-action or other flush-action, then the static type of the flush-action +is F|(), where F is the receive failure type of the slot corresponding to that +async-send-action. Otherwise, the static type of the flush-action is nil. +

+

+If a peer-worker is not specified in the flush-action, then the flush-action +flushes the queues to all other workers. In this case, the static type will be +the union of the static type of flush on each worker separately. +

+
+
+
7.8.1.3 Sync send action
+
sync-send-action := expression ->> peer-worker
+
+

+A sync-send-action E -> R is equivalent to an +async-send-action E ->> R followed by a +flush-action flush R. The static type of the +sync-send-action is the static type of the flush-action. +

+
+
+ +
+

7.8.2 Receiving messages

+ +
receive-action := single-receive-action | multiple-receive-action | alternate-receive-action
+
+

+Each receive-action has one or more references to peer workers. A reference to a +peer-worker W occurring in receive-action within worker R is associated with the +queue with sending worker W and receiving worker R. There is a one-to-one +correspondence between the slots in a queue and the references to +receive-actions associated with that queue. The order of the slots in the queue +is the same as the syntactic order of the references to peer workers. +

+

+A slot with index i in its queue becomes ready when the +index w of the queue is > i. A value can be +received from a slot with index i in a queue as follows. If +the slot is empty, then the receive operation fails; otherwise, the value +received is the value contained in the slot; in either case, the +r index in the queue is set to i + 1. +

+ +
+
7.8.2.1 Single receive action
+ +
single-receive-action := <- peer-worker
+
+

+A single-receive-action receives a message from a single worker, +and accordingly has a reference to single peer worker. +

+

+A single-receive-action associated with a slot is evaluated by waiting until the +slot is ready or the sending worker has terminated. Then +

+
    +
  • if the slot is ready, a value is received from the slot and the evaluation +completes normally, with the result being +
      +
    • if the receive operation fails, a new value of type error:NoMessage;
    • +
    • otherwise, the value received from the slot;
    • +
    +
  • +
  • otherwise, the evaluation completes as follows: +
      +
    • if the sending worker terminated with failure, then normally with the result +being the the termination value of the sending worker, which will be an error;
    • +
    • if the sending worker terminated abnormally, then abruptly with a panic, +with the associated value being the termination value of the sending worker.
    • +
    +
  • +
+

+The static type of the single-receive-action is T|N|F where T is message type of +the associated slot, N is its no message type, and F is its send failure type. +

+
+
+
7.8.2.2 Multiple receive action
+ +
multiple-receive-action :=
+   <-  { receive-field (, receive-field)* }
+receive-field :=
+   peer-worker
+   | field-name : peer-worker
+
+

+A multiple-receive-action receives a message from multiple workers. +

+

+A peer-worker can occur at most once in a multiple-receive-action. +

+

+A receive-field consisting of a peer-worker W is equivalent to a +field W:W. +

+

+A multiple-receive-action is evaluated by waiting until the slot associated +with every peer worker is ready. If, while waiting for a slot, the sending worker +for the queue of that slot terminates, then the evaluation of the +multiple-receive-action completes as follows +

+
    +
  • if the sending worker terminated with failure, then normally with the result +being the the termination value of the sending worker, which will be an error;
  • +
  • if the sending worker terminated abnormally, then abruptly with a panic, +with the associated value being the termination value of the sending worker.
  • +
+

+Otherwise, a value is received from every slot. If any of these receive +operations fail, then the evaluation of the multiple-receive action completes +normally with the result being a new value of type error:NoMessage, +Otherwise, the evaluation completes normally with the result being a new record +value, with one field for each receive-field, where the value of the field is +the value received from the slot. +

+

+The contextually expected typed for the multiple-receive-action determines a +contextually expected type for each receive-field, in the same way as for a +mapping constructor. The contextually expected type for each receive-field +provides the contextually expected type for the expression in the corresponding +send-action. +

+

+The static type of multiple-receive-action is R|N|F where +

+
    +
  • R is a record type, where R is determined in the same way as for a mapping +constructor, where the static type of each field comes from the message type of +the slot and the contextually expected type is the contextually expected type of +the multiple-receive-action
  • +
  • N is the union of the no message types of the slots
  • +
  • F is the union of the send failure types of the slots
  • +
+
+
+
7.8.2.3 Alternate receive action
+ +
alternate-receive-action := <- peer-worker (| peer-worker)+
+
+ +

+An alternate-receive-action receives a message from one of multiple peer-workers. +

+

+As with other receive actions, each reference to a peer worker is associated with a slot in +a queue. An alternate-receive-action is evaluated by repeatedly waiting until either +

+
    +
  • a sending worker terminates abnormally with a panic; in this, case the +evaluation completes abruptly with a panic, with the associated value being the +termination value of the sending worker;
  • +
  • a slot k is ready, and is not empty, and the value in the slot is +not an error; in this case, a value is received from every slot; +the result or failure of these receive operations +is ignored except for slot k; the evaluation completes normally, with +the result being the value received from slot k; or
  • +
  • all sending workers have terminated normally; in this case also, a value is +received from every slot and the evaluation completes normally with the result +of the alternative-receive-action being as follows +
      +
    • if the receive operation of every slot fails, then a new value of type +error:NoMessage;
    • +
    • otherwise, the result of the first receive operation that did not fail, +(in this case, that result will be an error value).
    • +
    +
  • +
+

+The static type of the alternative-receive-action is T|N|F, where T is union of +message type of the associated slots, N is the intersection of the no message +types of the slots and F is the union the send failure type of the slots. +

+ +
+
+
+ +
+

7.9 Outbound network interaction

+ +

+A client object is a stub that allows a worker to send network messages to a +remote system according to some protocol. A local variable declared with client +object type will be depicted as a lifeline in the function's sequence diagram. +

+ +
+

7.9.1 Remote methods

+

+The remote methods of the client object correspond to distinct network messages +defined by the protocol for the role played by the client object. The return +value of a remote method represents the protocol's response. A +client-remote-method-call-action is depicted as a horizontal arrow from the +worker lifeline to the client object lifeline. +

+ +
client-remote-method-call-action := expression -> remote-method-name ( arg-list )
+
+

+Calls a remote method of a client object. This works the same as a method call +expression, except that it is used for a client object method with the +remote qualifier. +

+ +
+ +
+

7.9.2 Resources

+ +
client-resource-access-action :=
+   expression -> / [resource-access-path] [. resource-method-name] [( arg-list )]
+
+resource-access-path :=
+   resource-access-path-segments [/ resource-access-rest-segment]
+   | resource-access-rest-segment
+
+resource-access-path-segments :=
+   resource-access-path-segment (/ resource-access-path-segment )* 
+
+resource-access-path-segment :=
+   resource-path-segment-name
+   | computed-resource-access-path-segment
+
+computed-resource-access-path-segment := [ expression ]
+
+resource-access-rest-segment := [ spread ]
+
+

+A client-resource-access-action performs a resource access operation on a client object. An +omitted resource-method-name defaults to get; if the +parentheses and the arg-list are omitted, then they default to +(), with arguments being defaulted as usual. +

+

+A client-resouce-access-action is evaluated by: +

+
    +
  • evaluating the code expression preceding the -> resulting in +a client object c;
  • +
  • evaluating the resource-access-path to get a list of values +p +
      +
    • a resource-access-path that is just makes p be +an empty list
    • +
    • a resource-path-segment-name appends a string to p +
    • +
    • a computed-resource-access-path-segment is evaluated and the +result is appended to p;
    • +
    • a resource-access-rest-segment is evaluated and every member +of the result, which must be a list, is appended to p;
    • +
    +
  • +
  • evaluating the arg-list to get an argument list +a;
  • +
  • invoking the resource access operation on the c using the +resource-method-name, p and a, resulting in a value +v.
  • +
+

+The result of the client-resource-access-action is v. +

+

+The static type of the client object must contain a resource with specified +method name for every list value that may be constructed by the evaluation of +the resource-access-path. The argument list and result value are +typed using the intersection of the function types allowed for the method name +with any of the resource paths. +

+ +
+
+
+

7.10 Query action

+
query-action := query-action-pipeline do-clause
+do-clause := do statement-block
+
+

+The clauses in the query-pipeline of query-action are executed in the same way +as the clauses in the query-pipeline of a query-expr. +

+

+The query-action is executed as follows. For each input frame f +emitted by the query-pipeline, execute the statement-block with f in +scope. If a clause in the query-pipeline completes early with error +e, the result of the query-action is e. Otherwise, the +result of the query-action is nil. +

+ +
+ +
+

7.11 Local variable declaration statements

+ +
local-var-decl-stmt :=
+   local-init-var-decl-stmt
+   | local-no-init-var-decl-stmt
+local-init-var-decl-stmt :=
+   [annots] [final] typed-binding-pattern = action-or-expr ;
+
+

+A local-var-decl-stmt is used to declare variables with a scope +that is local to the block in which they occur. +

+

+The scope of variables declared in a local-var-decl-stmt starts +immediately after the statement and continues to the end of the statement block +in which it occurs. +

+

+A local-init-var-decl-stmt is executed by evaluating the action-or-expr +resulting in a value, and then matching the typed-binding-pattern to the value, +causing assignments to the variables occurring in the typed-binding-pattern. The +typed-binding-pattern is used unconditionally, meaning that it is a compile +error if the static types do not guarantee the success of the match. If the +typed-binding-pattern uses var, then the type of the variables is +inferred from the static type of the action-or-expr; if the +local-init-var-decl-stmt includes final, the precise type is used, and otherwise +the broad type is used. If the typed-binding-pattern specifies a +type-descriptor, then that type-descriptor provides the contextually expected +type for action-or-expr. +

+

+If final is specified, then the variables declared must not be +assigned to outside the local-init-var-decl-stmt. +

+ +
local-no-init-var-decl-stmt :=
+   [annots] [final] type-descriptor variable-name ;
+
+

+A local variable declared local-no-init-var-decl-stmt must be +definitely assigned at each point that the variable is referenced. This means +that the compiler must be able to verify that the local variable will have been +assigned before that point. If final is specified, then the +variable must not be assigned more than once. The type-descriptor +must not be never. +

+
+
+

7.12 Conditional variable type narrowing

+

+Usually the type of a reference to a variable is determined by the variable's +declaration, either explicitly specified by a type descriptor or inferred from +the static type of the initializer. However, the language also recognizes two +kinds of case where the way a local variable or parameter is used means that is +known at compile-time that within a particular region of code the value of the +variable will belong to a type that is narrower than the declared type. In these +cases, references to the variable within particular regions of code will have a +static type that is narrower that the variable type. One kind of case, which is +described in this section, is when a variable is used in a boolean expression in +a conditional context. This is sometimes called occurrence typing. The +other kind of case is when a variable is used in a match statement; this is +described in the Match statement section. +

+

+Type narrowing makes use of the read-only difference between two types, +which is defined as follows. We use the notation T +−ro S for the read-only difference of T and S. T +−ro S is computed separately for each uniform type. +Let TU be the subset of T belonging to uniform type U, i.e. the +intersection of T and U. For a uniform type U that is immutable, TU +−ro SU is the same as TU - +SU (set difference); for a uniform type U that is mutable, +TUro SU is empty if +TU is a subset of SU, and TU otherwise. T +−ro S is the union for every uniform type U of +TUro SU. This definition of +read-only difference ensures that if a value x belongs to T but not does not +belong to S, then x belongs to T −ro S. +

+

+Given an expression E with static type boolean, and a variable x with static +type Tx, we define how to determine +

+
    +
  • a narrowed type for x implied by truth of E, and
  • +
  • a narrowed type for x implied by falsity of E.
  • +
+

+based on the syntactic form of E as follows. +

+
    +
  • If E has the form x is T, then +
      +
    • the narrowed type for x implied by truth of E is the intersection of Tx and +T
    • +
    • the narrowed type for x implied by falsity of E is Tx +−ro T
    • +
    +
  • +
  • If E has the form x == E1 or E1 +== x where the static type of E1 is an expression whose +static type is a singleton simple type T1, then +
      +
    • the narrowed type for x implied by truth of E is the intersection of Tx and +T1 +
    • +
    • the narrowed type for x implied by falsity of E is Tx +−ro T1 +
    • +
    +
  • +
  • If E has the form x != E1 or E1 +!= x where the static type of E1 is an expression whose +static type is a singleton simple type T1, then +
      +
    • the narrowed type for x implied by truth of E is Tx +−ro T1 +
    • +
    • the narrowed type for x implied by falsity of E is the intersection of Tx +and T1 +
    • +
    +
  • +
  • If E has the form !E1, then +
      +
    • the narrowed type for x implied by truth of E is the narrowed type for x +implied by falsity of E1 +
    • +
    • the narrowed type for x implied by falsity of E is the narrowed type for x +implied by truth of E1 +
    • +
    +
  • +
  • If E has the form E1 && E2 +
      +
    • the narrowed type for x implied by truth of E is the intersection of +T1 and T2, where T1 is the narrowed type for x +implied by the truth of T1 and T2 is the narrowed type for +x implied by the truth of T2 +
    • +
    • the narrowed type for x implied by falsity of E is +T1|T2, where T1 is the narrowed type for x +implied by the falsity of E1, and T2 is the intersection +of T3 and T4, where T3 is the narrowed type for +x implied by the truth of E1 and T4 is the narrowed type +for x implied by the falsity of E2 +
    • +
    +
  • +
  • If E has the form E1 || E2, then +
      +
    • the narrowed type for x implied by truth of E is +T1|T2, where T1 is the narrowed type for x +implied by the truth of E1, and T2 is the intersection of +T3 and T4, where T3 is the narrowed type for x +implied by the falsity of E1 and T4 is the narrowed type +for x implied by the truth of E2 +
    • +
    • the narrowed type for x implied by falsity of E is the intersection of +T1 and T2, where T1 is narrowed type for x +implied by the falsity of E1 and T2 is the narrowed type +for x implied by the falsity of E2 +
    • +
    +
  • +
  • If E has any other form, then +
      +
    • the narrowed type for x implied by the truth of E is Tx
    • +
    • the narrowed type for x implied by the falsity of E is Tx
    • +
    +
  • +
+

+Narrowed types implied by the truth or falsity of an expression apply to regions +of code as follows: +

+
    +
  • in an expression E1 || E2, the narrowed +types implied by the falsity of E1 apply within E2 +
  • +
  • in an expression E1 && E2, the +narrowed types implied by the truth of E1 apply within +E2 +
  • +
  • in an expression E1 ? E2 : +E3, the narrowed types implied by the truth of E1 apply +within E2 and the narrowed types implied by the falsity of +E1 apply within E3 +
  • +
  • in a statement if E1 B1 else +B2, the narrowed types implied by the truth of E1 apply +within B1 and the narrowed types implied by the falsity of +E1 apply within B2 +
  • +
  • in a statement while E B, the narrowed types implied by the truth of E +apply with B
  • +
  • in a match-clause P if E => B, the narrowed types +implied by the truth of E apply within B
  • +
  • in a query-expr or query-action, the narrowed types implied by the truth of +the expression in a where-clause apply within all following clauses in that +query-expr or query-action
  • +
+

+Given a statement or statement-block S, and a variable x that is in-scope for S +and has static type Tx, we define how to determine a narrowed type for x implied +by the normal completion of S as follows. +

+
    +
  • When it is not possible for S to complete normally, then the narrowed type for x implied by the normal completion of S is never (the empty type).
  • +
  • If S has the form { S1 S2 ... +Sn }, then the narrowed type for x implied by the normal +completion of S is the narrowed type for x implied by the normal completion of +Sn.
  • +
  • If S has the form do B, the narrowed type for x implied by the +normal completion of S is the narrowed type for x implied by the normal +completion of B.
  • +
  • If S has the form if E B1 else +B2, the narrowed type for x implied by the normal completion of S is +the union of T1 and T2, where T1 is the +narrowed type for x implied by the normal completion of B1 and +T2 is the narrowed type for x implied by the normal completion of +B2. (The truth or falsity of E may imply a narrowed type for x that +applies in B1 or B2, which may affect the narrowed type +for x implied by the normal completion of B1 or B2.)
  • +
  • Otherwise, the narrowed type for x implied by the completion of S is Tx.
  • +
+

+The narrowed types implied by the normal completion of a statement are applied +within a statement-block as follows: in a statement-block { +S1 S2 ... Sn }, for each i in 2,..., n, the +narrowed types implied by the normal completion of Si - 1 apply to +Si. +

+

+In the above rules, a if-else-stmt without an else clause is +treated as if it had an else followed by an empty statement-block, +and else if clause is treated like a nested if-else-stmt. +

+

+A narrowed type for a variable x implied by an expression in which x occurs +ceases to apply in a region of code where there is a possibility at runtime that +x has been assigned to since the evaluation of the expression. It is an error if +this results in the type of a variable reference being affected by assignments +that lexically follow the variable reference. Specifically, when a variable x is +narrowed outside a while-stmt, foreach-stmt or query-action S, an assignment to +x within S must not result in the possibility of x having being assigned to when +the statement-block of S completes normally or when a continue-stmt is executed. +

+ +
+
+

7.13 XML namespace declaration statement

+ +
xmlns-decl-stmt := xmlns-decl
+xmlns-decl := xmlns xml-namespace-uri [ as xml-namespace-prefix ] ;
+xml-namespace-uri := simple-const-expr
+xml-namespace-prefix := identifier
+
+

+An xmlns-decl is used to declare a XML namespace. If there is +an xml-namespace-prefix, then the in-scope namespaces that are used +to perform namespace processing on an xml-template-expr will include a +binding of that prefix to the specified xml-namespace-uri; +otherwise the in-scope namespaces will include a default namespace with the +specified xml-namespace-uri. +

+

+An xml-namespace-prefix declared by an xmlns-decl +is in the same symbol space as a module-prefix declared by an +import-decl. This symbol space is distinct from a module's main +symbol space used by other declarations. An xmlns-decl in a +xmlns-decl-stmt declares the prefix within the scope of the current +block. +

+

+The prefix xmlns is predeclared as +http://www.w3.org/2000/xmlns/ and cannot be redeclared. +

+

+The static type of the simple-const-expr must be a subtype of +string. +

+
+
+

7.14 Assignment

+ +

+There are three kinds of assignment statement: +

+
    +
  • an ordinary assignment statement, which is usually called simply an +assignment statement,
  • +
  • a compound assignment statement, and
  • +
  • a destructuring assignment statement.
  • +
+

+The first two of these build on the concept of an lvalue, whereas the +last one builds on the concept of a binding pattern. +

+ +
+

7.14.1 Lvalues

+ +

+An lvalue is what the left hand side of an assignment evaluates to. An lvalue +refers to a storage location which is one of the following: +

+
    +
  • a variable;
  • +
  • a specific named field of an object;
  • +
  • the member of a structured value having a specific out-of-line key, which +will be either an integer or a string according as the structured value is a +list or a mapping.
  • +
+

+Note that an lvalue cannot refer to a member of a table. +

+ +

+An lvalue that is both defined and initialized refers to a storage location that +holds a value: +

+
    +
  • an lvalue referring to a variable is always defined but may be +uninitialized;
  • +
  • an lvalue referring to a specific named field of an object is always defined +but may not be initialized until the init method returns
  • +
  • an lvalue referring to member of a structured value having a specific key is +undefined if the structured value does not have a member with that key; if such an +lvalue is defined, it is also initialized; note that an lvalue always refers to +a structured value that is already constructed.
  • +
+ +
lvexpr :=
+   variable-reference-lvexpr
+   | field-access-lvexpr
+   | member-access-lvexpr
+
+ +

+The left hand side of an assignment is syntactically a restricted type of +expression, called an lvexpr. When the evaluation of an lvexpr completes +normally, its result is an lvalue. The evaluation of an lvexpr can also complete +abruptly, with a panic or check-fail, just as with the evaluation of an +expression. +

+

+The compiler determines a static type for each lvexpr just as it does for +expressions, but the meaning is slightly different. For an lvexpr L to have +static type T means that if the runtime evaluation of L completes normally +resulting in an lvalue x, then if x is defined and initialized, it refers to a +storage location that holds a value belonging to type T. In addition to a type, +the compiler determines for each lvexpr whether it is potentially undefined and +whether it is potentially uninitialized. +

+

+An lvalue supports four operations: store, remove, read and filling-read. +

+

+The fundamental operation on an lvalue is to store a value in the storage +location it refers to. This operation does not required the lvalue to be defined +or initialized; a successful store operation on an undefined lvalue will result +in the addition of a member to the structured value; a store on an uninitialized lvalue +will initialize it. When an lvalue refers to a variable, it is possible to +determine at compile-time whether the store of a value is permissible based on +the declaration of the variable and the static type of the value to be stored. +However, when the lvalue refers to a member of a structured value, this is not in +general possible for three reasons. +

+
    +
  1. The guarantee provided by an lvalue having a static type T is not that the +referenced storage location can hold every value that belongs to type T; rather +the guarantee is that every value that the referenced storage location can hold +belongs to type T. This is because structured types are covariant in their +member types. The values that the storage location can actually hold are +determined by the inherent type of the structured value.
  2. +
  3. The member may not be defined and the inherent type of the structured value may not +allow a member with that specific key. The permissible keys of a structured value can +be constrained by closed record types, fixed-length array types, and tuple types +(with any rest descriptor).
  4. +
  5. The structured value may be immutable. The static type of an lvalue referring to a +member of a structured value makes no guaranteees that the structured value is not immutable.
  6. +
+

+The first of these reasons also applies to lvalues that refer to fields of +objects. Accordingly, stores to lvalues other than lvalues that refer to +variables must be verified at runtime to ensure that they are not impermissible +for any of the above three reasons. An attempt to perform an impermissible store +results in a panic at runtime. +

+

+List values maintain the invariant that there is a unique integer n, the length +of the list, such that a member k of the list is defined if and only if k is a +non-negative integer less than n. When a store is performed on an lvalue +referring to a member k of a list value and the length of the list is n and k is +> n, then each member with index i for each ≤ i < k is filled in, by +using the FillMember abstract operation. The FillMember abstract operation may +fail; in particular it will fail if the list is a fixed-length array. If the +FillMember operation fails, then the attempt to store will panic. +

+

+An lvalue that refers to a member of a mapping value supports a remove +operation, which removes any member with the specific key referred to by the +lvalue. The removal may be impermissible because it the inherent type of the +mapping value requires a member with this key or because the mapping value is +immutable. As with a store operation, a remove operation must be verified at +runtime to ensure that it is not impermissible; an attempt to perform an +impermissible remove operation will result in a panic at runtime. Performing the +remove operation on a member that is not present has no effect, but is not an +error. +

+

+An lvalue also allows a read operation, which is used by the compound assignment +statement. Unlike a store operation, a read operation cannot result in a runtime +panic. A read operation cannot be performed on an lvalue that is undefined or +uninitialized. +

+

+Finally, a lvalue supports a filling-read operation, which is used to support +chained assignment. A filling-read is performed only an lvalue with a static +type that is a structured type. It differs from a read operation only when it is +performed on a potentially undefined lvalue. If the lvalue is undefined at +runtime, then the filling-read will use the FillMember abstract operation on the +member that the lvalue refers to. If the FillMember operation fails, then the +filling-read panics. Unlike the read operation, the filling-read operation can +be performed on an undefined lvalue; it cannot, however, be performed on an +uninitialized lvalue. +

+

+The evaluation of an lvexpr is specified in terms of the evaluation of its +subexpressions, the evaluation of its sub-lvexprs, and store and +filling-read operations on lvalues. If any of these result in a panic, then +the evaluation of the lvexpr completes abruptly with a panic. +

+ +
variable-reference-lvexpr := variable-reference
+
+

+The result of evaluating variable-reference-lvexpr is an lvalue referring to a +variable. Its static type is the declared or inferred type of the variable. The +lvexpr is potentially uninitialized if it is possible for execution to have +reached this point without initializing the referenced variable. +

+

+A variable-reference-lvexpr that refers to a variable declared by a +module-var-decl that includes isolated is only allowed within a +lock-stmt. +

+ +
field-access-lvexpr := lvexpr . field-name
+
+ +

+The static type of lvexpr must be either a subtype of the mapping basic type +or a subtype of the object basic type. +

+

+In the case where the static type of lvexpr is a subtype of the object basic +type, the object type must have a field with the specified name, and the +resulting lvalue refers to that object field. +

+

+In the case where the static type of lvexpr is a subtype of the mapping basic +type, the semantics are as follows. +

+
    +
  • The following requirements apply at compile time: the type of lvexpr must +include mapping shapes that have the specified field-name; type descriptor for +lvexpr must include field-name as an individual-field-descriptor (if +lvexpr is a union, then this requirement applies to every member of the union); +lvexpr must not be potentially uninitialized, but may be potentially +undefined.
  • +
  • +It is evaluated as follows: +
      +
    1. evaluate lvexpr to get lvalue lv;
    2. +
    3. perform a filling-read operation on lv to get mapping value +m;
    4. +
    5. the result is an lvalue referring to the member of m with the +specified field-name.
    6. +
    +
  • +
  • The static type of the field-access-expr is the member type for the key type +K in T, where T is the static type of the lvexpr and K is the singleton string +type containing the field-name; the field-access-expr is potentially undefined +if K is an optional key type for T.
  • +
+ +
member-access-lvexpr := lvexpr [ expression ]
+
+

+The static type of lvexpr must be either a subtype of the mapping basic type or +a subtype of the list basic type. In the former case, the contextually expected +type of expression must be string and it is an error if the static type of +expression is not string; in the latter case, the contextually expected type of +expression must be int and it is an error if the static type of expression is +not int. +

+

+It is evaluated as follows: +

+
    +
  1. evaluate expression to get a string or int k;
  2. +
  3. evaluate lvexpr to get lvalue lv;
  4. +
  5. perform a filling-read operation on lv to get a list or mapping value +v;
  6. +
  7. the result is an lvalue referring to the member of c with key +k.
  8. +
+

+The static type of the member-access-lvexpr is the member type for the key type K +in T, where T is the static type of the lvexpr and K is the static type type of +expression; the member-access-lvexpr is potentially undefined if K is an optional +key type for T. +

+ +
+
+

7.14.2 Assignment statement

+ +
assignment-stmt := lvexpr = action-or-expr ;
+
+

+An assignment-stmt stores the value that results from evaluating action-or-expr +in the storage location referred to by lvexpr. When lvexpr is potentially +undefined and has a static type that does not include nil, then a value of nil +means to remove the member referred to by the lvexpr. +

+

+The static type of action-or-expr must be a subtype of the union of nil and the +static type of lvexpr. If the static type of action-or-expr allows nil, but the +static type of lvexpr does not allow nil, then lvexpr must refer to a member of +a mapping value and must be be potentially undefined. The static type of lvexpr +provides the contextually expected type for action-or-expr. It is not an error +for lvexpr to be potentially undefined or potentially uninitialized. +

+

+An assignment-stmt is executed at as follows: +

+
    +
  1. execute action-or-expr to get a value v;
  2. +
  3. evaluate lvexpr to get an lvalue lv;
  4. +
  5. if v is nil but the static type of lvexpr does not allow nil, +then perform the remove operation on lv; otherwise, perform the store +operation on lv with value v.
  6. +
+ +
+
+

7.14.3 Compound assignment statement

+ +
compound-assignment-stmt := lvexpr CompoundAssignmentOperator action-or-expr ;
+CompoundAssignmentOperator := BinaryOperator =
+BinaryOperator := + | - | * | / | & | | | ^ | << | >> | >>>
+
+

+It is a compile error if lvexpr is potentially undefined unless the static type +of lvexpr is a subtype of the list basic type. It is a compile error if lvexpr +is potentially uninitialized. +

+

+Let T1 be the static type of lvexpr, and let T2 be the static type of +action-expr. Let E be an expression E1 BinaryOperator E2, where E1 has type T1 +and E2 has type T2. E must be valid according to the static typing rules +applicable to the underlying form of the BinaryOperator (not the lifted form +described in the Nil lifting section). Let T be the +static type of E according to those rules. It is a compile error if T is not a +subtype of T1. +

+

+A compound-assignment-stmt is executed as follows: +

+
    +
  1. execute action-or-expr to get a value v2;
  2. +
  3. evaluate lvexpr to get an lvalue lv;
  4. +
  5. if lv is undefined, panic (lv must refer to an +undefined member of a list)
  6. +
  7. perform the read operation on lv to get a value +v1 +
  8. +
  9. perform the operation specified by BinaryOperator on operands v1 +and v2, resulting in a value v3 +
  10. +
  11. perform the store operation on lv with value v3.
  12. +
+ +
+
+

7.14.4 Destructuring assignment statement

+ +
destructuring-assignment-stmt :=
+   binding-pattern-not-variable-reference = action-or-expr ;
+binding-pattern-not-variable-reference :=
+   wildcard-binding-pattern
+   | list-binding-pattern
+   | mapping-binding-pattern
+   | error-binding-pattern
+
+

+A destructuring assignment is executed by evaluating the action-or-expr +resulting in a value v, and then matching the binding pattern to v, causing +assignments to the variables occurring in the binding pattern. +

+

+The binding-pattern has a static type implied by the static type of the +variables occurring in it. The static type of action-or-expr must be a subtype +of this type. +

+

+A binding pattern within a destructuring assignment must not refer to a variable +declared by a module-var-decl that includes isolated. +

+

+Note that a destucturing-assignment-stmt with a wildcard-binding-pattern can +be used to ensure that a a variable has been narrowed as expected. +

+
+type T X|Y|Z;
+function foo(T v) {
+   if v is X {
+       handleX(v);
+   }
+   else if v is Y {
+       handleY(v);
+   }
+   else {
+     Z _ = v;
+     handleOther(v);
+   }
+}
+
+

+If T is subsequently modified to add another possibility in +addition to X, Y and Z, then +foo will get a compile error. +

+
+
+
+

7.15 Action statement

+ +
action-stmt := action ;
+
+

+An action-stmt is a statement that is executed by evaluating an action and +discarding the resulting value, which must be nil. It is a compile-time error if +the static type of an action in an action-stmt is not nil. +

+
+
+

7.16 Call statement

+ +
call-stmt := call-expr ;
+call-expr := function-call-expr | method-call-expr
+
+

+A call-stmt is executed by evaluating call-expr as an expression and discarding +the resulting value, which must be nil. The static type of the call-expr in a +call-stmt must be either () or never. If it is +never, then it is possible for the call-stmt to complete normally. +

+
+
+

7.17 Checking statement

+ +
checking-stmt := checking-action-or-expr ;
+
+

+A checking-stmt is executed by evaluating checking-action-or-expr as an +expression and discarding the resulting value, which must be nil. The static +type of the checking-action-or-expr in a checking-stmt must be (). +

+
+
+

7.18 Conditional statement

+ +
if-else-stmt :=
+   if expression statement-block 
+   [ else if expression statement-block ]* 
+   [ else statement-block ]
+
+

+The if-else statement is used for conditional execution. +

+

+The static type of the expression following if must be boolean. +When an expression is true then the corresponding statement block is executed +and the if statement completes. If no expression is true then, if the else block +is present, the corresponding statement block is executed. +

+
+
+

7.19 Do statement

+
do-stmt := do statement-block
+
+

+A do-stmt is executed by executing its +statement-block. +

+
+
+

7.20 Match statement

+ +
match-stmt := match match-target { match-clause+ }
+match-target := action-or-expr
+match-clause :=
+  match-pattern-list [match-guard] => statement-block
+match-guard := if match-guard-expr
+
+

+A match statement selects a statement block to execute based on which patterns a +value matches. +

+

+A match-stmt is executed as follows: +

+
    +
  1. the match-target is evaluated resulting in some value v, called the +target value;
  2. +
  3. for each match-clause in order: +
      +
    1. a match of match-pattern-list against v is attempted
    2. +
    3. if the attempted match fails, the execution of the match-stmt continues to +the next match-clause
    4. +
    5. if the attempted match succeeds, then the variables in match-pattern are +created
    6. +
    7. if there is a match-guard, then the expression in match-guard is executed +resulting in a value b
    8. +
    9. if b is false, then the execution of the match-stmt continues to the next +match-clause
    10. +
    11. otherwise, the statement-block in the match-clause is executed
    12. +
    13. execution of the match-stmt completes
    14. +
    +
  4. +
+

+The scope of any variables created in a match-pattern-list of a match-clause is +both the match-guard, if any, and the statement-block in that match-clause. The +static type of the expression in match-guard must be a subtype of boolean. +

+ +
match-guard-expr := expression
+
+

+A match-guard-expr must not include a function-call-expr or +method-call-expr unless either +

+
    +
  • the static type of the action-or-expr following +match is a subtype of readonly; or
  • +
  • the function or method being called is isolated and the static +type of every argument to the function or method is a subtype of +readonly; in the case of a method-call-expr, the static type of the +object whose method is being called must also be a subtype of +readonly.
  • +
+ +
+

7.20.1 Match patterns

+
match-pattern-list := 
+  match-pattern (| match-pattern)*
+
+

+A match-pattern-list can be matched against a value. An attempted match can +succeed or fail. A match-pattern-list is matched against a value by attempting +to match each match-pattern until a match succeeds. +

+

+All the match-patterns in a given match-pattern-list must bind the same set of +variables. +

+ +
match-pattern :=
+  var binding-pattern
+   | wildcard-match-pattern
+   | const-pattern
+   | list-match-pattern
+   | mapping-match-pattern
+   | error-match-pattern
+
+

+A match-pattern combines the destructuring done by a binding-pattern with the +ability to match a constant value. +

+

+Note that an identifier can be interpreted in two different ways within a +match-pattern: +

+
    +
  • in the scope of a var, an identifier names a variable which is +to be bound to a part of the matched value when a pattern match succeeds;
  • +
  • outside the scope of a var, an identifier references a constant that a value +must match for the pattern match to succeed.
  • +
+

+A match-pattern must be linear: a variable that is to be bound cannot occur more +than once in a match-pattern. +

+ +
const-pattern := simple-const-expr
+
+

+A const-pattern denotes a single value. Matching a const-pattern denoting a +value p against a value v succeeds if DeepEquals(p,v) is true. The static type +of the simple-const-expr in a const-pattern must be a subtype of anydata. +Successfully matching a const-pattern does not cause any variables to be +created. +

+

+Matching a wildcard-match-pattern against a value succeeds if the value belongs to +type any, in other words if the basic type of the value is not error. +

+ +
wildcard-match-pattern := _
+list-match-pattern := [ list-member-match-patterns ]
+list-member-match-patterns :=
+   match-pattern (, match-pattern)* [, rest-match-pattern]
+   | [ rest-match-pattern ]
+mapping-match-pattern := { field-match-patterns }
+field-match-patterns :=
+   field-match-pattern (, field-match-pattern)* [, rest-match-pattern]
+   | [ rest-match-pattern ] 
+field-match-pattern := field-name : match-pattern
+rest-match-pattern := ... var variable-name
+error-match-pattern := error [error-type-reference] ( error-arg-list-match-pattern )
+error-arg-list-match-pattern :=
+   error-message-match-pattern [, error-cause-match-pattern] [, error-field-match-patterns]
+   | [error-field-match-patterns]
+error-message-match-pattern := simple-match-pattern
+error-cause-match-pattern := simple-match-pattern | error-match-pattern
+simple-match-pattern :=
+   wildcard-match-pattern
+   | const-pattern
+   | var variable-name
+error-field-match-patterns :=
+   named-arg-match-pattern (, named-arg-match-pattern)* [, rest-match-pattern]
+   | rest-match-pattern
+named-arg-match-pattern := arg-name = match-pattern
+
+ +

+Matching a mapping-match-pattern against a mapping value succeeds +if and only every field-match-pattern matches against a field of +the value. The variable in the rest-match-pattern, if specified, is +bound to a new mapping that contains just the fields for which that did not +match a field-match-pattern. +

+

+For every match pattern, there is a set of shapes that the pattern matches. The +type corresponding to the match pattern is the type containing these shapes. The +value matches the pattern if and only if it looks like the type. A mutable value +thus can match the pattern without belonging to the corresponding type. However, +an immutable value that matches the pattern will always belong to the type. +In particular, for the match of an error-match-pattern with an +error-type-reference against an error value to succeed, the +error value must belong to the referenced error type. +

+
+ +
+

7.20.2 Match clause reachability and narrowing

+

+This section uses the read-only intersection between two types, which +is defined analogously to the read-only difference used for conditional variable +type narrowing as follows. We use the notation T &ro S for the +read-only intersection of T and S. T &ro S is computed separately +for each uniform type. Let TU be the subset of T belonging to uniform +type U, i.e. the intersection of T and U. For a uniform type U that is +immutable, TU &ro SU is the same as +TU & SU; for a uniform type U that is mutable, +TU &ro SU is empty if TU & +SU is empty, and TU otherwise. T &ro S is +the union for every uniform type U of TU &ro +SU. Note that the read-only intersection operation is not +commutative. +

+

+A match-clause is defined to be unguarded if it does not +have a match-guard or if the static type of the expression in the +match-guard is singleton true. +

+

+For each match-clause C, we can compute a type L that the target +value must look like if the statement-block of C is +executed. L is computed as the difference of a positive type P and negative type +N, where +

+
    +
  • P is the union of the types corresponding to the match patterns in the +match-pattern-list of C, and
  • +
  • N is the union of the types corresponding to the match patterns in the +match-pattern-list of every unguarded match-clause +that precedes C.
  • +
+

+Let T be the static type of the match-target. If the intersection +of T and L is empty, then it is not possible for the +match-pattern-list of C to match, and accordingly the statements in +the statement-block of C are not reachable. If the match-target is +a variable-reference, then the type of the referenced variable is +narrowed to T &ro L within the match-guard, if any, +and the statement-block of C. If there is a +match-guard, then the type narrowing described in Conditional variable type +narrowing is in addition applied to the statement-block +

+

+A match-stmt is exhaustive if and only if the static type +of the match-target is a subtype of union of the type corresponding +to the match patterns of the match-pattern-list of every unguarded +match clause. A match-stmt that is exhaustive can complete normally +only if at least one of its statement-blocks can complete normally. +

+
+
+
+

7.21 Loops

+
+

7.21.1 Foreach statement

+ +
foreach-stmt :=
+   foreach typed-binding-pattern in action-or-expr statement-block
+
+

+A foreach statement iterates over an iterable value, executing a statement block +once for each value in the iterable value's iteration sequence. The static type +of action-or-expr must be an iterable type with an iteration completion type of +nil. +

+

+The scope of any variables created in typed-binding-pattern is statement-block. These +variables are implicitly final. +

+

+In more detail, a foreach statement executes as follows: +

+
    +
  1. evaluate the action-or-expr resulting in a value c
  2. +
  3. create an iterator object i from c as follows +
      +
    1. if c is a basic type that is iterable, then i is the result of calling +c.iterator()
    2. +
    3. if c is an object and c belongs to Iterable<T,()> for some T, then i is the +result of calling c.iterator()
    4. +
    +
  4. +
  5. call i.next() resulting in a value n
  6. +
  7. if n is nil, then the execution of the foreach statement completes normally
  8. +
  9. match typed-binding-pattern to n.value causing assignments to any variables +that were created in typed-binding-pattern
  10. +
  11. execute statement-block with the variable bindings from step 5 in scope; in the +course of so doing +
      +
    1. the execution of a break-stmt causes execution of the foreach statement to +complete normally
    2. +
    3. the execution of a continue-stmt causes a transfer of control to step 3
    4. +
    +
  12. +
  13. go back to step 3
  14. +
+

+In step 2, the compiler will give an error if the static type of expression is +not suitable for 2a or 2b. +

+

+In step 5, the typed-binding-pattern is used unconditionally, and the compiler +will check that the static types guarantee that the match will succeed. If the +typed-binding-pattern uses var, then the type will be inferred from the type of +action-or-expr. +

+
+
+

7.21.2 While statement

+ +
while-stmt := while expression statement-block
+
+

+A while statement repeatedly executes a statement block so long as a +boolean-valued expression evaluates to true. +

+

+In more detail, a while statement executes as follows: +

+
    +
  1. evaluate expression;
  2. +
  3. if expression evaluates to false, terminate execution of the while +statement;
  4. +
  5. execute statement-block; in the course of so doing +
      +
    1. the execution of a break-stmt results in the execution of the +while statement completing normally
    2. +
    3. the execution of a continue-stmt causes a transfer of control to +step 1
    4. +
    +
  6. +
  7. go back to step 1.
  8. +
+

+The static type of expression must be a subtype of boolean. +

+
+
+

7.21.3 Continue statement

+ +
continue-stmt := continue ;
+
+

+A continue statement is only allowed if it is lexically within a while-stmt or a +foreach-stmt. Execution a continue statement results in a transfer of control +that causes the execution of the outermost statement-block in the nearest +enclosing while-stmt or foreach-stmt to complete normally. +

+
+
+

7.21.4 Break statement

+ +
break-stmt := break ;
+
+

+A break statement is only allowed if it is lexically within a while-stmt or a +foreach-stmt. Execution of a break statement results in a transfer of control +that causes the execution of nearest enclosing while-stmt or foreach-stmt to +complete normally. +

+
+
+ +
+

7.22 Lock statement

+
lock-stmt := lock statement-block
+
+ +

+A lock-stmt executing in the context of some strand must execute its statement-block +in such a way that the effect on the state of the program is consistent with the +execution of the statement-block not being interleaved with the execution of a +lock-stmt on any other strand. +

+

+A naive implementation can simply acquire a single, program-wide, recursive mutex +before executing a lock statement, and release the mutex after completing the +execution of the lock statement. A more sophisticated implementation can perform +compile-time analysis to infer a more fine-grained locking strategy that will +have the same effects as the naive implementation. +

+

+It is not allowed to start a new strand within a lock. More precisely, when a +strand has started but not yet completed the execution of a lock-stmt, the +execution of a named-worker-decl or a start-action on that strand will result in +a panic. It is a compile-time error for a named-worker-decl or start-action to +occur lexically within a lock-stmt. The compiler may also give a compile-time +error if a function definition contains a named-worker-decl or start-action, and +there is a function call lexically within the lock-stmt that might result +directly or indirectly in a call to that defined function. +

+

+It is a compile-time error if a lock-stmt contains a sync-send-action or a receive-action. +

+

+There are two cases where a variable is restricted to be used only within a +lock statement: +

+
    +
  • when the variable is an isolated module-level variable; since isolated +module-level variables are not allowed to be public, this restriction applies to +all functions in the module;
  • +
  • when the variable is self within an isolated object and +self occurs in a field-access-expr self.x, +unless the field x is isolated; since non-isolated +fields are required to be private, this restriction applies only to the object's +methods.
  • +
+

+When a lock statement contains one of the above two cases of restricted variable +usage, the lock statement is subject to the following additional requirements, +which maintain the invariant that the restricted variable is an isolated root. +

+
    +
  • Only one such variable can occur in the lock statement.
  • +
  • A function or method can be called in the lock statement only if the type of +the function is isolated.
  • +
  • Transferring values out of the lock statement is constrained: the expression +following a return statement must be an isolated expression; an assignment to a +variable defined outside the lock statement is allowed only if left-hand side is +just a variable name and the right hand side is an isolated expression. An +assignment to the restricted variable is not subject to this constraint. +
  • +
  • Transferring values into the lock statement is constrained: a +variable-reference-expr within the lock statement that refers to a variable or +parameter defined outside the lock statement is allowed only if the +variable-reference-expr occurs within an expression that is isolated. A +variable-reference-expr that refers to the restricted variable is not subject to +this constraint. Within a non-isolated object, self behaves like a +parameter. +
  • +
+ +
+ +
+

7.23 Fail and retry

+

+The execution of a statement can fail either as the result of check +expression or action, or from an explicit fail statement. When +execution of a statement fails, control flow transfers to the nearest lexically +enclosing failure-handling statement. The failure handling statements are +stmt-with-on-fail, retry-stmt, transaction-stmt and retry-transaction-stmt. If +there is no such statement, it terminates the current worker normally. Note that +failure is completely distinct from panic. +

+

+When execution fails there is an associated error value, which is passed to the +failure-handling statement if there is one. If there is no failure-handling +statement, then the error value becomes the return value of the worker. The +possible failure control flows are known at compile-time, as are the types of +the associated error values. For every statement, the type of the error value +associated with a failure causing control to transfer out of the block is +determined at compile-time. This is in contrast with panics, for which the type +of associated error value is not known at compile-time. +

+ +
+

7.23.1 Fail statement

+
fail-stmt := fail expression ;
+
+

+Executing a fail-stmt will cause control flow to transfer to the nearest +lexically enclosing failure handling statement. +

+

+The static type of the expression must be a subtype of error. Execution of the +fail-stmt evaluates the expression; the resulting error value is passed to the +failure handling statement or becomes the termination value of the current +worker. +

+ +
+
+

7.23.2 On fail clause

+
stmt-with-on-fail := regular-compound-stmt on-fail-clause
+on-fail-clause := on fail [typed-binding-pattern] statement-block
+
+

+A stmt-with-on-fail is executed by executing the +regular-compound-stmt. A check expression or action, +or a fail statement may cause control to transfer to the +on-fail-cause. If so, the statement-block is executed; +otherwise the statement-block is not executed. +When the regular-compound-stmt is itself a failure handling statement, +then only failure of that regular-compound-stmt itself causes control to +transfer to the on-fail-clause; a failure within that +regular-compound-stmt will be handled by that regular-compound-statement. +

+

+An on-fail-clause attached to a named-worker-decl is a +shorthand for a named-worker-decl with a statement block that is a +do-stmt with that on-fail-clause: worker +X { Y } on fail Z is equivalent to +worker X { do { Y } on fail Z }. +

+

+If there is a typed-binding-pattern, then it is matched to the +associated error value, binding the variables occurring within the +typed-binding-pattern; the statement-block is executed +with these bindings in scope. The static type of the associated error value is +determined from the static type of the relevant check expressions +and actions, and fail statements. It is a compile error unless the +match of the typed-binding-pattern with the associated error value +is guaranteed to succeed by the static type of the associated error value. +

+
+ +
+

7.23.3 Retry statement

+
retry-stmt := retry retry-spec statement-block
+retry-spec := [type-parameter] [ ( arg-list ) ]
+
+

+The type-parameter in a retry-spec specifies a class, which must be a subtype of +RetryManager<F>, where F is the failure type of the statement-block; this +implies that the parameter type of the class's shouldRetry method must be a +supertype of F. The arg-list in a retry-spec specifies parameters to be passed +to the class's init method; as with new, the arg-list +can be omitted if the class's init method has no required +arguments. +

+

+A retry-stmt is executed as follows: +

+
    +
  1. Create an object r of type RetryManager by calling new T(A), +where T and A are the type-descriptor in the type-parameter and the arg-list +respectively.
  2. +
  3. Execute the statement-block.
  4. +
  5. If the execution failed with associated error e, then call +r.shouldRetry(e). If the result is true, go back to the previous +step. If the result is false, then continue with the fail.
  6. +
+

+If the type-parameter is omitted, it defaults to +DefaultRetryManager defined in langlib error module. +

+ +
+ +
+ +
+

7.24 Transactions

+ +

+Ballerina provides language support for distributed transactions. A global +transaction consists of one or more transaction branches, where a branch +corresponds to work done by a single strand of a Ballerina program that is part +of the global transaction. Every transaction branch is uniquely identified by an +XID, which consists of an identifier of the global transaction and an identifier +of a branch with the global transaction. +

+

+At runtime, there is a mapping from each strand to a transaction stack, which is +a stack of transaction branches. A strand is in transaction mode, if +its transaction stack is non-empty; the top of a strand's transaction stack is +the current transaction branch for that strand. +

+

+Static checking is based on the idea of a transactional scope: this is a lexical +region of the program where it is known that at runtime the strand executing the +region will always be in transactional mode. A function with the +transactional qualifier can only be called in a transactional +scope; this includes function calls using start. +

+

+A running instance of a Ballerina program includes a transaction manager. This +may run in the same process as the Ballerina program or in a separate process. +It should not be connected over an unreliable network. The transaction manager +of a program is responsible for managing the transaction branches of all the +program's strands. +

+

+When a global transaction involves multiple Ballerina programs, there must be a +network protocol that allows that transaction managers for each Ballerina +program to communicate. The protocol must also allow a remote method or resource +method on a service object to be informed of the global transaction, if any, to +which it belongs. When a listener object determines that a remote method or +resource method of a service object is to be a part of a global transaction +manager, then it will create a new transaction branch, join it to the global +transaction and push that on the transaction stack for the strand on which the +method is called; if the method is declared as transactional, the +listener will not call the method unless it can do this. Similarly, the protocol +must allow a remote method on a client object that is called in transaction mode +to send information about the global transaction of which it is part; if the +method is declared as transactional, then as usual the method can +only be called in transaction mode; it also implies that the client object +implementation is transaction-aware, and that the recipient of the message sent +by the remote method must join the global transaction. A global transaction can +combine Ballerina programs with programs written in other programming languages +provided they agree on this network protocol. +

+

+A strand in transaction mode can register commit or rollback handlers with the +transaction manager; the handlers are functions which will be called by the +transaction manager when the decision has been made whether to commit or +rollback the global transaction to which the current transaction branch belongs. +

+

+Note that internal storage in Ballerina is not transactional. Rolling back a +transaction does not automatically restore the mutable values are +variables to their state when the transaction started. It is up to the +programmer to do this using commit or rollback handlers. +

+

+When a new strand is created by a named-worker-decl that includes a +transactional qualifier or by using start to call a +function with a transactional qualifier, a new transaction branch +will be created and joined to the global transaction; this transaction branch +will be pushed onto transaction stack for the newly created strand. +

+

+Ballerina also has the concept that a transaction may be part of a sequence of +retries, where the last transaction can complete with either a rollback or +commit, and the preceding transactions all completed with a rollback. +

+ +
+

7.24.1 Transaction manager

+ +

+The semantics of Ballerina's transactional language features are defined in +terms of the following abstract operations on the transaction manager. These +operations cover only the interface between the application and the transaction +manager, not the interface between the resource manager and the application. +These operations are all performed by a Ballerina program in the context of a +strand. The transaction manager supports additional operations, which are +defined in the langlib transaction module. +

+ +
+
7.24.1.1 Begin operation
+

+The Begin operation starts a global transaction and pushes a transaction branch +for the new global transaction onto the current strand's transaction stack. This +transaction branch is the initiating branch of the global transaction. The +current strand will be in transaction mode. +

+

+The Begin operation has an optional parameter that contains information about +the previous transactions in a sequence of retries. +

+
+ +
+
7.24.1.2 Commit operation
+

+The Commit operation is only called in transaction mode, and when the current +transaction branch is the initiating branch of a global transaction. The Commit +operation always removes the topmost transaction branch from the strand's transaction +stack. The Commit operation initiates a commit of the global transaction that +the current transaction branch belongs to. +

+

+When the commit is initiated, the transaction manager runs a two-phase commit +protocol if necessary. First, it requests each participant to prepare to commit +and waits for the participants to respond. There are two possibilities. If it +receives a response from each participant that it is prepared to commit, then +the transaction manager will make a decision to commit. If it receives a +response from any participant that it cannot commit or it gives up waiting for a +response from any participant, then the transaction manager will make a decision +to rollback; in this case, it will create an error value for the cause of the +rollback. +

+

+Once the transaction manager has made a decision whether to commit, it calls the +handlers that were registered with it for for the branches of the global +transaction that it is managing; the commit handlers are called if the decision +was to commit and the rollback handlers are called if the decision was to +rollback. The error value for the cause of the rollback will be passed as an +argument to the call of each rollback handler. At this point, the Commit +operation can return. The transaction manager will also communicate its decision +to the transaction's participants, which will result in them running commit or +rollback handlers for their branches. +

+

+The Commit operation has an optional parameter which is a RetryManager object or +nil, which defaults to nil. If this parameter is non-nil and the decision is to +rollback, then the transaction manager will call the RetryManager object's +shouldRetry method, record the result and then pass it as the willRetry +parameter to any rollback handlers. +

+

+If the transaction manager decided to rollback, then the Commit operation +returns the error value for the reason for the rollback. Otherwise, it returns +nil. +

+ +
+ +
+
7.24.1.3 Rollback operation
+

+The Rollback operation is only called in transaction mode, and when the current +transaction branch is the initiating branch of a global transaction. The +Rollback operation always removes the topmost transaction from the strand's +transaction stack. The Rollback operations initiates a commit of the global +transaction that the current transaction branch belongs to. The transaction +manager calls the rollback handlers that were registered with it for the +branches of the global transaction that it is managing. The Rollback operation +has a parameter which is either an error value or nil; this is passed as an +argument to any rollback handlers. +

+

+The Rollback operation also has an optional parameter which is a RetryManager object +or nil, which defaults to nil. If this parameter is non-nil, then the +transaction manager will call the RetryManager object's shouldRetry method, +record the result and then pass it as the willRetry parameter to any rollback +handlers. +

+ +
+
+ +
+

7.24.2 Transaction statement

+ +

+A transaction is performed using a transaction statement. The semantics of the +transaction statement guarantees that every transaction manager Begin operation +will be paired with a Rollback or Commit operation. +

+
transaction-stmt := transaction statement-block
+
+

+The statement-block must contain at least one commit-action. In addition, the +compiler must be able to verify that any exit out of the statement-block that is +neither a panic nor a fail will have executed a commit-action or +rollback-stmt. +

+

+A transaction-stmt is executed as follows: +

+
    +
  • Perform the transaction Begin() operation.
  • +
  • Execute the statement-block. While executing the statement-block, any panic +does not immediately terminate the current worker; rather control is transferred +back to the transaction-stmt, so that the transaction-stmt can handle it as +described in the next step.
  • +
  • If the new transaction that was begun is still the current transaction, then +the statement-block must have failed or panicked. In this case, perform a +Rollback(e) operation, where e is the error associated with the fail or panic, +and then continue with the fail or panic.
  • +
+

+The statement-block of a transaction-stmt is a transactional scope, except for +any statements that could potentially be executed after the execution of a +commit-action or rollback-stmt. +

+

+It is an error for a transactional-stmt to appear in a transactional scope. +However, it is not an error if the current strand is in transaction mode when a +transaction-stmt is executed: in this case, the Begin() operation performed by +the transaction-stmt will, as usual, start a new transaction, which will be +completely independent of any existing transactions. +

+
+ + +
+

7.24.3 Retry transaction statement

+ +
retry-transaction-stmt := retry retry-spec transaction-stmt
+
+

+A retry-transaction-stmt is the same as a retry-stmt containing a +transaction-stmt, except as follows. +

+
    +
  • When a transaction is retried, information about the previous transaction is +passed as a parameter to the Begin() operation.
  • +
  • If the transaction committed successfully, but the statement-block of the +transaction-stmt failed, then the transaction-stmt will not be retried.
  • +
  • The RetryManager is passed as a parameter to the Commit() and Rollback() +operations and the shouldRetry method is then called by those operations, so +that the result is available to the rollback handlers. The transaction manager +records the result of calling shouldRetry, and this is used to determine whether +to retry.
  • +
+
+ +
+

7.24.4 Commit action

+ +
commit-action := commit
+
+

+A commit-action is only allowed if it is lexically within the +statement-block of a transaction-stmt. +

+

+Evaluating the commit-action performs the transaction manager +Commit() operation; the result of this operation is the result of the +commit-action. The type of the result is +transaction:Error?. Note that the commit action does not alter the +flow of control. +

+ +
+ +
+

7.24.5 Rollback statement

+ +
rollback-stmt := rollback [expression] ;
+
+

+A rollback-stmt is only allowed if it is lexically within the +statement-block of a transaction-stmt. +

+

+The rollback-stmt performs the transaction manager Rollback(e) +operation, where e is the result of executing the expression, if +present, and nil otherwise. Note that like the commit action, the rollback +statement does not alter the flow of control. +

+ +
+ +
+
+

7.25 Panic statement

+ +
panic-stmt := panic expression ;
+
+

+A panic statement terminates the current worker abnormally. The result of +evaluating expression provides the termination value of the worker. +

+

+The static type of expression must be a subtype of error. +

+
+ +
+

7.26 Return statement

+ +
return-stmt := return [ action-or-expr ] ;
+
+

+A return statement terminates the current worker normally.The result of +evaluating the action-or-expr provides the termination value of the worker. If +action-or-expr is omitted, then the termination value is nil. +

+
+ + +
+
+

8. Module-level declarations

+

+Each source part in a Ballerina module must match the production +module-part. +

+

+The import declarations must come before other declarations; apart from this, +the order of the definitions and declarations at the top-level of a module is +not constrained. +

+ +
module-part := import-decl* other-decl*
+other-decl :=
+   listener-decl
+   | service-decl
+   | function-defn
+   | module-type-defn
+   | module-class-defn
+   | module-var-decl
+   | module-const-decl
+   | module-enum-decl
+   | module-xmlns-decl
+   | annotation-decl
+
+
+

8.1 Import declaration

+ +
import-decl := import [org-name /] module-name [as import-prefix] ;
+import-prefix := module-prefix | _
+org-name := import-identifier
+module-name := import-identifier (. import-identifier)*
+import-identifier := RestrictedIdentifier
+
+

+If org-name is omitted, it is defaulted from the organization of the importing +module. +

+

+An import-prefix of _ causes the module to be imported without +making its symbols available via a module-prefix. In this case, the effect of +importing the module will be just to cause the module to be included in the +program and initialized. It is an error for a source-part to import a module +using a module-prefix and then not to use that module-prefix. +

+

+A module-prefix declared by an import-decl is in the +same symbol space as a xmlns-namespace-prefix declared by an +xmlns-decl. This symbol space is distinct from a module's main +symbol space used by other declarations. +

+

+It is an error for a module to directly or indirectly import itself. In other +words, the directed graph of module imports must be acyclic. +

+
predeclared-prefix :=
+   boolean
+   | decimal
+   | error
+   | float
+   | function
+   | future
+   | int
+   | map
+   | object
+   | stream
+   | string
+   | table
+   | transaction
+   | typedesc
+   | xml
+
+

+A reserved keyword t that is a predeclared-prefix is +predeclared as referring to the lang.t lang library +module, but this can be overridden by an import-decl that imports a module using +that prefix. A predeclared-prefix can be used as a module-prefix without using a +QuotedIdentifier. +

+ +
+ +
+

8.2 Module and program execution

+

+A Ballerina program consists of one or more modules; one of these modules is +distinguished as the root module. The source code for a module uses +import declarations to identify the modules on which it depends directly. At +compile-time, a root module is specified, and the modules comprising the program +are inferred to be those that the root module imports directly or indirectly. +The directed graph of module imports must be acyclic. +

+

+Program execution may terminate successfully or unsuccessfully. Unsuccessful +program termination returns an error value. Program execution consists of two +consecutive phases: an initialization phase and a listening phase. +

+

+Module initialization is performed by calling an initialization function, which +is synthesized by the compiler for each module. Module initialization can fail, +in which case the initialization function returns an error value. The +initialization phase of program execution consists of initializing each of the +program's modules. If the initialization of a module is unsuccessful, then +program execution immediately terminates unsuccessfully, returning the error +value returned by the initialization function. +

+

+The initialization of a program's modules is ordered so that a module will not +be initialized until all of the modules on which it depends have been +initialized. (Such an ordering will always be possible, since the graph of +module imports is required to be acyclic.) The order in which modules are +initialized follows the order in which modules are imported so far as is +consistent with the previous constraint. +

+

+A module's initialization function performs expression evaluation so as to +initialize the identifiers declared in the module's declarations; if evaluation +of an expression completes abruptly, then the module initialization function +immediately returns the error value associated with the abrupt completion. If a +module defines a function named init, then a module's +initialization function will end by calling this function; if it terminates +abruptly or returns an error, then the module's initialization function will +return an error value. Note that the init function of the root +module will be the last function called during a program's initialization phase. +

+

+This specification does not define any mechanism for processing the program +command-line arguments typically provided by an operating system. The Ballerina +standard library provides a function to retrieve these command-line arguments. +In addition, the Ballerina platform provides a convenient mechanism for +processing these arguments. This works by generating a new command-line +processing module from the specified root module. The init +function of the generated module retrieves the command-line arguments, parses +them, and calls a public function of the specified root module (typically the +main function). The parsing of the command-line arguments is +controlled by the declared parameter types, annotations and names of the public +functions. The generated module, which imports the specified root module, +becomes the new root module. +

+

+A configuration is supplied as input to program execution. A +configuration consists of mapping from names of configurable +module-level variables to values. The values in a configuration always belong to +the type anydata&readonly. The value for a variable in the +configuration is used during module initialization to initialize the variable +instead of the value specified in the module. A configurable module-level +variable may require that a configuration include a value for it. Except for +this requirement, a configuration may be empty. Before initializing any module, +the initialization phase must check that there is a value of the correct type +supplied for every configurable module-level variable that requires +configuration. If not, the module initialization phase terminates unsuccessfull. +

+

+If the initialization phase of program execution completes successfully, then +execution proceeds to the listening phase, which is described in the next +section. The termination of the listening phase, which may be successful or +unsuccessful, terminates the program execution. +

+
+ +
+

8.3 Listeners and services

+ +

+Service objects support network interaction using remote methods and resource +methods. Listeners provide the interface between the network and service +objects. A listener object receives network messages from a remote process +according to some protocol and translates the received messages into remote +methods calls or resource accesses of service objects that have been attached to +the listener object. It is up to the listener object to determine how this +translation happens. A resource path segment may correspond to something that at +the protocol level is not a string. For example, in HTTP a path segment is +natively a sequence of bytes. In this case, the listener should be able to +convert this native representation into a string, for example, by using UTF-8 +decoding. The type of the listener object constrains the type of a service that +can be attached to the listener. (This constraint cannot yet be fully expressed +by Ballerina's type system.) +

+

+A service object's remote or resource method uses its return value to indicate +to the listener what further handling of the network message is needed. An error +return value is used to indicate that the method encountered some sort of error +in handling the network message. When a service object is returned, it means +that the listener should use that service object to further handle the network +message. When no further handling is needed, the return value should be nil. +

+

+The return value can also be used to supply a response to the network message. +This has the limitation that the method cannot control what happens if there is +an error in sending a response. It also has the limitation that it cannot handle +complex message exchange patterns, although returning multiple responses to a +single request can be modelled by returning a stream. A listener object can +avoid these limitations by passing a client object as a parameter to the service +object's remote or resource method; the service object then makes calls on the +remote methods of the client object in order to send a response back to the +client. +

+

+The methods defined by the Listener object type allow for the +management of the lifecycle of a listener object and its attached services. A +listener declaration registers a listener object with a module, so that it can +be managed by the module. The runtime state of each module includes a list of +listener objects that have been registered with the module. A listener object +that has been registered with a module is called a module listener +

+

+If at the start of the listening phase of program execution there are no module +listeners, then program execution is terminated gracefully. +Otherwise, the start method of each module listener is called; if +any of these calls returns an error value, then the listening phase terminates +unsuccessfully with this error value as its return value. +

+

+The listening phase of program execution continues until either the program +explicitly exits, by calling a standard library function, or the user explicitly +requests the graceful or immediate termination of the program using an +implementation-dependent operating system facility (such as a signal on a POSIX +system). In the latter case, the gracefulStop or +immediateStop method of each registered listener will be called +before termination. In the case of graceful termination, functions registered +with runtime:onGracefulStop are also called. +

+ +
+

8.3.1 Listener declaration

+ +
listener-decl :=
+   metadata
+   [public] listener [type-descriptor] variable-name = expression ;
+
+

+A listener-decl declares a module listener. A module listener +declares a variable in a similar way to a final variable declaration, but the +type of the variable is always a subtype of the Listener object type, +and it has the additional semantic of registering the variable's value with the +module as a listener. As with a variable declared in a final variable +declaration, the variable can be referenced by a variable-reference, but cannot +be assigned to. A module may have multiple multiple listeners. +

+

+When a listener-decl is initialized as part of module initialization, its +expression is evaluated. If expression evaluation completes abruptly or the +result of the expression is an error, then module initialization fails. +Otherwise the variable is initialized with the result of the evaluation. +

+

+If the type-descriptor is present, it specifies the static type of the variable. +The static type of expression must be equivalent to a union L|E, +where L is a listener object type and E is subtype of error, which may be +never; if the type-descriptor is not present, then L is used as the +static type of the variable. +

+ +
+ +
+

8.3.2 Service declaration

+ +
service-decl :=
+   metadata [isolated-qual]
+   service [type-descriptor] [attach-point] on expression-list object-constructor-block [;]
+attach-point := absolute-resource-path | string-literal
+absolute-resource-path :=
+   root-resource-path
+   | (/ resource-path-segment-name)+
+root-resource-path := /
+
+expression-list := expression (, expression)*
+
+

+A service-decl creates a service object and attaches it to one or more +listeners. +

+

+The static type S for the constructed service object is specified by the +type-descriptor if present, and otherwise is the union of a type inferred from +each expression in the expression list as follows. Each expression in the +expression-list must have a type Listener<T,A>|E where T is a subtype of +service object {}, A is a subtype of +string[]|string|() and E is a subtype of error; the +inferred type is T. The object-constructor-block has the same semantics as in an +object-constructor-expr with a service qualifier and a +type-reference that refers to S. If the service-decl includes +isolated, then it is equivalent to an object-constructor-expr with +an isolated qualifier as well as a service qualifier. +

+

+The attach-point determines the second argument passed to the +attach method: if the attach-point is absent, then the +argument is nil; if it is a string-literal, then the argument is a +string; otherwise, it is an absolute-resource-path and the argument +is an array of strings, with one string for each +resource-path-segment-name. Attaching service objects +s1,...,sn with absolute +resource paths p1,...,pn +is equivalent to attaching a single service object with n +get resource methods to /, where the i-th +resource method has a path pi (an +absolute-resource-path is turned into a +relative-resource-path with the same +resource-path-segment-names) and returns +si. +

+

+A service-decl is initialized as part of module initialization as follows. The +object-constructor-block is evaluated as in an object-constructor-expr resulting +in a service object s. Then for each expression in +expression-list: +

+
    +
  1. the expression is evaluated resulting in a value which is either an error or +an object obj belonging to a listener object type;
  2. +
  3. if it is an error, module initialization fails;
  4. +
  5. otherwise, obj is registered as a module listener +(registering the same object multiple times is the same as registering it +once);
  6. +
  7. +s is then attached to obj +using obj's attach method;
  8. +
  9. if the call to attach fails, then module initialization +fails.
  10. +
+
+ + +
+

8.3.3 Isolated inference

+ +

+A listener object can use the isolated bit of a service object and of a service +object's remote method to determine whether it is safe to make concurrent calls +to the remote object or the remote method. +

+

+The compiler may infer that a service object or a service object's remote method +is isolated even it is not explicitly declared as such. In doing so, it analyzes +a module to determine whether there is a set of declarations and definitions in +the module, where each of them is a service-decl, +object-constructor-expr, +module-var-decl, module-class-defn +function-defn or method-defn, and none of them +explicitly specifies an isolated qualifier, such that if all them +explicitly specified an isolated qualifier, then they all would +meet the requirements for isolated functions +and isolated objects. If so, then the isolated bit of values resulting from them +is set in the same way as if isolated qualifiers had been +explicitly specified. The analysis should not infer a function or method to be +isolated if that would be inconsistent with an annotion supported +by the implementation that provides control over which thread is used for a strand +created for named-worker-decl or start-action. +

+

+This inference is purely an optimization to improve service concurrency and is +subject to two constraints. First, any inferences do not affect the static types +visible to other modules. Second, anything explicitly declared as +isolated must satisfy the requirements of this specification +without without relying on inference. +

+ +
+
+ +
+

8.4 Function definition

+ +
function-defn := 
+   metadata
+   [public] function-quals
+   function identifier function-signature function-defn-body
+function-defn-body :=
+   block-function-body [;]
+   | expr-function-body ;
+   | external-function-body ;
+
+

+If a module has a function-defn with an identifier of init, it is +called called automatically by the system at the end of the initialization of +that module; if this call returns an error, then initialization of the module +fails. The following special requirements apply to the init +function of a module: it must not be declared public; its return +type must both be a subtype of error? and contain (); +it must have no parameters. +

+

+If the function-quals includes transactional, then +expr-function-body and the block-function-body are transactional scopes. +

+ +
+ +
+

8.5 Module type definition

+ +
module-type-defn :=
+   metadata
+   [public] type identifier type-descriptor ;
+
+ +

+A module-type-defn binds the identifier to the specified type descriptor. The +binding is in the main symbol space. The type-descriptor is resolved as part of +module initialization. +

+ +
+ +
+

8.6 Module class definition

+

+A class is a type descriptor that in addition to describing an object type also +defines a way to construct an object belonging to the type; in particular, it +provides the method definitions that are associated with the object when it is +constructed. +

+ +
module-class-defn :=
+   metadata
+   [public] class-type-quals class identifier {
+      class-member*
+  } [;]
+class-type-quals := (distinct | readonly | isolated-qual | object-network-qual)*
+class-member :=
+   object-field
+   | method-defn
+   | remote-method-defn
+   | resource-method-defn
+   | object-type-inclusion
+
+

+It is an error for a keyword to appear more than once in +class-type-quals. +

+

+As in an object constructor expression, a visibility qualifier of +private can be used within a class definition; this means that the +visibility region consists of all method definitions in the class definition. If +class has private fields or methods, then it is not possible to define another +object type descriptor that is a subtype of the class's type. +

+

+If class-type-quals contains readonly, then an object +constructed using the class will have its read-only bit set; the effective type +of each field is thus the intersection of the specified type and +readonly; furthermore, an object shape belongs to the class's type +only if its read-only bit is set. +

+

+If class-type-quals contains isolated, then the +defined object type is an isolated type, and an object constructed using the +type will have its isolated bit set. An object-field or +method-defn occurring as a class-member in an isolated +class is subject to same requirements as when it occurs as an +object-member in an object-constructor-expr that is +explicitly isolated. +

+

+If an object-type-inclusion references a type-descriptor that is a +class, then only the type of the class is included: the definitions of the +methods and any initializers for the fields are not included. If a class uses an +object-type-inclusion to include an object type T, then each method declared in +T must be defined in the class using a method-defn with the same +visibility. If T has a method or field with module-level visibility, then C must +be in the same module. If the class is readonly (i.e. +class-type-quals includes readonly), then an +object-type-inclusion in the class is allowed to directly or +indirectly reference a readonly class or readonly type +descriptor. +

+

+If class-type-quals contains distinct, then the +primary type-id of the class will the type-id of that occurrence of +distinct, and the secondary type-ids will be the union of the +type-ids of the included object types. If class-type-quals does not +contain distinct, then the type-ids of the class come from the +included object types in the same way as with an object type descriptor. +

+

+An object of a class is initialized by: +

+
    +
  1. allocating storage for the object
  2. +
  3. initializing each field with its initializer, if it has one
  4. +
  5. initializing the methods of the object using the class's method definitions
  6. +
  7. calling the class's init method, if there is one
  8. +
+

+The parameter list of an init method within an +module-class-defn is not required to be empty, unlike within an +object-constructor-expr. +

+ +
+ +
+

8.7 Module variable declaration

+ +
module-var-decl := module-init-var-decl | module-no-init-var-decl
+
+

+A module-var-decl declares a variable. The scope of variables declared in a +module-var-decl is the entire module. The variable may be initialized in the +declaration or within the module's init function. If +final is specified, then it is not allowed to assign to the +variable after it is initialized. +

+
+module-init-var-decl := metadata [public] module-init-var-quals typed-binding-pattern = module-var-init ;
+module-init-var-quals := (final | isolated-qual)* | configurable
+module-var-init := expression | ?
+
+

+A module-init-var-decl declares and initializes a variable. It is an error for a +keyword to appear more than once in module-init-var-quals. If the +typed-binding-pattern uses var, then the type of the variables is +inferred from the static type of expression; if the module-var-decl +includes final or configurable, the precise type is +used, and otherwise the broad type is used. If the typed-binding-pattern +specifies a type-descriptor, then that type-descriptor provides the contextually +expected type for action-or-expr. +

+

+If the module-init-var-decl includes public, then the +typed-binding-pattern must not use var. +

+

+If a module-init-var-decl includes an isolated-qual, then the variable declared +is isolated. In this case, public must not be specified, the +binding-pattern in the typed-binding-pattern must be just a variable-name, and +the expression must be an isolated expression. A variable declared as an +isolated variable can be accessed only within a lock-stmt. When an isolated-qual +occurs in a position where the grammar would allow it to be parsed as part of +module-init-var-quals or typed-binding-pattern, the former parse is used. +

+

+If configurable is specified, then the initializer specified in the +module-var-init may be overridden at the time of module initialization by a +value supplied when the program is run. If such a value is supplied, then the +expression in the module-var-init is not evaluated and the variable is +initialized with the supplied value instead. A module-var-init of ? +is allowed only when configurable is specified and means that a +configurable value must be supplied for this variable. If +configurable is specified, then the typed-binding-pattern must use +an explicit type-descriptor rather than var and the binding-pattern +must be just a variable-name. The type specified by the type-descriptor must be +a subtype of anydata. A variable declared as +configurable is implicitly final, and cannot be assigned to outside +the declaration. The static type of a variable declared as +configurable is implicitly readonly: the type +specified in the type-descriptor is intersected with readonly. A +configurable variable can thus always be referenced within an isolated function. +

+ +
module-no-init-var-decl := metadata [public] [final] type-descriptor variable-name ;
+
+

+A module variable declared with module-no-init-var-decl must be +initialized in the module's init function. It must be definitely +assigned at each point that the variable is referenced. If final is +specified, then the variable must not be assigned more than once. The +type-descriptor must not be never. +

+ +
+
+

8.8 Module constant declaration

+ +
module-const-decl :=
+   metadata
+   [public] const [type-descriptor] identifier = const-expr ;
+
+

+A module-const-decl declares a compile-time constant. A compile-time constant is +an named immutable value, known at compile-time. A compile-time constant can be +used like a variable, and can also be referenced in contexts that require a +value that is known at compile-time, such as in a type-descriptor or in a +match-pattern. +

+

+The type of the constant is the intersection of readonly and the +singleton type containing just the shape of the value named by the constant. The +type of the constant determines the static type of a variable-reference-expr +that references this constant. +

+

+If type-descriptor is present, then it provides the contextually expected type +for the interpretation of const-expr. It is a compile-time error if the static +type of const-expr is not a subtype of that type. The type-descriptor must +specify a type that is a subtype of anydata and must not be never. +Note that the type-descriptor does not specify the type of the constant, +although the type of the constant will all be a subtype of the type specified by +the type-descriptor. +

+
+ +
+

8.9 Module enumeration declaration

+ +
module-enum-decl :=
+   metadata
+   [public] enum identifier { enum-member (, enum-member)* } [;]
+enum-member := metadata identifier [= const-expr]
+
+

+A module-enum-decl provides a convenient syntax for declaring a union of string constants. +

+

+Each enum-member is defined as compile-time constant in the same way as if it +had been defined using a module-const-decl. The result of evaluating the +const-expr must be a string. If the const-expr is omitted, it defaults to be the +same as the identifier. +

+

+The identifier is defined as a type in the same was as if it had been defined by +a module-type-defn, with the type-descriptor being the union of the constants +defined by the members. +

+

+If the module-enum-decl is public, then both the type and the constants are public. +

+

+So for example: +

+
+public enum Color {
+  RED,
+  GREEN,
+  BLUE
+}
+
+

+is exactly equivalent to: +

+
+public const RED = "RED";
+public const GREEN = "GREEN";
+public const BLUE = "BLUE";
+public type Color RED|GREEN|BLUE;
+
+
+ +
+

8.10 Module XML namespace declaration

+
module-xmlns-decl := xmlns-decl
+
+ +

+A module-xmlns-decl declares an XML namespace prefix with module +scope. It applies only to the source part in which it occurs, as with an +import-decl. +

+

+The semantics of xmlns-decl are described in the XML namespace declaration +statement section. +

+ +
+ + +
+
+

9. Metadata

+

+Ballerina allows metadata to be attached to a construct by specifying the +metadata before the construct. +

+ +
metadata := [DocumentationString] [annots]
+
+

+There are two forms of metadata: documentation and annotations. +

+
+

9.1 Annotations

+ +
annots := annotation+
+annotation := @ annot-tag-reference annot-value
+
+

+Annotations provide structured metadata about a particular construct. Multiple +annotations can be applied to a single construct. An annotation consists of a +tag and a value. +

+ +
annotation-decl :=
+   metadata
+   [public] [const] annotation [type-descriptor] annot-tag 
+   [on annot-attach-points] ;
+annot-tag := identifier
+
+

+An annotation-decl declares an annotation tag. Annotations tags are in a +separate symbol space and cannot conflict with other module level declarations +and definitions. The annotation tag symbol space is also distinct from the +symbol space used by module prefixes and XML namespace prefixes. +

+

+The type-descriptor specifies the type of the annotation tag. The type must be a +subtype of one of the following three types: true, +map<value:Cloneable>, +map<value:Cloneable>[]. If the type-descriptor is omitted, +then the type is true. +

+ +
annot-tag-reference := qualified-identifier | identifier
+annot-value := [mapping-constructor-expr]
+
+

+An annot-tag-reference in an annotation must refer to an annot-tag declared in +an annotation declaration. When an annot-tag-reference is a +qualified-identifier, then the module-prefix of the qualified-identifier is +resolved using import declarations into a reference to a module, and that module +must contain an annotation-decl with the same identifier. An annot-tag-reference +that is an identifier rather than a qualified-identifier does not refer +to an annotation defined within the same module. Rather the compilation +environment determines which identifiers can occur as an +annotation-tag-reference, and for each such identifier which module defines that +annotation tag. +

+

+Each annotation has a value. For every construct that has an annotation with a +particular tag, there is also an effective value for that annotation +tag, which is constructed from the values of all annotations with that tag that +were attached to that construct. The effective value belongs to the type +declared for the annotation tag. The type of the annotation tag determines the +type of the annotation value and whether multiple annotations with the same tag +on a single construct are allowed. For an annotation tag declared with type T, +if T is M[] for some type mapping type M, then the type of the annotation value +is M, multiple annotations are allowed, and the effective value is an array of +the values for each annotation; otherwise the type of the annotation value is T, +multiple annotations are not allowed, the effective value is the value of the +single annotation. +

+

+If the type of the annotation value is true, then a +mapping-constructor-expr is not allowed, and the annotation value is +true. Otherwise the type of the annotation value must be a mapping +type M; if a mapping-constructor-expr is not specified, then it defaults to +{ }; the mapping-constructor-expr must have static type M and the +annotation value is the result of evaluating the mapping-constructor-expr with M +as the contextually expected type. +

+

+If the annotation-decl for a tag specifies const, then a +mapping-constructor-expr in annotations with that tag must be a const-expr and +is evaluated at compile-time with the semantics of a const-expr. Otherwise, the +mapping-constructor-expr is evaluated when the annotation is evaluated and the +ImmutableClone abstract operation is applied to the result. +

+

+An annotation applied to a module-level declaration is evaluated when the module +is initialized. An annotation applied to a service constructor is evaluated when +the service constructor is evaluated. An annotation occurring within a type +descriptor is evaluated when the type descriptor is resolved. +

+ +
annot-attach-points := annot-attach-point (, annot-attach-point)*
+annot-attach-point :=
+   dual-attach-point
+   | source-only-attach-point
+dual-attach-point := [source] dual-attach-point-ident
+dual-attach-point-ident :=
+   type
+   | class
+   | [object|service remote] function
+   | parameter
+   | return
+   | service
+   | [object|record] field
+source-only-attach-point := source source-only-attach-point-ident
+source-only-attach-point-ident :=
+   annotation
+   | external
+   | var
+   | const
+   | listener
+   | client
+   | worker
+
+

+The annot-attach-points specify the constructs to which an +annotation can be attached. +

+

+When an attachment point is prefixed with source, then the +annotation is attached to a fragment of the source rather than to any runtime +value, and thus is not available at runtime. If any of the attachment points +specify source, the annotation-decl must specify +const. +

+

+When an attachment point is not prefixed with source, then the annotation is +accessible at runtime by applying the annotation access operator to a typedesc +value. +

+

+The available attachment points are described in the following table. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attachment point nameSyntactic attachment point(s)Attached to which type descriptor at runtime
typemodule-type-defn, module-enum-decl, type-cast-exprdefined type
classmodule-class-defndefined type (which will be type of objects constructed using this class)
functionfunction-defn, method-decl, method-defn, anonymous-function-exprtype of function
object functionmethod-decl, method-defntype of function
service remote functionmethod-defn with remote qualifier on service objecttype of function, on service value
returnreturn-type-descriptorindirectly to type of function
parameterrequired-param, defaultable-param, included-record-param, rest-paramindirectly to type of function
serviceservice-decl, object-constructor-expr with service qualifiertype of service
fieldindividual-field-descriptor, member-type-descriptor, object-field-descriptortype of mapping, list or object
object fieldobject-field-descriptor, object-fieldtype of object
record fieldindividual-field-descriptortype of mapping
listenerlistener-declnone
varmodule-var-decl, local-var-decl-stmt, let-var-declnone
constmodule-const-decl, enum-membernone
annotationannotation-declnone
externalexternal-function-bodynone
workernamed-worker-decl, start-actionnone
+
+
+

9.2 Documentation

+

+A documentation string is an item of metadata that can be associated with +module-level Ballerina constructs and with method declarations. The purpose of +the documentation strings for a module is to enable a programmer to use the +module. Information not useful for this purpose should be provided in in +comments. +

+

+A documentation string has the format of one or more lines each of which has a +# optionally preceded by blank space. +

+

+The documentation statement is used to document various Ballerina constructs. +

+ +
DocumentationString := DocumentationLine +
+DocumentationLine := BlankSpace* # [Space] DocumentationContent
+DocumentationContent := (^ 0xA)* 0xA
+BlankSpace := Tab | Space
+Space := 0x20
+Tab := 0x9
+
+

+A DocumentationString is recognized only at the beginning of a +line. The content of a documentation string is the concatenation of the +DocumentationContent of each DocumentationLine in the +DocumentationString. Note that a single space following the # is +not treated as part of the DocumentationContent. +

+

+The content of a DocumentationString is parsed as Ballerina +Flavored Markdown (BFM). BFM is also used for a separate per-module +documentation file, conventionally called Module.md. +

+
+
+

9.3 Ballerina Flavored Markdown

+

+Ballerina Flavored Markdown is GitHub Flavored Markdown, with some additional +conventions. +

+

+In the documentation string attached to a function or method, there must be +documentation for each parameter, and for the return value if the return value +is not nil. The documentation for the parameters and a return value must consist +of a Markdown list, where each list item must have the form ident - +doc, where ident is either the parameter name or return, and doc is the +documentation of that parameter or of the return value. +

+

+The documentation for an object must contain a list of fields rather than +parameters. Private fields should not be included in the list. +

+

+BFM also provides conventions for referring to Ballerina-defined names from +within documentation strings in a source file. An identifier in backticks +`X`, when preceded by one of the following words: +

+
    +
  • type
  • +
  • service
  • +
  • variable
  • +
  • var
  • +
  • annotation
  • +
  • module
  • +
  • function
  • +
  • parameter
  • +
+

+is assumed to be a reference to a Ballerina-defined name of the type indicated +by the word. In the case of parameter, the name must be unqualified +and be the name of a parameter of the function to which the documentation string +is attached. For other cases, if the name is unqualified it must refer to a +public name of the appropriate type in the source file's module; if it is a +qualified name M:X, then the source file must have imported M, and X must refer +to a public name of an appropriate type in M. BFM also recognizes +`f()` as an alternative to function `f`. In both +cases, f can have any of the following forms (where `m` is a module import, `x` is a +function name, `T` is an object type name, and `y` is a method name): +

+ +
    x()
+    m:x()
+    T.y()
+    m:T.y()
+
+

+Example +

+ +
    # Adds parameter `x` and parameter `y`
+    # + x - one thing to be added
+    # + y - another thing to be added
+    # + return - the sum of them
+    function add (int x, int y) returns int { return x + y; }
+
+ +

+The Ballerina platform may define additional conventions, in particular relating +to headings with particular content. For example, a heading with a content of +Deprecated can be used to provide information about the deprecation +of the name to which the documentation string is attached. +

+ +
+
+ +
+

10. Data tags

+
+

10.1 Regular expressions (preview)

+ +

+The re data tag is used for regular expressions. The lang library +module for the corresponding basic type is lang.regexp. +

+

+The syntax and semantics of Ballerina regular expressions are based on Perl. +Ballerina supports a subset of Perl regular expressions that includes the most +commonly used features and is interoperable across multiple regular expression +engines. The supported syntax is defined by the RegExp grammar +given below. +

+ +
RegExp := ReDisjunction
+
+ReDisjunction := ReSequence (| ReSequence)*
+ReSequence := ReTerm*
+ReTerm :=
+   ReAtom [ReQuantifier]
+   | ReAssertion
+ReAssertion := ^ | $
+
+ReQuantifier := ReBaseQuantifier [?]
+
+ReBaseQuantifier :=
+   *
+  | +
+  | ?
+  | { Digit+ [, Digit*] }
+
+ReAtom :=
+   ReLiteralChar
+   | ReEscape
+   | .
+   | [ [^] [ReCharSet] ] 
+   | ( [? ReFlagsOnOff :] ReDisjunction )
+
+ReLiteralChar := ^ ReSyntaxChar
+
+ReSyntaxChar :=
+  ^ | $ | \ | . | * | + | ?
+  | ( | ) | [ | ] | { | } | |
+
+ReEscape :=
+   NumericEscape
+   | ControlEscape
+   | ReQuoteEscape
+   | ReUnicodePropertyEscape
+   | ReSimpleCharClassEscape
+
+ReQuoteEscape := \ ReSyntaxChar
+ControlEscape := \r | \n | \t
+
+ReSimpleCharClassEscape := \ ReSimpleCharClassCode
+
+ReSimpleCharClassCode := d | D | s | S | w | W
+
+ReUnicodePropertyEscape := \ (p | P) { ReUnicodeProperty }
+
+ReUnicodeProperty :=  ReUnicodeScript | ReUnicodeGeneralCategory
+
+ReUnicodeScript := sc= ReUnicodePropertyValue
+
+ReUnicodePropertyValue := ReUnicodePropertyValueChar+
+
+ReUnicodePropertyValueChar := AsciiLetter | Digit | _
+
+ReUnicodeGeneralCategory := [gc=] ReUnicodeGeneralCategoryAbbr
+
+ReUnicodeGeneralCategoryAbbr :=
+  L [ u | l | t | m | o ]
+  | M [ n | c | e ]
+  | N [ d | l | o ]
+  | S [ m | c | k | o ]
+  | P [ c | d | s | e | i | f | o ]
+  | Z [ s | l | p ]
+  | C [ c | f | o | n ]
+
+ReCharSetAtom :=
+  ReCharSetAtomNoDash
+  | -
+
+ReCharSetAtomNoDash :=
+  ReCharSetLiteralChar
+  | ReEscape
+  | \-
+
+ReCharSetLiteralChar := ^ (\ | ] | -)
+
+ReCharSet :=
+  ReCharSetAtom
+  | ReCharSetRange [ReCharSet]
+  | ReCharSetAtom ReCharSetNoDash
+
+ReCharSetRange := ReCharSetAtom - ReCharSetAtom
+
+ReCharSetNoDash :=
+  ReCharSetAtom
+  | ReCharSetRangeNoDash [ReCharSet]
+  | ReCharSetAtomNoDash ReCharSetNoDash
+  
+ReCharSetRangeNoDash := ReCharSetAtomNoDash - ReCharSetAtom
+
+ReFlagsOnOff := ReFlagsOn [- ReFlagsOff]
+ReFlagsOn := ReFlag*
+ReFlagsOff := ReFlag*
+ReFlag :=
+  ReMultilineFlag
+  | ReDotAllFlag
+  | ReIgnoreCaseFlag
+  | ReCommentFlag
+
+ReMultilineFlag := m
+ReDotAllFlag := s
+ReIgnoreCaseFlag := i
+ReCommentFlag := x
+
+

+Note that ReUnicodeGeneralCategoryAbbr omits Cs, which +is used for surrogate code points, since these cannot occur in a Ballerina +string. +

+

+The abstract parsing function that is part of the data tag definition behaves as +follows. The argument string values are concatenated into a single string with a +distinct token inserted between them to represent the interpolation point. The +resulting string is parsed against the above RegExp grammar with +the interpolation point token being an additional possibility allowed for +ReAtom. The abstract parsing function returns a function that will +behave equivalently to parsing the original string with +(?:ri) inserted at interpolation point +i, where ri is the +string representation of the interpolated regular expression. +

+

+The most rigorous specification of the semantics of Perl-style regular +expressions is in the ECMAScript language specification. For this reason, the +semantics of Ballerina regular expressions are defined by reference to the +ECMAScript language specification, specifically ECMAScript 2022. The syntax of +Ballerina regular expressions has been chosen to be a subset of ECMAScript +regular expression syntax with one exception: regular expression flags, which in +ECMAScript are specified in the regular expression literal following the closing +/, are in Ballerina specified in the regular expression itself +(using the same syntax as Perl). +

+

+The semantics of a Ballerina regular expression are as specified by ECMAScript +subject to the following points: +

+
    +
  • the version of ECMAScript used is ECMAScript 2022 (ECMA-262, 13th edition);
  • +
  • Ballerina uses the semantics defined by ECMAScript for when Unicode mode, as set by the +u flag, is in effect (ECMAScript regular expressions work differently depending +on whether Unicode mode is in effect or not);
  • +
  • the semantics of \p and \P, and of the +i flag depend on the version of Unicode being used; this version of +Ballerina uses Unicode version 10;
  • +
  • regular expression constructs that depend on the definition of a line +terminator or whitespace use the Ballerina definitions of those rather than the +ECMAScript definitions; specifically +
      +
    • +. matches any character other than 0xA or 0xD;
    • +
    • +\s matches any character allowed by the +WhiteSpaceChar production; as in ECMAScript, \S +matches any character not matched by \s;
    • +
    +
  • +
  • the semantics of ReFlagsOnOff (which is not supported in ECMAScript) are as follows: +
      +
    • the flags are modified within the parenthesized group containing the +ReFlagsOnOff, with those in ReFlagsOn being turned on, +and those in ReFlagsOff being turned off;
    • +
    • it is an error for any flag to be specified more than once within +ReFlagsOnOff;
    • +
    • the meaning of the m, s and i flags are as +in ECMAScript;
    • +
    • the meaning of the x flag is as in Perl: when this flag is in +effect, any character in the regular expression that matches to the +WhiteSpaceChar production, but is not within an +ReCharSet is ignored; in addition, comments starting with +# and continuing to the end of the line are ignored.
    • +
    +
  • +
+ +

+ECMAScript specifies how to compile a regular expression in the above syntax +into an abstract function that takes as arguments an input string and an index +into the input string, and returns a value saying whether the regular expression +matches the input string starting at the index, and, if it does, the index where +the match ended, and for each capturing group, the start and end index, if any, +within the input string where the capturing group matched. This abstract +function corresponds directly to the matchGroupsAt function in the +lang.regexp module. The matchAt, find, +findGroups, findAll and findAllGroups +functions can be defined straightforwardly in terms of the +matchGroupsAt function. The fullMatchGroup function +can be implemented by first appending `$` to the regular expression so as to +anchor any match to the end of the input string (the multiline flag is initially +off, so `$` matches only at the end of input), and then using the ECMAScript +abstract function with a start index of 0. The isFullMatch function +can be implemented straightforwardly in terms of the fullMatchGroup +function. +

+ +
+ +
+ +
+

11. Lang library

+ +

+Modules in the ballerina organization with a module name starting +with lang. are reserved for use by this specification. These +modules are called the lang library. +

+ +
+

11.1 Generic types

+

+Modules in the lang library can make use generic typing. Since generic typing +has not yet been added to Ballerina, the source code for the modules use an +annotation to describe generic typing as follows. When a module type definition +has a @typeParam annotation, it means that this type serves as a +type parameter when it is used in a function definition: all uses of the type +parameter in a function definition refer to the same type; the definition of the +type is an upper bound on the type parameter. A parameter of a function +definition can be annotated with an @isolatedParam annotation; this +is allowed when the function is declared as isolated and the type of the +parameter is a function type; the meaning is that when the function is called in +a context that requires it to be isolated, then the argument supplied for the +parameter must also be isolated. In effect, the function is parameterized with +the isolated qualifier. +

+

+Note We plan to provide full support for generic types in +a future version of this specification. +

+
+ +
+

11.2 Built-in subtypes

+

+A module in the lang library can provide types that are built-in in the +sense that their meaning is defined by this specification. Each such built-in +type is a subtype of a single basic type; a built-in type that is a subtype of a +basic type B is provided by the module +lang.B. +

+

+The built-types provided by lang library modules are described in the following +table. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic typeType nameCriteria for v to belong to type
intUnsigned80 ≤ v ≤ 255
Signed8-128 ≤ v ≤ 127
Unsigned160 ≤ v ≤ 65,535
Signed16-32,768 ≤ v ≤ 32,767
Unsigned320 ≤ v ≤ 4,294,967,295
Signed32-2,147,483,648 ≤ v ≤ 2,147,483,647
stringChar +v has length 1
xmlElement +v is an element singleton
ProcessingInstruction +v is a processing instruction singleton
Comment +v is a comment singleton
Text +v is either the empty xml value or a text singleton
+

+Each built-in type has a type definition in the module that provides it. The +type descriptor of the type definition is the corresponding basic type. The type +definition has a @builtinSubtype annotation, which indicates that +the meaning of the type name is built-in, as specified in the above table, +rather than coming from its type descriptor. It is an error to use the +@builtinSubtype annotation except in a lang library module. +

+

+So, for example, the lang.int module would include the definition: +

+
+@builtinSubtype
+type Signed32 int;
+
+

+Semantically, these types behave like a predefined type that can be referenced +by an unqualified name, such as byte. Syntactically, these types +are referenced by a type-reference in the same way as if their +definitions were not built-in. A built-in type T which is a subtype +of basic type B can be referenced by a type-reference +M:T, where M is a module-prefix referring to module +ballerina/lang.B. +

+

+For convenience, this specification refers to the built-in subtype T provided by +the module for basic type B as B:T. For example, in this specification +int:Signed32 refers to the Signed32 built-in subtype +of int, which is provided by the lang.int module. +

+

+The int:Unsigned8 type is equivalent to the predefined +byte type. +

+
+ +
+

11.3 Lang library modules

+

+The lang library consists of the following modules. With the exception of the +lang.value, lang.transaction and +lang.runtime modules, each corresponds to a basic type. +

+ +
+

11.3.1 lang.array module

+ +

The lang.array module corresponds to basic type list.

+ +
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type any|error;
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type1 any|error;
+
+# A type parameter that is a subtype of `anydata|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type AnydataType anydata;
+
+# Returns the number of members of an array.
+#
+# + arr - the array
+# + return - number of members in `arr`
+public isolated function length((any|error)[] arr) returns int = external;
+
+# Returns an iterator over an array.
+#
+# + arr - the array
+# + return - a new iterator object that will iterate over the members of `arr`.
+public isolated function iterator(Type[] arr) returns object {
+    public isolated function next() returns record {|
+        Type value;
+    |}?;
+} = external;
+
+# Returns a new array consisting of index and member pairs.
+#
+# + arr - the array
+# + return - array of index, member pairs
+public isolated function enumerate(Type[] arr) returns [int, Type][] = external;
+
+
+# Applies a function to each member of an array and returns an array of the results.
+#
+# + arr - the array
+# + func - a function to apply to each member
+# + return - new array containing result of applying `func` to each member of `arr` in order
+public isolated function 'map(Type[] arr, @isolatedParam function(Type val) returns Type1 func) returns Type1[] = external;
+
+# Applies a function to each member of an array.
+# The function `func` is applied to each member of array `arr` in order.
+#
+# + arr - the array
+# + func - a function to apply to each member
+public isolated function forEach(Type[] arr, @isolatedParam function(Type val) returns () func) returns () = external;
+
+# Selects the members from an array for which a function returns true.
+#
+# + arr - the array
+# + func - a predicate to apply to each member to test whether it should be selected
+# + return - new array only containing members of `arr` for which `func` evaluates to true
+public isolated function filter(Type[] arr, @isolatedParam function(Type val) returns boolean func) returns Type[] = external;
+
+# Combines the members of an array using a combining function.
+# The combining function takes the combined value so far and a member of the array,
+# and returns a new combined value.
+#
+# + arr - the array
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `arr` using `func`
+#
+# For example
+# ```
+# reduce([1, 2, 3], function (int total, int n) returns int { return total + n; }, 0)
+# ```
+# is the same as `sum(1, 2, 3)`.
+public isolated function reduce(Type[] arr, @isolatedParam function(Type1 accum, Type val) returns Type1 func, Type1 initial) returns Type1 = external;
+
+# Tests whether a function returns true for some member of an array.
+# `func` is called for each member of `arr` in order unless and until a call returns true.
+# When the array is empty, returns false.
+#
+# + arr - the array
+# + func - function to apply to each member
+# + return - true if func returns true for some member of `arr`; otherwise, false
+# 
+public isolated function some(Type[] arr, @isolatedParam function(Type val) returns boolean func) returns boolean = external;
+
+# Tests whether a function returns true for every member of an array.
+# `func` is called for each member of `arr` in order unless and until a call returns false.
+# When the array is empty, returns true.
+#
+# + arr - the array
+# + func - function to apply to each member
+# + return - true if func returns true for every member of `arr`; otherwise, false
+# 
+public isolated function every(Type[] arr, @isolatedParam function(Type val) returns boolean func) returns boolean = external;
+
+# Returns a slice of an array.
+#
+# + arr - the array
+# + startIndex - index of first member to include in the slice
+# + endIndex - index of first member not to include in the slice
+# + return - new array containing members of `arr` with index >= `startIndex` and < `endIndex` 
+public isolated function slice(Type[] arr, int startIndex, int endIndex = arr.length()) returns Type[] = external;
+
+# Removes a member of an array.
+#
+# + arr - the array
+# + index - index of member to be removed from `arr`
+# + return - the member of `arr` that was at `index`
+# This removes the member of `arr` with index `index` and returns it.
+# It panics if there is no such member.
+public isolated function remove(Type[] arr, int index) returns Type = external;
+
+# Removes all members of an array.
+# + arr - the array
+# Panics if any member cannot be removed.
+public isolated function removeAll((any|error)[] arr) returns () = external;
+
+# Changes the length of an array.
+# 
+# + arr - the array of which to change the length
+# + length - new length
+# `setLength(arr, 0)` is equivalent to `removeAll(arr)`.
+public isolated function setLength((any|error)[] arr, int length) returns () = external;
+
+# Returns the index of first member of `arr` that is equal to `val` if there is one.
+# Returns `()` if not found.
+# Equality is tested using `==`.
+#
+# + arr - the array
+# + val - member to search for
+# + startIndex - index to start the search from
+# + return - index of the member if found, else `()`
+public isolated function indexOf(AnydataType[] arr, AnydataType val, int startIndex = 0) returns int? = external;
+
+# Returns the index of last member of `arr` that is equal to `val` if there is one.
+# Returns `()` if not found.
+# Equality is tested using `==`.
+#
+# + arr - the array
+# + val - member to search for
+# + startIndex - index to start searching backwards from
+# + return - index of the member if found, else `()`
+public isolated function lastIndexOf(AnydataType[] arr, AnydataType val, int startIndex = arr.length() - 1) returns int? = external;
+
+# Reverses the order of the members of an array.
+#
+# + arr - the array to be reversed
+# + return - new array with the members of `arr` in reverse order
+public isolated function reverse(Type[] arr) returns Type[] = external;
+
+# Direction for `sort` function.
+public enum SortDirection {
+   ASCENDING = "ascending",
+   DESCENDING = "descending"
+}
+
+# A type of which any ordered type must be a subtype.
+# Whether a type is an ordered type cannot be defined in
+# terms of being a subtype of a type, so being a subtype
+# of `OrderedType` is a necessary but not sufficient condition
+# for a type to be an ordered type.
+public type OrderedType ()|boolean|int|float|decimal|string|OrderedType[];
+
+# Sorts an array.
+# If the member type of the array is not ordered, then the `key` function
+# must be specified.
+# Sorting works the same as with the `sort` clause of query expressions.
+#
+# + arr - the array to be sorted; 
+# + direction - direction in which to sort
+# + key - function that returns a key to use to sort the members
+# + return - new array consisting of the members of `arr` in sorted order
+public isolated function sort(Type[] arr, SortDirection direction = ASCENDING,
+        (isolated function(Type val) returns OrderedType)? key = ()) returns Type[] = external;
+
+
+# Removes and returns the last member of an array.
+# The array must not be empty.
+#
+# + arr - the array
+# + return - removed member
+public isolated function pop(Type[] arr) returns Type = external;
+
+# Adds values to the end of an array.
+#
+# + arr - the array
+# + vals - values to add to the end of the array
+public isolated function push(Type[] arr, Type... vals) returns () = external;
+
+
+# Removes and returns first member of an array.
+# The array must not be empty.
+#
+# + arr - the array
+# + return - the value that was the first member of the array
+public isolated function shift(Type[] arr) returns Type = external;
+
+# Adds values to the start of an array.
+# The values newly added to the array will be in the same order
+# as they are in `vals`.
+# 
+# + arr - the array
+# + vals - values to add to the start of the array
+public isolated function unshift(Type[] arr, Type... vals) returns () = external;
+
+
+# Returns the string that is the Base64 representation of an array of bytes.
+# The representation is the same as used by a Ballerina Base64Literal.
+# The result will contain only characters  `A..Z`, `a..z`, `0..9`, `+`, `/` and `=`.
+# There will be no whitespace in the returned string.
+#
+# + arr - the array
+# + return - Base64 string representation
+public isolated function toBase64(byte[] arr) returns string = external;
+
+# Returns the byte array that a string represents in Base64.
+# `str` must consist of the characters `A..Z`, `a..z`, `0..9`, `+`, `/`, `=`
+# and whitespace as allowed by a Ballerina Base64Literal.
+#
+# + str - Base64 string representation
+# + return - the byte array or error
+public isolated function fromBase64(string str) returns byte[]|error = external;
+
+# Returns the string that is the Base16 representation of an array of bytes.
+# The representation is the same as used by a Ballerina Base16Literal.
+# The result will contain only characters  `0..9`, `a..f`.
+# There will be no whitespace in the returned string.
+#
+# + arr - the array
+# + return - Base16 string representation
+public isolated function toBase16(byte[] arr) returns string = external;
+
+# Returns the byte array that a string represents in Base16.
+# `str` must consist of the characters `0..9`, `A..F`, `a..f`
+# and whitespace as allowed by a Ballerina Base16Literal.
+#
+# + str - Base16 string representation
+# + return - the byte array or error
+public isolated function fromBase16(string str) returns byte[]|error = external;
+
+# Returns a stream of the members of an array.
+#
+# + arr - the array
+# + returns - stream of members of the array
+# The returned stream will use an iterator over `arr` and
+# will therefore handle mutation of `arr` in the same way
+# as an iterator does.
+# Theutation of the `arr`
+public isolated function toStream(T[] arr) returns stream<T,()> = external;
+
+ +
+ +
+

11.3.2 lang.boolean module

+ +

The lang.boolean module corresponds to basic type boolean.

+ +
+
+# Converts a string to a boolean.
+# Returns the boolean of which `s` is a string representation.
+# The accepted representations are `true`, `false`
+# (in any combination of lower- and upper-case),
+# and also `1` for true and `0` for `false`.
+# This is the inverse of `value:toString` applied to a `boolean`.
+#
+# + s - string representing a boolean value
+# + return - boolean that `s` represents, or an error if there is no such boolean
+public isolated function fromString(string s) returns boolean|error = external;
+
+# Tests whether at least one of a number of boolean values is true.
+# 
+# + bs - boolean values to operate on
+# + return - true if one or more of its arguments are true and false otherwise;
+#    false if there are no arguments
+public isolated function some(boolean... bs) returns boolean = external;
+
+# Tests whether every one of a number of boolean values is true.
+# 
+# + bs - boolean values to operate on
+# + return - true if all of its arguments are true and false otherwise;
+#    true if there are no arguments
+public isolated function every(boolean... bs) returns boolean = external;
+
+ +
+ +
+

11.3.3 lang.decimal module

+ +

The lang.decimal module corresponds to basic type decimal.

+ +
+
+# Sum of zero or more decimal values.
+#
+# + xs - decimal values to sum
+# + return - sum of all the `xs`; 0 if `xs` is empty
+public isolated function sum(decimal... xs) returns decimal = external;
+
+# Maximum of one or more decimal values.
+#
+# + x - first decimal value
+# + xs - other decimal values
+# + return - maximum value of `x` and all the `xs`
+public isolated function max(decimal x, decimal... xs) returns decimal = external;
+
+# Minimum of one or more decimal values
+#
+# + x - first decimal value
+# + xs - other decimal values
+# + return - minimum value of `x` and all the `xs`.
+public isolated function min(decimal x, decimal... xs) returns decimal = external;
+
+# Average of one or more decimal values.
+# 
+# + x - first decimal value
+# + xs - other decimal values
+# + return - average value of `x` and all the `xs`.
+public isolated function avg(decimal x, decimal... xs) returns decimal = external;
+
+# IEEE abs operation.
+#
+# + x - decimal value to operate on
+# + return - absolute value of `x`
+public isolated function abs(decimal x) returns decimal = external;
+
+# Round a decimal to a specified number of digits.
+# Returns the decimal value that has an exponent of `-fractionDigits`
+# and is closest to `x`.
+# If there are two such values, returns the one whose final digit is even
+# (this is the round-to-nearest rounding mode, which is the default for IEEE
+# and for Ballerina).
+# A value of `fractionDigits` greater than 0 thus corresponds to the number of digits after the decimal
+# point being `fractionDigits`; a value of 0 for `fractionDigits` rounds to an integer.
+# Note that IEEE 754 roundToIntegralTiesToEven operation differs from `round` with `fractionDigits` as 0,
+# in that roundToIntegralTiesToEven will return a value with a positive exponent when the operand has a positive exponent.
+# Note that `<int>x` is the same as `<int>x.round(0)`.
+#
+# + x - decimal value to operate on
+# + fractionDigits - the number of digits after the decimal point
+# + return - closest decimal value to `x` that is an integral multiple of 10 raised to the power of `-fractionDigits`
+public isolated function round(decimal x, int fractionDigits = 0) returns decimal = external;
+
+# Return a decimal with a specified value and exponent.
+# Return a decimal value that has the same value (except for rounding) as the first
+# argument, and the same exponent as the second argument.
+# This is the IEEE quantize operation.
+# + x - decimal value to operate on
+# + y - decimal value from which to get the quantum
+# + return - `x` with the quantum of `y`
+public isolated function quantize(decimal x, decimal y) returns decimal = external;
+
+# Rounds a decimal down to the closest integral value.
+#
+# + x - decimal value to operate on
+# + return - largest (closest to +∞) decimal value not greater than `x` that is a mathematical integer.
+public isolated function floor(decimal x) returns decimal = external;
+
+# Rounds a decimal up to the closest integral value.
+#
+# + x - decimal value to operate on
+# + return - smallest (closest to -∞) decimal value not less than `x` that is a mathematical integer
+public isolated function ceiling(decimal x) returns decimal = external;
+
+# Return the decimal value represented by `s`.
+# `s` must follow the syntax of DecimalFloatingPointNumber as defined by the Ballerina specification
+# with the following modifications
+# - the DecimalFloatingPointLiteral may have a leading `+` or `-` sign
+# - a FloatingPointTypeSuffix is not allowed
+# This is the inverse of `value:toString` applied to an `decimal`.
+#
+# + s - string representation of a decimal
+# + return - decimal representation of the argument or error
+public isolated function fromString(string s) returns decimal|error = external;
+
+ +
+ +
+

11.3.4 lang.error module

+ +

The lang.error module corresponds to basic type error.

+ +
+
+
+# Type for value that can be cloned.
+# This is the same as in lang.value, but is copied here to avoid a dependency.
+
+public type Cloneable readonly|xml|Cloneable[]|map<Cloneable>|table<map<Cloneable>>;
+
+# The type to which error detail records must belong.
+public type Detail record {|
+   Cloneable...;
+|};
+
+# A type parameter that is a subtype of error `Detail` record type.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type DetailType Detail;
+
+# Returns the error's message.
+#
+# + e - the error value
+# + return - error message
+public isolated function message(error e) returns string = external;
+
+# Returns the error's cause.
+#
+# + e - the error value
+# + return - error cause
+public isolated function cause(error e) returns error? = external;
+
+# Returns the error's detail record.
+# The returned value will be immutable.
+# + e - the error value
+# + return - error detail value
+public isolated function detail(error<DetailType> e) returns readonly & DetailType = external;
+
+# Type representing a stack frame.
+# A call stack is represented as an array of stack frames.
+# This type is also present in lang.runtime to avoid a dependency.
+public type StackFrame readonly & object {
+   # Returns a string representing this StackFrame.
+   # This must not contain any newline characters.
+   # + return - a string
+   public isolated function toString() returns string;
+};
+
+# Returns an array representing an error's stack trace.
+#
+# + e - the error value
+# + return - an array representing the stack trace of the error value
+# The first member of the array represents the top of the call stack.
+public isolated function stackTrace(error e) returns StackFrame[] = external;
+
+# Converts an error to a string.
+#
+# + e - the error to be converted to a string
+# + return - a string resulting from the conversion
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the direct style.
+public isolated function toString(error e) returns string = external;
+
+# Converts an error to a string that describes the value in Ballerina syntax.
+# + e - the error to be converted to a string
+# + return - a string resulting from the conversion
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the expression style.
+public isolated function toBalString(error e) returns string = external;
+
+# The type of error for a receive-action when no message has been sent.
+public type NoMessage distinct error;
+
+# A type of error which can be retried.
+public type Retriable distinct error;
+
+# The RetryManager used by default.
+public class DefaultRetryManager {
+   private int count;
+   public function init(int count = 3) {
+     this.count = count;
+   }
+   public function shouldRetry(error e) returns boolean {
+      if e is Retriable && count >  0 {
+         count -= 1;
+         return true;
+      }
+      else {
+         return false;
+      }
+   }
+}
+
+ +
+ +
+

11.3.5 lang.float module

+ +

The lang.float module corresponds to basic type float.

+ +
+
+
+# The number π
+public const float PI = 3.141592653589793;
+# Euler's number
+public const float E =  2.718281828459045;
+# IEEE not-a-number value
+public const float NaN = 0.0/0.0;
+
+# IEEE positive infinity
+public const float Infinity = 1.0/0.0;
+
+# Tests whether a float is finite.
+# Exactly one of isFinite, isInfinite and IsNaN will be true for any float value
+#
+# + x - the float to be tested
+# + return - true if `x` is finite, i.e. neither NaN nor +∞ nor -∞
+public isolated function isFinite(float x) returns boolean = external;
+
+# Tests whether a float is infinite.
+# Exactly one of isFinite, isInfinite and IsNaN will be true for any float value
+#
+# + x - the float to be tested
+# + return - true if `x` is either +∞ or -∞
+public isolated function isInfinite(float x) returns boolean = external;
+
+# Tests whether a float is NaN.
+# Exactly one of isFinite, isInfinite and IsNaN will be true for any float value.
+#
+# + x - the float to be tested
+# + return - true if `x` is NaN
+public isolated function isNaN(float x) returns boolean = external;
+
+# Sum of zero or more float values.
+# Result is NaN if any arg is NaN
+#
+# + xs - float values to sum
+# + return - sum of all the `xs`, +0.0 if `xs` is empty
+public isolated function sum(float... xs) returns float = external;
+
+# Maximum of zero or more float values.
+# Result is -∞ if no args
+# NaN if any arg is NaN
+#
+# + xs - float values to operate on
+# + return - maximum value of all the `xs`
+public isolated function max(float... xs) returns float = external;
+
+# Minimum of zero or more float values.
+# Result is +∞ if no args
+# Result is NaN if any arg is NaN
+#
+# + xs - float values to operate on
+# + return - minimum value of all the `xs`
+public isolated function min(float... xs) returns float = external;
+
+# Average of zero or more float values.
+# Result is NaN if there are no arguments
+# 
+# + xs - float values to operate on
+# + return - average of all the `xs`
+public isolated function avg(float... xs) returns float = external;
+
+# IEEE abs operation.
+#
+# + x - float value to operate on
+# + return - absolute value of `x`
+public isolated function abs(float x) returns float = external;
+
+# Round a float value to a specified number of digits.
+# Returns the float value that is an integral multiple of 10 raised to the power of `-fractionDigits` and closest to `x`.
+# If there are two such values, choose the one whose final digit is even
+# (this is the round-to-nearest rounding mode, which is the default for IEEE and for Ballerina).
+# A value of `fractionDigits` greater than 0 thus corresponds to the number of digits after the decimal
+# point being `fractionDigits`; a value of 0 for `fractionDigits` rounds to an integer.
+# If `x` is NaN, +0, -0, +∞ or -∞, then the result is `x`.
+# When `fractionDigits` is 0, this is
+# the same as Java Math.rint method, .NET Math.Round method and
+# IEEE roundToIntegralTiesToEven operation
+# Note that `<int>x` is the same as `<int>x.round(0)`.
+#
+# + x - float value to operate on
+# + fractionDigits - the number of digits after the decimal point
+# + return - float value closest to `x` that is an integral multiple of 10 raised to the power of `-fractionDigits`
+public isolated function round(float x, int fractionDigits = 0) returns float = external;
+
+# Rounds a float down to the closest integral value.
+#
+# + x - float value to operate on
+# + return - largest (closest to +∞) float value not greater than `x` that is a mathematical integer.
+public isolated function floor(float x) returns float = external;
+
+# Rounds a float up to the closest integral value.
+#
+# + x - float value to operate on
+# + return - smallest (closest to -∞) decimal value not less than `x` that is a mathematical integer
+public isolated function ceiling(float x) returns float = external;
+
+# Returns the square root of a float value.
+# Corresponds to IEEE squareRoot operation.
+#
+# + x - float value to operate on
+# + return - square root of `x`
+public isolated function sqrt(float x) returns float = external;
+
+# Returns the cube root of a float value.
+# Corresponds to IEEE rootn(x, 3) operation.
+#
+# + x - float value to operate on
+# + return - cube root of `x`
+public isolated function cbrt(float x) returns float = external;
+
+# Raises one float value to the power of another float values.
+# Corresponds to IEEE pow(x, y) operation.
+#
+# + x - base value
+# + y - the exponent
+# + return - `x` raised to the power of `y`
+public isolated function pow(float x, float y) returns float = external;
+
+# Returns the natural logarithm of a float value
+# Corresponds to IEEE log operation.
+#
+# + x - float value to operate on
+# + return - natural logarithm of `x`
+public isolated function log(float x) returns float = external;
+
+# Returns the base 10 logarithm of a float value.
+# Corresponds to IEEE log10 operation.
+#
+# + x - float value to operate on
+# + return - base 10 logarithm of `x`
+public isolated function log10(float x) returns float = external;
+
+# Raises Euler's number to a power.
+# Corresponds to IEEE exp operation.
+#
+# + x - float value to operate on
+# + return - Euler's number raised to the power `x`
+public isolated function exp(float x) returns float = external;
+
+# Returns the sine of a float value.
+# Corresponds to IEEE sin operation.
+#
+# + x - float value, specifying an angle in radians
+# + return - the sine of `x`
+public isolated function sin(float x) returns float = external;
+
+# Returns the cosine of a float value.
+# Corresponds to IEEE cos operation.
+#
+# + x - float value, specifying an angle in radians
+# + return - the cosine of `x`
+public isolated function cos(float x) returns float = external;
+
+# Returns the tangent of a float value.
+# Corresponds to IEEE tan operation
+#
+# + x - float value, specifying an angle in radians
+# + return - the tangent of `x`
+public isolated function tan(float x) returns float = external;
+
+# Returns the arccosine of a float value.
+# Corresponds to IEEE acos operation
+#
+# + x - float value to operate on
+# + return - the arccosine of `x` in radians
+public isolated function acos(float x) returns float = external;
+
+# Returns the arctangent of a float value.
+# Corresponds to IEEE atan operation.
+#
+# + x - float value to operate on
+# + return - the arctangent of `x` in radians
+public isolated function atan(float x) returns float = external;
+
+# Returns the arcsine of a float value.
+# Corresponds to IEEE asin operation.
+#
+# + x - float value to operate on
+# + return - the arcsine of `x` in radians
+public isolated function asin(float x) returns float = external;
+
+# Performs the 2-argument arctangent operation.
+# Corresponds IEEE atan2(y, x) operation.
+#
+# + y - the y-coordinate
+# + x - the x-coordinate
+# + return - the angle in radians from the positive x-axis to the point
+#   whose Cartesian coordinates are `(x, y)`
+public isolated function atan2(float y, float x) returns float = external;
+
+# Returns the hyperbolic sine of a float value.
+# Corresponds to IEEE sinh operation.
+#
+# + x - float value to operate on
+# + return - hyperbolic sine of `x`
+public isolated function sinh(float x) returns float = external;
+
+# Returns the hyperbolic cosine of a float value.
+# Corresponds to IEEE cosh operation.
+#
+# + x - float value to operate on
+# + return - hyperbolic cosine of `x`
+public isolated function cosh(float x) returns float = external;
+
+# Returns the hyperbolic tangent of a float value.
+# Corresponds to IEEE tanh operation.
+#
+# + x - float value to operate on
+# + return - hyperbolic tangent of `x`
+public isolated function tanh(float x) returns float = external;
+
+# Return the float value represented by `s`.
+# `s` must follow the syntax of DecimalFloatingPointNumber as defined by the Ballerina specification
+# with the following modifications
+# - the DecimalFloatingPointNumber may have a leading `+` or `-` sign
+# - `NaN` is allowed
+# - `Infinity` is allowed with an optional leading `+` or `-` sign
+# - a FloatingPointTypeSuffix is not allowed
+# This is the inverse of `value:toString` applied to an `float`.
+#
+# + s - string representation of a float
+# + return - float value or error
+public isolated function fromString(string s) returns float|error = external;
+
+# Returns a string that represents `x` as a hexadecimal floating point number.
+# The returned string will comply to the grammar of HexFloatingPointLiteral
+# in the Ballerina spec with the following modifications:
+# - it will have a leading `-` sign if negative
+# - positive infinity will be represented by `Infinity`
+# - negative infinity will be represented by `-Infinity`
+# - NaN will be represented by `NaN`
+# The representation includes `0x` for finite numbers.
+#
+# + x - float value
+# + return - hexadecimal floating point hex string representation
+public isolated function toHexString(float x) returns string = external;
+
+# Return the float value represented by `s`.
+# `s` must follow the syntax of HexFloatingPointLiteral as defined by the Ballerina specification
+# with the following modifications
+# - the HexFloatingPointLiteral may have a leading `+` or `-` sign
+# - `NaN` is allowed
+# - `Infinity` is allowed with an optional leading `+` or `-` sign
+#
+# + s - hexadecimal floating point hex string representation
+# + return - float value or error
+public isolated function fromHexString(string s) returns float|error = external;
+
+# Returns IEEE 64-bit binary floating point format representation of `x` as an int.
+#
+# + x - float value
+# + return - `x` bit pattern as an int
+public isolated function toBitsInt(float x) returns int = external;
+
+# Returns the float that is represented in IEEE 64-bit floating point by `x`.
+# All bit patterns that IEEE defines to be NaNs will all be mapped to the single float NaN value.
+#
+# + x - int value
+# + return - `x` bit pattern as a float
+public isolated function fromBitsInt(int x) returns float = external;
+
+# Returns a string that represents `x` using fixed-point notation.
+# The returned string will be in the same format used by `value:toString`,
+# except that it will not include an exponent.
+# If `x` is NaN or infinite, the result will be the same as `value:toString`.
+# This will panic if `fractionDigits` is less than 0.
+# If `fractionDigits` is zero, there will be no decimal point.
+# Any necessary rounding will use the roundTiesToEven rounding direction.
+# 
+# + x - float value
+# + fractionDigits - number of digits following the decimal point; `()` means to use
+#    the minimum number of digits required to accurately represent the value
+# + return - string representation of `x` in fixed-point notation 
+public isolated function toFixedString(float x, int? fractionDigits) returns string = external;
+
+# Returns a string that represents `x` using scientific notation.
+# The returned string will be in the same format used by `value:toString`,
+# except that it will always include an exponent and there will be exactly
+# one digit before the decimal point.
+# But if `x` is NaN or infinite, the result will be the same as `value:toString`.
+# The digit before the decimal point will be zero only if all other digits
+# are zero.
+# This will panic if fractionDigits is less than 0.
+# If `fractionDigits` is zero, there will be no decimal point.
+# Any necessary rounding will use the roundTiesToEven rounding direction.
+# The exponent in the result uses lower-case `e`, followed by a `+` or `-` sign,
+# followed by at least two digits, and only as many more digits as are needed
+# to represent the result. If `x` is zero, the exponent is zero. A zero exponent
+# is represented with a `+` sign.
+# 
+# + x - float value
+# + fractionDigits - number of digits following the decimal point; `()` means to use
+#    the minimum number of digits required to accurately represent the value
+# + return - string representation of `x` in scientific notation 
+public isolated function toExpString(float x, int? fractionDigits) returns string = external;
+
+ +
+ +
+

11.3.6 lang.function module

+ +

The lang.function module corresponds to basic type function.

+ +
+
+# Calls a function dynamically.
+# If the arguments specified in `args` are not of the type required by `func`,
+# then this will panic.
+#
+# + func - the function to be called
+# + args - the arguments to be passed to the function
+# + return - the return value of the call to the function
+public isolated function call(@isolatedParam function func, any|error... args)
+    returns any|error = external;
+
+ +
+ +
+

11.3.7 lang.future module

+ +

The lang.future module corresponds to basic type future.

+ +
+
+# Requests cancellation of a future.
+# + f - the future to be cancelled
+# This sets the cancellation flag in the strand corresponding to `f`.
+# Each time that a strand yields, it will check the cancellation flag
+# and terminate abnormally if the flag is set.
+public isolated function cancel(future f) returns () = external;
+
+ +
+ +
+

11.3.8 lang.int module

+ +

The lang.int module corresponds to basic type int.

+ +
+
+# Built-in subtype that allows signed integers that can be represented in 32 bits using two's complement.
+# This allows an int between -2^31 and 2^31 - 1 inclusive.
+# i.e. between -2,147,483,648 and 2,147,483,647 inclusive.
+@builtinSubtype
+public type Signed32 int;
+
+# Built-in subtype that allows non-negative integers that can be represented in 16 bits using two's complement.
+# This allows an int between -2^15 and 2^15 - 1 inclusive.
+# i.e. between -32,768 and 32,767 inclusive.
+@builtinSubtype
+public type Signed16 int;
+
+# Built-in subtype that allows non-negative integers that can be represented in 8 bits using two's complement.
+# This allows an int between -2^7 and 2^7 - 1 inclusive.
+# i.e. between -128 and 127 inclusive.
+@builtinSubtype
+public type Signed8 int;
+
+# Built-in subtype that allows non-negative integers that can be represented in 32 bits.
+# This allows an int between 0 and 2^32 - 1 inclusive,
+# i.e. between 0 and 4,294,967,295 inclusive.
+@builtinSubtype
+public type Unsigned32 int;
+
+# Built-in subtype that allows non-negative integers that can be represented in 16 bits.
+# This allows an int between 0 and 2^16 - 1 inclusive,
+# i.e. between 0 and 65,535 inclusive.
+@builtinSubtype
+public type Unsigned16 int;
+
+# Built-in subtype that allows non-negative integers that can be represented in 8 bits.
+# This allows an int between 0 and 2^8 - 1 inclusive,
+# i.e. between 0 and 255 inclusive.
+# This is the same as `byte`.
+@builtinSubtype
+public type Unsigned8 int;
+
+# Maximum value of type `int`.
+public const MAX_VALUE = 9223372036854775807;
+# Minimum value of type `int`.
+public const MIN_VALUE = -9223372036854775807 - 1; // -9223372036854775808 would overflow
+# Maximum value of type `Signed32`.
+public const SIGNED32_MAX_VALUE = 2147483647;
+# Minimum value of type `Signed32`.
+public const SIGNED32_MIN_VALUE = -2147483648;
+# Maximum value of type `Signed16`.
+public const SIGNED16_MAX_VALUE = 32767;
+# Minimum value of type `Signed16`.
+public const SIGNED16_MIN_VALUE = -32768;
+# Maximum value of type `Signed8`.
+public const SIGNED8_MAX_VALUE = 127;
+# Minimum value of type `Signed8`.
+public const SIGNED8_MIN_VALUE = -128;
+# Maximum value of type `Unsigned32`.
+public const UNSIGNED32_MAX_VALUE = 4294967295;
+# Maximum value of type `Unsigned16`.
+public const UNSIGNED16_MAX_VALUE = 65535;
+# Maximum value of type `Unsigned8`.
+public const UNSIGNED8_MAX_VALUE = 255;
+
+
+# Returns absolute value of an int.
+#
+# + n - int value to be operated on
+# + return - absolute value of `n`
+public isolated function abs(int n) returns int = external;
+
+# Returns sum of zero or more int values.
+#
+# + ns - int values to sum
+# + return - sum of all the `ns`; 0 is `ns` is empty
+public isolated function sum(int... ns) returns int = external;
+
+# Maximum of one or more int values.
+#
+# + n - first int value
+# + ns - other int values
+# + return - maximum value of value of `x` and all the `xs`
+public isolated function max(int n, int... ns) returns int = external;
+
+# Minimum of one or more int values
+#
+# + n - first int value
+# + ns - other int values
+# + return - minimum value of `n` and all the `ns`
+public isolated function min(int n, int... ns) returns int = external;
+
+# Average of one or more int values.
+# The average is computed using the decimal type.
+# This function panics if the sum of the arguments overflows the decimal type.
+#
+# + n - first int value
+# + ns - other int values
+# + return - minimum value of `n` and all the `ns`
+public isolated function avg(int n, int... ns) returns decimal = external;
+
+# Returns the integer that `s` represents in decimal.
+# Returns error if `s` is not the decimal representation of an integer.
+# The first character may be `+` or `-`.
+# This is the inverse of `value:toString` applied to an `int`.
+#
+# + s - string representation of a integer value
+# + return - int representation of the argument or error
+public isolated function fromString(string s) returns int|error = external;
+
+# Returns representation of `n` as hexdecimal string.
+# There is no `0x` prefix. Lowercase letters a-f are used.
+# Negative numbers will have a `-` prefix. No sign for
+# non-negative numbers.
+#
+# + n - int value
+# + return - hexadecimal string representation of int value
+public isolated function toHexString(int n) returns string = external;
+
+# Returns the integer that `s` represents in hexadecimal.
+# Both uppercase A-F and lowercase a-f are allowed.
+# It may start with an optional `+` or `-` sign.
+# No `0x` or `0X` prefix is allowed.
+# Returns an error if the `s` is not in an allowed format.
+#
+# + s - hexadecimal string representation of int value
+# + return - int value or error
+public isolated function fromHexString(string s) returns int|error = external;
+
+# Returns an iterable object that iterates over a range of integers.
+# The integers returned by the iterator belong to the set S,
+# where S is `{ rangeStart + step*i such that i >= 0 }`.
+# When `step > 0`, the members of S that are `< rangeEnd` are returned in increasing order.
+# When `step < 0`, the members of S that are `> rangeEnd` are returned in decreasing order.
+# When `step = 0`, the function panics.
+# + rangeStart - the first integer to be returned by the iterator
+# + rangeEnd - the exclusive limit on the integers returned by the iterator
+# + step - the difference between successive integers returned by the iterator;
+#    a positive value gives an increasing sequence; a negative value gives
+#    a decreasing sequence
+# + return - an iterable object
+public isolated function range(int rangeStart, int rangeEnd, int step) returns object {
+    *object:Iterable;
+    public isolated function iterator() returns object {
+        public isolated function next() returns record {|
+            int value;
+       |}?;
+    };
+} = external;
+
+ +
+ +
+

11.3.9 lang.map module

+ +

The lang.map module corresponds to basic type mapping.

+ +
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type any|error;
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type1 any|error;
+
+# Returns number of members of a map.
+#
+# + m - the map
+# + return - number of members in `m`
+public isolated function length(map<any|error> m) returns int = external;
+
+# Returns an iterator over a map.
+# The iterator will iterate over the members of the map not the keys.
+# The `entries` function can be used to iterate over the keys and members together.
+# The `keys` function can be used to iterator over just the keys.
+# 
+# + m - the map
+# + return - a new iterator object that will iterate over the members of `m`
+public isolated function iterator(map<Type> m) returns object {
+    public isolated function next() returns record {|
+        Type value;
+    |}?;
+} = external;
+
+# Returns the member of map `m` with key `k`.
+# This for use in a case where it is known that the map has a specific key,
+# and accordingly panics if `m` does not have a member with key `k`.
+#
+# + m - the map
+# + k - the key
+# + return - member with key `k`
+public isolated function get(map<Type> m, string k) returns Type = external;
+
+# Returns a map containing [key, member] pair as the value for each key.
+#
+# + m - the map
+# + return - a new map of [key, member] pairs
+public isolated function entries(map<Type> m) returns map<[string, Type]> = external;
+
+
+# Applies a function each member of a map and returns a map of the result.
+# The resulting map will have the same keys as the argument map.
+#
+# + m - the map
+# + func - a function to apply to each member
+# + return - new map containing result of applying function `func` to each member
+public isolated function 'map(map<Type> m, @isolatedParam function(Type val) returns Type1 func) returns map<Type1> = external;
+
+# Applies a function to each member of a map.
+# The function `func` is applied to each member of `m`.
+#
+# + m - the map
+# + func - a function to apply to each member
+public isolated function forEach(map<Type> m, @isolatedParam function(Type val) returns () func) returns () = external;
+
+# Selects the members from a map for which a function returns true.
+#
+# + m - the map
+# + func - a predicate to apply to each element to test whether it should be included
+# + return - new map containing members for which `func` evaluates to true
+public isolated function filter(map<Type> m, @isolatedParam function(Type val) returns boolean func) returns map<Type> = external;
+
+# Combines the members of a map using a combining function.
+# The combining function takes the combined value so far and a member of the map,
+# and returns a new combined value.
+#
+# + m - the map
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `m` using `func`
+public isolated function reduce(map<Type> m, @isolatedParam function(Type1 accum, Type val) returns Type1 func, Type1 initial) returns Type1 = external;
+
+# Removes a member of a map.
+#
+# + m - the map
+# + k - the key
+# + return - the member of `m` that had key `k`
+# This removes the member of `m` with key `k` and returns it.
+# It panics if there is no such member.
+public isolated function remove(map<Type> m, string k) returns Type = external;
+
+# Removes a member of a map with a given key, if the map has member with the key.
+#
+# + m - the map
+# + k - the key
+# + return - the member of `m` that had key `k`, or `()` if `m` does not have a key `k`
+# If `m` has a member with key `k`, it removes and returns it;
+# otherwise it returns `()`.
+public isolated function removeIfHasKey(map<Type> m, string k) returns Type? = external;
+
+# Removes all members of a map.
+# This panics if any member cannot be removed.
+#
+# + m - the map
+public isolated function removeAll(map<any|error> m) returns () = external;
+
+# Tests whether m has a member with key `k`.
+#
+# + m - the map
+# + k - the key
+# + return - true if m has a member with key `k`
+public isolated function hasKey(map<Type> m, string k) returns boolean = external;
+
+# Returns a list of all the keys of map `m`.
+#
+# + m - the map
+# + return - a new list of all keys
+public isolated function keys(map<any|error> m) returns string[] = external;
+
+# Returns a list of all the members of a map.
+#
+# + m - the map
+# + return - an array whose members are the members of `m`
+public isolated function toArray(map<Type> m) returns Type[] = external;
+
+ +
+ +
+

11.3.10 lang.object module

+ +

The lang.object module corresponds to basic type object.

+ +
+
+# Distinct Iterable type.
+# An object can make itself iterable by using `*object:Iterable;`,
+# and then defining an `iterator` method.
+public type Iterable distinct object {
+    # Create a new iterator.
+    #
+    # + return - a new iterator object
+    public function iterator() returns object {
+        public function next() returns record {| any|error value; |}|error?;
+    };
+};
+
+# Distinct RawTemplate type.
+# A raw template expression constructs an object belonging to this type.
+public type RawTemplate distinct object {
+    # An array of the strings containing the characters in BacktickString
+    # outside of interpolations, split at the interpolation points.
+    # The length of this array is one greater than
+    # the length of the `insertions` array.
+    public (readonly & string[]) strings;
+    # An array containing the results of evaluating the
+    # interpolations in the BacktickString.
+    public (any|error)[] insertions;
+};
+
+ +
+ +
+

11.3.11 lang.regexp module (preview)

+ +

The lang.regexp module corresponds to the basic type for the +tagged data type with tag re.

+ +
+
+# The type RegExp refers to the tagged data basic type with tag `re`.
+@builtinSubtype
+public type RegExp any;
+
+# A span of a string.
+# A span is a substring of another string.
+public type Span readonly & object {
+   # The index within the string where the span starts.
+   public int startIndex;
+   # The index within the string following the end of the span.
+   # The length of the span is `endIndex - startIndex`.
+   public int endIndex;
+   # Returns a string with the content of the span.
+   isolated function substring() returns string;
+};
+
+# A list providing detailed information about the match of a regular expression within string.
+# Each member of the list identifies the `Span` within the string matched
+# by each of the regular expression's capturing groups. 
+# The member with index 0 corresponds to the entire regular expression.
+# The group with index i, where i > 1,is the i-th capturing group;
+# this will be nil if the match of the regular expression did not use
+# a match of the capturing group.
+# The capturing groups within a regular expression are ordered by the position
+# of their opening parenthesis.
+public type Groups readonly & [Span, Span?...];
+
+# Returns the first match of a regular expression within a string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to start looking for a match
+# + return - a `Span` describing the match, or nil if no match was found
+public isolated function find(RegExp re, string str, int startIndex = 0) returns Span? = external;
+
+# Returns the `Groups` for the first match of a regular expression within a string.
+#
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to start looking for a match
+# + return - a `Groups` list describing the match, or nil if no match was found
+public isolated function findGroups(RegExp re, string str, int startIndex = 0) returns Groups? = external;
+
+# Returns a list of all the matches of a regular expression within a string.
+# After one match is found, it looks for the next match starting where the previous
+# match ended, so the list of matches will be non-overlapping.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for matches of `re` 
+# + startIndex - the index within `str` at which to start looking for matches
+# + return - a list containing a `Span` for each match found
+public isolated function findAll(RegExp re, string str, int startIndex = 0) returns Span[] = external;
+
+# Returns the `Groups` of all the matches of a regular expression within a string.
+# After one match is found, it looks for the next match starting where the previous
+# match ended, so the list of matches will be non-overlapping.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for matches of `re` 
+# + startIndex - the index within `str` at which to start looking for matches
+# + return - a list containing a `Group` for each match found
+public isolated function findAllGroups(RegExp re, string str, int startIndex = 0) returns Groups[] = external;
+
+# Tests whether there is a match of a regular expression at a specific index in the string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to look for a match; defaults to zero
+# + return - a `Span` describing the match, or nil if `re` did not match at that index; the startIndex of the
+#   `Span` will always be equal to `startIndex`
+public isolated function matchAt(RegExp re, string str, int startIndex = 0) returns Span? = external;
+
+# Returns the `Groups` of the match of a regular expression at a specific index in the string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to look for a match; defaults to zero
+# + return - a `Groups` list describing the match, or nil if `re` did not match at that index; the startIndex of the
+#   first `Span` in the list will always be equal to the `startIndex` of the first member of the list
+public isolated function matchGroupsAt(RegExp re, string str, int startIndex = 0) returns Groups? = external;
+
+# Tests whether there is full match of regular expression with a string.
+# A match of a regular expression in a string is a full match if it
+# starts at index 0 and ends at index `n`, where `n` is the length of the string.
+#
+# + re - the regular expression  
+# + str - the string
+# + return - true if there is full match of `re` with `str`, and false otherwise
+public isolated function isFullMatch(RegExp re, string str) returns boolean = external;
+
+# Returns the `Groups` of the match of a regular expression that is a full match of a string.
+# A match of the regular expression in a string is a full match if it
+# starts at index 0 and ends at index `n`, where `n` is the length of the string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + return - a `Groups` list describing the match, or nil if there is not a full match; the 
+#   first `Span` in the list will be all of `str`
+public isolated function fullMatchGroups(RegExp re, string str) returns Groups? = external;
+
+# A function that constructs the replacement for the match of a regular expression.
+# The `groups` parameter describes the match for which the replacement is to be constructed.
+public type ReplacerFunction isolated function(Groups groups) returns string;
+
+# The replacement for the match of a regular expression found within a string.
+# A string value specifies that the replacement is a fixed string.
+# A function that specifies that the replacement is constructed by calling a function for each match.
+public type Replacement ReplacerFunction|string;
+
+# Replaces the first match of a regular expression.
+#
+# + re - the regular expression  
+# + str - the string in which to perform the replacements  
+# + replacement - a `Replacement` that gives the replacement for the match  
+# + startIndex - the index within `str` at which to start looking for a match; defaults to zero
+# + return - `str` with the first match, if any, replaced by the string specified by `replacement`
+public isolated function replace(RegExp re, string str, Replacement replacement, int startIndex = 0) returns string = external;
+
+# Replaces all matches of a regular expression.
+# After one match is found, it looks for the next match starting where the previous
+# match ended, so the matches will be non-overlapping.
+#
+# + re - the regular expression  
+# + str - the string in which to perform the replacements  
+# + replacement - a `Replacement` that gives the replacement for each match  
+# + startIndex - the index within `str` at which to start looking for matches; defaults to zero
+# + return - `str` with every match replaced by the string specified by `replacement`
+public isolated function replaceAll(RegExp re, string str, Replacement replacement, int startIndex = 0) returns string = external;
+
+# Splits a string into substrings separated by matches of a regular expression.
+# This finds the the non-overlapping matches of a regular expression and
+# returns a list of substrings of `str` that occur before the first match,
+# between matches, or after the last match.  If there are no matches, then
+# `[str]` will be returned.
+# 
+# + re - the regular expression that specifies the separator
+# + str - the string to be split
+# + return - a list of substrings of `str` separated by matches of `re` 
+public isolated function split(RegExp re, string str) returns string[] = external;
+
+# Constructs a regular expression from a string.
+# The syntax of the regular expression is the same as accepted by the `re` tagged data template expression.
+#
+# + str - the string representation of a regular expression
+# + return - the regular expression, or an error value if `str` is not a valid regular expression
+public isolated function fromString(string str) returns RegExp|error = external;
+
+ +
+ +
+

11.3.12 lang.stream module

+ +

The lang.stream module corresponds to basic type stream.

+ +
+
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type any|error;
+
+# A type parameter that is a subtype of `error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type ErrorType error;
+
+# A type parameter that is a subtype of `error?`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+# This represents the result type of an iterator.
+@typeParam
+type CompletionType error?;
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type1 any|error;
+
+# Returns an iterator over a stream.
+#
+# + stm - the stream
+# + return - a new iterator object that will iterate over the members of `stm`.
+public isolated function iterator(stream<Type,CompletionType> stm) returns object {
+    public isolated function next() returns record {|
+        Type value;
+    |}|CompletionType;
+} = external;
+
+# Returns the next member of the stream.
+#
+# + stm - the stream
+# + return - a record containing the next member of the stream, if there is one, or,
+#   otherwise, the completion value
+public isolated function next(stream<Type,CompletionType> stm) returns record {|
+        Type value;
+    |}|CompletionType = external;
+
+# Closes a stream.
+# This releases any system resources being used by the stream.
+# Closing a stream that has already been closed has no effect and returns `()`.
+#
+# + stm - the stream to close
+# + return - () if the close completed successfully, otherwise an error
+public isolated function close(stream<Type,CompletionType> stm) returns CompletionType? = external;
+
+
+# Applies a function to each member of a stream and returns a stream of the results.
+#
+# + stm - the stream
+# + func - a function to apply to each member
+# + return - new stream containing result of applying `func` to each member of `stm` in order
+public isolated function 'map(stream<Type,CompletionType> stm, @isolatedParam function(Type val) returns Type1 func)
+   returns stream<Type1,CompletionType> = external;
+
+# Applies a function to each member of a stream.
+# The function `func` is applied to each member of stream `stm` in order.
+#
+# + stm - the stream
+# + func - a function to apply to each member
+public isolated function forEach(stream<Type,CompletionType> stm, @isolatedParam function(Type val) returns () func) returns CompletionType = external;
+
+# Selects the members from a stream for which a function returns true.
+#
+# + stm - the stream
+# + func - a predicate to apply to each member to test whether it should be selected
+# + return - new stream only containing members of `stm` for which `func` evaluates to true
+public isolated function filter(stream<Type,CompletionType> stm, @isolatedParam function(Type val) returns boolean func)
+   returns stream<Type,CompletionType> = external;
+
+# Combines the members of a stream using a combining function.
+# The combining function takes the combined value so far and a member of the stream,
+# and returns a new combined value.
+#
+# + stm - the stream
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `stm` using `func`
+public isolated function reduce(stream<Type,ErrorType?> stm, @isolatedParam function(Type1 accum, Type val) returns Type1 func, Type1 initial)
+   returns Type1|ErrorType = external;
+
+ +
+ +
+

11.3.13 lang.string module

+ +

The lang.string module corresponds to basic type string.

+ +
+
+import ballerina/lang.regexp;
+
+# Built-in subtype of string containing strings of length 1.
+@builtinSubtype
+type Char string;
+
+# Returns the length of the string.
+#
+# + str - the string
+# + return - the number of characters (code points) in `str`
+public isolated function length(string str) returns int = external;
+
+# Returns an iterator over the string.
+# The iterator will yield the substrings of length 1 in order.
+#
+# + str - the string to be iterated over
+# + return - a new iterator object
+public isolated function iterator(string str) returns object {
+    public isolated function next() returns record {| Char value; |}?;
+} = external;
+
+# Concatenates zero or more strings.
+#
+# + strs - strings to be concatenated
+# + return - concatenation of all of the `strs`; empty string if `strs` is empty
+public isolated function concat(string... strs) returns string = external;
+
+# Returns the code point of a character in a string.
+#
+# + str - the string
+# + index - an index in `str`
+# + return - the Unicode code point of the character at `index` in `str`
+public isolated function getCodePoint(string str, int index) returns int = external;
+
+# Returns a substring of a string.
+#
+# + str - source string.
+# + startIndex - the starting index, inclusive
+# + endIndex - the ending index, exclusive
+# + return - substring consisting of characters with index >= startIndex and < endIndex
+public isolated function substring(string str, int startIndex, int endIndex = str.length()) returns string = external;
+
+# Lexicographically compares strings using their Unicode code points.
+# This orders strings in a consistent and well-defined way,
+# but the ordering will often not be consistent with cultural expectations
+# for sorted order.
+#
+# + str1 - the first string to be compared
+# + str2 - the second string to be compared
+# + return - an int that is less than, equal to or greater than zero,
+#    according as `str1` is less than, equal to or greater than `str2`
+public isolated function codePointCompare(string str1, string str2) returns int = external;
+
+# Joins zero or more strings together with a separator.
+#
+# + separator - separator string
+# + strs - strings to be joined
+# + return - a string consisting of all of `strs` concatenated in order
+#     with `separator` in between them
+public isolated function 'join(string separator, string... strs) returns string = external;
+
+# Finds the first occurrence of one string in another string.
+#
+# + str - the string in which to search
+# + substr - the string to search for
+# + startIndex - index to start searching from
+# + return - index of the first occurrence of `substr` in `str` that is >= `startIndex`,
+#    or `()` if there is no such occurrence
+public isolated function indexOf(string str, string substr, int startIndex = 0) returns int? = external;
+
+# Finds the last occurrence of one string in another string.
+#
+# + str - the string in which to search
+# + substr - the string to search for
+# + startIndex - index to start searching backwards from
+# + return - index of the last occurrence of `substr` in `str` that is <= `startIndex`,
+#    or `()` if there is no such occurrence
+public isolated function lastIndexOf(string str, string substr, int startIndex = str.length() - substr.length()) returns int? = external;
+
+# Tests whether a string includes another string.
+#
+# + str - the string in which to search
+# + substr - the string to search for
+# + startIndex - index to start searching from
+# + return - `true` if there is an occurrence of `substr` in `str` at an index >= `startIndex`,
+#    or `false` otherwise
+public isolated function includes(string str, string substr, int startIndex = 0) returns boolean = external;
+
+# Tests whether a string starts with another string.
+#
+# + str - the string to be tested
+# + substr - the starting string
+# + return - true if `str` starts with `substr`; false otherwise
+public isolated function startsWith(string str, string substr) returns boolean = external;
+
+# Tests whether a string ends with another string.
+#
+# + str - the string to be tested
+# + substr - the ending string
+# + return - true if `str` ends with `substr`; false otherwise
+public isolated function endsWith(string str, string substr) returns boolean = external;
+
+
+# Converts occurrences of A-Z to a-z.
+# Other characters are left unchanged.
+#
+# + str - the string to be converted
+# + return - `str` with any occurrences of A-Z converted to a-z
+public isolated function toLowerAscii(string str) returns string = external;
+
+# Converts occurrences of a-z to A-Z.
+# Other characters are left unchanged.
+#
+# + str - the string to be converted
+# + return - `str` with any occurrences of a-z converted to A-Z
+public isolated function toUpperAscii(string str) returns string = external;
+
+
+# Tests whether two strings are the same, ignoring the case of ASCII characters.
+# A character in the range a-z is treated the same as the corresponding character in the range A-Z.
+#
+# + str1 - the first string to be compared
+# + str2 - the second string to be compared
+# + return - true if `str1` is the same as `str2`, treating upper-case and lower-case
+# ASCII letters as the same; false, otherwise
+public isolated function equalsIgnoreCaseAscii(string str1, string str2) returns boolean = external;
+
+# Removes ASCII white space characters from the start and end of a string.
+# The ASCII white space characters are 0x9...0xD, 0x20.
+#
+# + str - the string
+# + return - `str` with leading or trailing ASCII white space characters removed
+public isolated function trim(string str) returns string = external;
+
+# Represents `str` as an array of bytes using UTF-8.
+#
+# + str - the string
+# + return - UTF-8 byte array
+public isolated function toBytes(string str) returns byte[] = external;
+
+# Constructs a string from its UTF-8 representation in `bytes`.
+#
+# + bytes - UTF-8 byte array
+# + return - `bytes` converted to string or error
+public isolated function fromBytes(byte[] bytes) returns string|error = external;
+
+# Converts a string to an array of code points.
+#
+# + str - the string
+# + return - an array with a code point for each character of `str`
+public isolated function toCodePointInts(string str) returns int[] = external;
+
+# Converts a single character string to a code point.
+#
+# + ch - a single character string
+# + return - the code point of `ch`
+public isolated function toCodePointInt(Char ch) returns int = external;
+
+# Constructs a string from an array of code points.
+# An int is a valid code point if it is in the range 0 to 0x10FFFF inclusive,
+# but not in the range 0xD800 or 0xDFFF inclusive.
+#
+# + codePoints - an array of ints, each specifying a code point
+# + return - a string with a character for each code point in `codePoints`; or an error
+# if any member of `codePoints` is not a valid code point
+public isolated function fromCodePointInts(int[] codePoints) returns string|error = external;
+
+# Constructs a single character string from a code point.
+# An int is a valid code point if it is in the range 0 to 0x10FFFF inclusive,
+# but not in the range 0xD800 or 0xDFFF inclusive.
+#
+# + codePoint - an int specifying a code point
+# + return - a single character string whose code point is `codePoint`; or an error
+# if `codePoint` is not a valid code point
+public isolated function fromCodePointInt(int codePoint) returns Char|error = external;
+
+# Adds padding to the start of a string.
+# Adds sufficient `padChar` characters at the start of `str` to make its length be `len`.
+# If the length of `str` is >= `len`, returns `str`.
+# 
+# + str - the string to pad
+# + len - the length of the string to be returned
+# + padChar - the character to use for padding `str`; defaults to a space character
+# + return - `str` padded with `padChar` 
+public isolated function padStart(string str, int len, Char padChar = " ") returns string = external;
+
+# Adds padding to the end of a string.
+# Adds sufficient `padChar` characters to the end of `str` to make its length be `len`.
+# If the length of `str` is >= `len`, returns `str`.
+# 
+# + str - the string to pad
+# + len - the length of the string to be returned
+# + padChar - the character to use for padding `str`; defaults to a space character
+# + return - `str` padded with `padChar` 
+public isolated function padEnd(string str, int len, Char padChar = " ") returns string = external;
+
+# Pads a string with zeros.
+# The zeros are added at the start of the string, after a `+` or `-` sign if there is one.
+# Sufficient zero characters are added to `str` to make its length be `len`.
+# If the length of `str` is >= `len`, returns `str`.
+# 
+# + str - the string to pad
+# + len - the length of the string to be returned
+# + zeroChar - the character to use for the zero; defaults to ASCII zero `0`
+# + return - `str` padded with zeros 
+public isolated function padZero(string str, int len, Char zeroChar = "0") returns string = external;
+
+# Refers to the `RegExp` type defined by lang.regexp module.
+public type RegExp regexp:RegExp;
+
+# Tests whether there is a full match of a regular expression with a string.
+# A match of a regular expression in a string is a full match if it
+# starts at index 0 and ends at index `n`, where `n` is the length of the string.
+# This is equivalent to `regex:isFullMatch(re, str)`.
+#
+# + str - the string
+# + re - the regular expression
+# + return - true if there is full match of `re` with `str`, and false otherwise
+public isolated function matches(string str, RegExp re) returns boolean = external;
+
+# Tests whether there is a match of a regular expression somewhere within a string.
+# This is equivalent to `regexp:find(re, str, startIndex) != ()`.
+# 
+# + str - the string to be matched
+# + re - the regular expression
+# + return - true if the is a match of `re` somewhere within `str`, otherwise false
+public isolated function includesMatch(string str, RegExp re, int startIndex = 0) returns boolean = external;
+
+ +
+ +
+

11.3.14 lang.table module

+ +

The lang.table module corresponds to basic type table.

+ +
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type any|error;
+
+# A type parameter that is a subtype of `map<any|error>`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type MapType map<any|error>;
+
+# A type parameter that is a subtype of `map<any|error>`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type MapType1 map<any|error>;
+
+# A type parameter that is a subtype of `anydata`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type KeyType anydata;
+
+# Returns number of members of a table.
+#
+# + t - the table
+# + return - number of members in `t`
+public isolated function length(table<map<any|error>> t) returns int = external;
+
+# Returns an iterator over a table.
+# The iterator will iterate over the members of the table not the keys.
+# The `entries` function can be used to iterate over the keys and members together.
+# The `keys` function can be used to iterator over just the keys.
+# 
+# + t - the table
+# + return - a new iterator object that will iterate over the members of `t`
+public isolated function iterator(table<MapType> t) returns object {
+    public isolated function next() returns record {|
+        MapType value;
+    |}?;
+} = external;
+
+# Returns the member of table `t` with key `k`.
+# This for use in a case where it is known that the table has a specific key,
+# and accordingly panics if `t` does not have a member with key `k`.
+#
+# + t - the table
+# + k - the key
+# + return - member with key `k`
+public isolated function get(table<MapType> key<KeyType> t, KeyType k) returns MapType = external;
+
+# Adds a member `val` to table `t`, replacing any member with the same key value.
+# If `val` replaces an existing member, it will have the same position
+# in the order of the members as the existing member;
+# otherwise, it will be added as the last member.
+# It panics if `val` is inconsistent with the inherent type of `t`.
+public isolated function put(table<MapType> t, MapType val) = external;
+
+# Adds a member `val` to table `t`.
+# It will be added as the last member.
+# It panics if `val` has the same key as an existing member of `t`,
+# or if `val` is inconsistent with the inherent type of `t`.
+public isolated function add(table<MapType> t, MapType val) = external;
+
+
+# Applies a function each member of a table and returns a table of the result.
+#
+# + t - the table
+# + func - a function to apply to each member
+# + return - new table containing result of applying function `func` to each member
+public isolated function map(table<MapType> t, @isolatedParam function(MapType val) returns MapType1 func)
+   returns table<MapType1> key<never> = external;
+
+# Applies a function to each member of a table.
+# The function `func` is applied to each member of `t`.
+#
+# + t - the table
+# + func - a function to apply to each member
+public isolated function forEach(table<MapType> t, @isolatedParam function(MapType val) returns () func) returns () = external;
+
+# Selects the members from a table for which a function returns true.
+# The resulting table will have the same keys as the argument table.
+#
+# + t - the table
+# + func - a predicate to apply to each member to test whether it should be included
+# + return - new table containing members for which `func` evaluates to true
+public isolated function filter(table<MapType> key<KeyType> t, @isolatedParam function(MapType val) returns boolean func)
+   returns table<MapType> key<KeyType> = external;
+
+# Combines the members of a table using a combining function.
+# The combining function takes the combined value so far and a member of the table,
+# and returns a new combined value.
+#
+# + t - the table
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `t` using `func`
+public isolated function reduce(table<MapType> t, @isolatedParam function(Type accum, MapType val) returns Type func, Type initial) returns Type = external;
+
+# Removes a member of a table.
+#
+# + t - the table
+# + k - the key
+# + return - the member of `t` that had key `k`
+# This removed the member of `t` with key `k` and returns it.
+# It panics if there is no such member.
+public isolated function remove(table<MapType> key<KeyType> t, KeyType k) returns MapType = external;
+
+# Removes a member of a table with a given key, if the table has member with the key.
+#
+# + t - the table
+# + k - the key
+# + return - the member of `t` that had key `k`, or `()` if `t` does not have a key `k`
+# If `t` has a member with key `k`, it removes and returns it;
+# otherwise it returns `()`.
+public isolated function removeIfHasKey(table<MapType> key<KeyType> t, KeyType k) returns MapType? = external;
+
+# Removes all members of a table.
+# This panics if any member cannot be removed.
+#
+# + t - the table
+public isolated function removeAll(table<map<any|error>> t) returns () = external;
+
+# Tests whether `t` has a member with key `k`.
+#
+# + t - the table
+# + k - the key
+# + return - true if `t` has a member with key `k`
+public isolated function hasKey(table<MapType> key<KeyType> t, KeyType k) returns boolean = external;
+
+# Returns a list of all the keys of table `t`.
+#
+# + t - the table
+# + return - a new list of all keys
+public isolated function keys(table<map<any|error>> key<KeyType> t) returns KeyType[] = external;
+
+# Returns a list of all the members of a table.
+#
+# + t - the table
+# + return - an array whose members are the members of `t`
+public isolated function toArray(table<MapType> t) returns MapType[] = external;
+
+# Returns the next available integer key.
+# + t - the table with a key of type int
+# + return - an integer not yet used as a key
+# This is maximum used key value + 1, or 0 if no key used
+# XXX should it be 0, if the maximum used key value is < 0?
+# Provides similar functionality to auto-increment
+public isolated function nextKey(table<map<any|error>> key<int> t) returns int = external;
+
+ +
+ +
+

11.3.15 lang.typedesc module

+ +

The lang.typedesc module corresponds to basic type typedesc.

+ +
+
+# A record representing an identifier for a module.
+# This uniquely identifies a module within a program.
+public type ModuleId readonly & record {|
+    # the organization
+    string organization;
+    # the module name
+    string name;
+    # platform-specified parts of the identifier
+    string[] platformParts;
+|};
+
+# A record representing a type-id.
+# A type-id uniquely identifies an occurrence of a distinct type descriptor
+# within a program.
+public type TypeId readonly & record {|
+    # An identifier for the module.
+    ModuleId moduleId;
+    # An identifier within the module identified by `moduleId`.
+    # If it is a string, then it is the name of a type defined in the module.
+    # If it is an integer, then it is compiler-generated.
+    (string|int) localId;
+|};
+
+# Returns the type-ids induced by a typedesc value.
+# + t - the typedesc
+# + primaryOnly - if true, only the primary type-ids will be returned; otherwise,
+    all type-ids will be returned
+# + return - an array containing the type-ids induced by `t` or nil if `t` is not definite
+public isolated function typeIds(typedesc t, boolean primaryOnly = false) returns readonly & TypeId[]?
+    = external;
+
+ +
+ +
+

11.3.16 lang.xml module

+ +

The lang.xml module corresponds to basic type xml.

+ +
+
+# The namespace URI bound to the `xml` prefix.
+public const string XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
+# The namespace URI bound to the `xmlns` prefix.
+public const string XMLNS_NAMESPACE_URI = "http://www.w3.org/2000/xmlns/";
+
+# The expanded name of the `xml:space` attribute.
+public const string space = "{http://www.w3.org/XML/1998/namespace}space";
+# The expanded name of the `xml:lang` attribute.
+public const string lang = "{http://www.w3.org/XML/1998/namespace}lang";
+# The expanded name of the `xml:base` attribute.
+public const string base = "{http://www.w3.org/XML/1998/namespace}base";
+
+# Type for singleton elements.
+# Built-in subtype of xml.
+@builtinSubtype
+public type Element xml;
+
+# Type for singleton processing instructions.
+# Built-in subtype of xml.
+@builtinSubtype
+public type ProcessingInstruction xml;
+
+# Type for singleton comments.
+# Built-in subtype of xml.
+@builtinSubtype
+public type Comment xml;
+
+# Type for zero or more text characters.
+# Built-in subtype of xml.
+# Adjacent xml text items are automatically concatenated,
+# so an xml sequence belongs to this type if it is a singleton test sequence
+# or the empty sequence.
+@builtinSubtype
+public type Text xml;
+
+# Returns number of xml items in `x`.
+#
+# + x - xml item
+# + return - number of XML items in `x`
+public isolated function length(xml x) returns int = external;
+
+# A type parameter that is a subtype of any singleton or empty xml sequence.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type ItemType Element|Comment|ProcessingInstruction|Text;
+# A type parameter that is a subtype of `xml`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type XmlType xml;
+
+# Returns an iterator over the xml items of `x`
+#
+# + x - xml sequence to iterate over
+# + return - iterator object
+# Each item is represented by an xml singleton.
+public isolated function iterator(xml<ItemType> x) returns object {
+    public isolated function next() returns record {| ItemType value; |}?;
+} = external;
+
+# Returns the item of `x` with index `i`.
+# This differs from `x[i]` in that it panics if
+# `x` does not have an item with index `i`.
+#
+# + x - the xml sequence 
+# + i - the index
+# + return - the item with index `i` in `x`
+public isolated function get(xml<ItemType> x, int i) returns ItemType = external;
+
+# Concatenates xml and string values.
+#
+# + xs - xml or string items to concatenate
+# + return - an xml sequence that is the concatenation of all the `xs`;
+#    an empty xml sequence if the `xs` are empty
+public isolated function concat((xml|string)... xs) returns xml = external;
+
+# Returns a string giving the expanded name of `elem`.
+#
+# + elem - xml element
+# + return - element name
+public isolated function getName(Element elem) returns string = external;
+
+# Change the name of element `elem` to `xName`.
+#
+# + elem - xml element
+# + xName - new expanded name
+public isolated function setName(Element elem, string xName) = external;
+
+# Returns the map representing the attributes of `elem`.
+# This includes namespace attributes.
+# The keys in the map are the expanded names of the attributes.
+#
+# + x - xml element
+# + return - attributes of `x`
+public isolated function getAttributes(Element x) returns map<string> = external;
+
+# Returns the children of `elem`.
+#
+# + elem - xml element
+# + return - children of `elem`
+public isolated function getChildren(Element elem) returns xml = external;
+
+# Sets the children of `elem` to `children`.
+# This panics if it would result in the element structure
+# becoming cyclic.
+#
+# + elem - xml element
+# + children - xml or string to set as children
+public isolated function setChildren(Element elem, xml|string children) = external;
+
+# Returns the descendants of `elem`.
+#
+# + elem - xml element
+# + return - descendants of `elem`
+# The descendants of an element are the children of the element
+# together with, for each of those children that is an element,
+# the descendants of that element, ordered so that
+# each element immediately precedes all its descendants.
+# The order of the items in the returned sequence will thus correspond
+# to the order in which the first character of the representation
+# of the item would occur in the representation of the element in XML syntax.
+public isolated function getDescendants(Element elem) returns xml = external;
+
+# Returns a string with the character data of an xml value.
+# + x - the xml value
+# + return - a string consisting of all the character data of `x`
+# The character data of an xml value is as follows:
+# * the character data of a text item is a string with one character for each
+#     character information item represented by the text item;
+# * the character data of an element item is the character data of its children;
+# * the character data of a comment item is the empty string;
+# * the character data of a processing instruction item is the empty string;
+# * the character data of an empty xml sequence is the empty string;
+# * the character data of the concatenation of two xml sequences x1 and x2 is the
+#    concatenation of the character data of x1 and the character data of x2.
+public isolated function data(xml x) returns string = external;
+
+# Returns the target part of the processing instruction.
+#
+# + x - xml processing instruction item
+# + return - target part of `x`
+public isolated function getTarget(ProcessingInstruction x) returns string = external;
+
+# Returns the content of a processing instruction or comment item.
+#
+# + x - xml item
+# + return - the content of `x`
+public isolated function getContent(ProcessingInstruction|Comment x) returns string = external;
+
+# Creates a new xml element item.
+#
+# + name - the name of the new element
+# + attributes - the attributes of the new element
+# + children - the children of the new element
+# + return - an xml sequence consisting of only a new xml element with name `name`,
+#   attributes `attributes`, and children `children`
+# The element's attribute map is a newly created map, into which any attributes specified
+# by the `attributes` map are copied.
+public isolated function createElement(string name, map<string> attributes = {}, xml children = xml``)
+    returns Element = external;
+
+# Creates a new xml processing instruction item.
+#
+# + target - the target part of the processing instruction to be constructed
+# + content - the content part of the processing instruction to be constructed
+# + return - an xml sequence consisting of a processing instruction with target `target`
+#     and content `content`
+public isolated function createProcessingInstruction(string target, string content)
+    returns ProcessingInstruction = external;
+
+# Creates a new xml comment item.
+#
+# + content - the content of the comment to be constructed.
+# + return - an xml sequence consisting of a comment with content `content`
+public isolated function createComment(string content) returns Comment = external;
+
+# Constructs an xml value of type Text.
+# + data - the character data of the Text item
+# + return - an xml sequence that is either empty or consists of one text item
+# The returned xml value will be empty when the length of `data` is zero.
+public isolated function createText(string data) returns Text = external;
+
+# Returns a subsequence of an xml value.
+#
+# + x - the xml value
+# + startIndex - start index, inclusive
+# + endIndex - end index, exclusive
+# + return - a subsequence of `x` consisting of items with index >= startIndex and < endIndex
+public isolated function slice(xml<ItemType> x, int startIndex, int endIndex = x.length())
+    returns xml<ItemType> = external;
+
+# Strips the insignificant parts of the an xml value.
+# This first transforms the xml value by leaving out any constituent
+# item that is a comment or processing instruction. It then
+# transforms this value by leaving out any constituent item that
+# is a text item that consists entirely of whitespace, where whitespace
+# is as defined by the S production of XML 1.0.
+#
+# + x - the xml value
+# + return - `x` transformed by leaving out insignificant items
+public isolated function strip(xml x) returns xml = external;
+
+# Selects elements from an xml value.
+# If `nm` is `()`, selects all elements;
+# otherwise, selects only elements whose expanded name is `nm`.
+# 
+# + x - the xml value
+# + nm - the expanded name of the elements to be selected, or `()` for all elements
+# + return - an xml sequence consisting of all the element items in `x` whose expanded name is `nm`,
+#  or, if `nm` is `()`, all element items in `x`
+public isolated function elements(xml x, string? nm = ()) returns xml<Element> = external;
+
+# Returns the children of elements in an xml value.
+# When `x` is of type Element, it is equivalent to `getChildren`.
+# + x - xml value
+# + return - xml sequence containing the children of each element x concatenated in order
+# This is equivalent to `elements(x).map(getChildren)`.
+public isolated function children(xml x) returns xml = external;
+
+# Selects element children of an xml value
+# + x - the xml value
+# + nm - the expanded name of the elements to be selected, or `()` for all elements
+# + return - an xml sequence consisting of child elements of elements in `x`; if `nm`
+#  is `()`, returns a sequence of all such elements;
+#  otherwise, include only elements whose expanded name is `nm`
+# This is equivalent to `children(x).elements(nm)`.
+public isolated function elementChildren(xml x, string? nm = ()) returns xml<Element> = external;
+
+# Selects text items from an xml value.
+# + x - the xml value
+# return - an xml sequence consisting of the concatentation of the text items in `x`
+public isolated function text(xml x) returns Text = external;
+
+
+# Applies a function to each item in an xml sequence, and returns an xml sequence of the results.
+# Each item is represented as a singleton value.
+#
+# + x - the xml value
+# + func - a function to apply to each child or `item`
+# + return - new xml value containing result of applying function `func` to each child or `item`
+public isolated function map(xml<ItemType> x, @isolatedParam function(ItemType item) returns XmlType func)
+    returns xml<XmlType> = external;
+
+# Applies a function to each item in an xml sequence.
+# Each item is represented as a singleton value.
+#
+# + x - the xml value
+# + func - a function to apply to each item in `x`
+public isolated function forEach(xml<ItemType> x, @isolatedParam function(ItemType item) returns () func)
+    = external;
+
+# Selects the items from an xml sequence for which a function returns true.
+# Each item is represented as a singleton value.
+#
+# + x - xml value
+# + func - a predicate to apply to each item to test whether it should be selected
+# + return - new xml sequence containing items in `x` for which `func` evaluates to true
+public isolated function filter(xml<ItemType> x, @isolatedParam function(ItemType item) returns boolean func)
+    returns xml = external;
+
+# Constructs an xml value from a string.
+# This parses the string using the `content` production of the
+# XML 1.0 Recommendation.
+#
+# + s - a string in XML format
+# + return - xml value resulting from parsing `s`, or an error
+public isolated function fromString(string s) returns xml|error = external;
+
+ +
+ +
+

11.3.17 lang.transaction module

+ +

The lang.transaction module supports transactions.

+ +
+
+
+# Type of error returned by commit action.
+type Error distinct error;
+
+# Information about a transaction that does not change
+# after the transaction is started.
+type Info readonly & record {|
+   # Unique identifier for the transaction branch
+   byte[] xid;
+   # The number of previous attempts in a sequence of retries
+   int retryNumber;
+   # Information about the previous attempt in a sequence of retries.
+   # This will be `()` if the `retryNumber` is 0.
+   Info? prevAttempt;
+   # The time at which the transaction was started.
+   Timestamp startTime;
+|};
+
+# An instant in time.
+public type Timestamp readonly & object {
+    # Returns milliseconds since 1970-01-01T00:00:00Z, not including leap seconds
+    public function toMillisecondsInt() returns int;
+    # Returns a string representation of the timestamp in ISO 8601 format
+    public function toString() returns string;
+};
+
+# Returns information about the current transaction
+public transactional isolated function info() returns Info = external;
+
+# Returns information about the transaction with
+# the specified xid.
+public isolated function getInfo(byte[] xid) returns Info? = external;
+
+# Prevents the global transaction from committing successfully.
+# This ask the transaction manager that when it makes the decision
+# whether to commit or rollback, it should decide to rollback.
+#
+# + error - the error that caused the rollback or `()`, if there is none
+public transactional isolated function setRollbackOnly(error? e) = external;
+
+# Tells whether it is known that the transaction will be rolled back.
+# + return - true if it is known that the transaction manager will,
+# when it makes the decision whether to commit or rollback, decide
+# to rollback
+public transactional isolated function getRollbackOnly() returns boolean = external;
+
+# Associates some data with the current transaction branch.
+public transactional isolated function setData(readonly data) = external;
+
+# Retrieves data associated with the current transaction branch.
+# The data is set using `setData`.
+# + return - the data, or `()` if no data has been set.
+public transactional isolated function getData() returns readonly = external;
+
+# Type of a commit handler function.
+# + info - information about the transaction being committed
+public type CommitHandler isolated function(Info info);
+
+# Type of a rollback handler function.
+# + info - information about the transaction being committed
+# + cause - an error describing the cause of the rollback, if there is
+# + willRetry - true if the transaction will be retried, false otherwise
+public type RollbackHandler isolated function(Info info, error? cause, boolean willRetry);
+
+# Adds a handler to be called if and when the global transaction commits.
+#
+# + handler - the function to be called on commit
+public transactional isolated function onCommit(CommitHandler handler) = external;
+
+# Adds a handler to be called if and when the global transaction rolls back.
+#
+# + handler - the function to be called on rollback
+public transactional isolated function onRollback(RollbackHandler handler) = external;
+
+ +
+ +
+

11.3.18 lang.runtime module

+ +

The lang.runtime module provides functions related to the +language runtime that are not specific to a particular basic type.

+ +
+
+# Sleep for `seconds`.
+# + seconds - a decimal giving the length of time to sleep in seconds
+# The function will do nothing for the specified period of time before returning.
+# This will cause the current strand to yield.
+public isolated function sleep(decimal seconds) = external; 
+
+# A listener that is dynamically registered with a module.
+public type DynamicListener object {
+   public function start() returns error?;
+   public function gracefulStop() returns error?;
+   public function immediateStop() returns error?;
+};
+
+# Register a listener object with a module.
+# + listener - the listener object to be registered
+# The listener becomes a module listener of the module from which this
+# function is called.
+public isolated function registerListener(DynamicListener listener) = external;
+
+# Deregister a listener from a module.
+# + listener - the listener object to be unregistered
+# The `listener` ceases to be a module listener of the module from
+# which this function is called.
+public isolated function deregisterListener(DynamicListener listener) = external;
+
+
+# Type representing a stack frame.
+# A call stack is represented as an array of stack frames.
+# This type is also present in lang.error to avoid a dependency.
+public type StackFrame readonly & object {
+   # Returns a string representing this StackFrame.
+   # This must not contain any newline characters.
+   # + return - a string
+   public function toString() returns string;
+};
+
+# Return a stack trace for the current call stack.
+# + return - an array representing the current call stack
+# The first member of the array represents the top of the call stack.
+public isolated function getStackTrace() returns StackFrame[] = external;
+
+# Type of the function passed to `onGracefulStop`.
+public type StopHandler function() returns error?;
+
+# Registers a function that will be called during graceful shutdown.
+# A call to `onGracefulStop` will result in one call to the handler function
+# that was passed as an argument; the handler functions will be called
+# after calling `gracefulStop` on all registered listeners,
+# in reverse order of the corresponding calls to `onGracefulStop`.
+# + handler - function to be called
+public isolated function onGracefulStop(StopHandler handler) = external;
+
+ +
+ +
+

11.3.19 lang.value module

+ +

The lang.value module provides functions that work on values of +more than one basic type..

+ +
+
+# A type parameter that is a subtype of `any|error`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type Type any|error;
+
+# The type of value to which `clone` and `cloneReadOnly` can be applied.
+public type Cloneable readonly|xml|Cloneable[]|map<Cloneable>|table<map<Cloneable>>;
+
+# A type parameter that is a subtype of `Cloneable`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type CloneableType Cloneable;
+
+# Returns a clone of `v`.
+# A clone is a deep copy that does not copy immutable subtrees.
+# A clone can therefore safely be used concurrently with the original.
+# It corresponds to the Clone(v) abstract operation,
+# defined in the Ballerina Language Specification.
+#
+# + v - source value
+# + return - clone of `v`
+public isolated function clone(CloneableType v) returns CloneableType = external;
+
+# Returns a clone of `v` that is read-only, i.e. immutable.
+# It corresponds to the ImmutableClone(v) abstract operation,
+# defined in the Ballerina Language Specification.
+#
+# + v - source value
+# + return - immutable clone of `v`
+public isolated function cloneReadOnly(CloneableType v) returns CloneableType & readonly = external;
+
+# Constructs a value with a specified type by cloning another value.
+# + v - the value to be cloned
+# + t - the type for the cloned to be constructed
+# + return - a new value that belongs to type `t`, or an error if this cannot be done
+# 
+# When `v` is a structural value, the inherent type of the value to be constructed
+# comes from `t`. When `t` is a union that includes more than one type descriptor
+# that can be used as the inherent type of values with `v`'s basic type, then
+# the inherent type used will be the first (leftmost) such type descriptor such that a value
+# belonging to that type can be constructed from `v`.
+# The `cloneWithType` operation is recursively applied to each member of `v` using
+# the type descriptor that the inherent type requires for that member.
+# 
+# Like the Clone abstract operation, this does a deep copy, but differs in
+# the following respects:
+# - the inherent type of any structural values constructed comes from the specified
+#   type descriptor rather than the value being constructed
+# - the read-only bit of values and fields comes from the specified type descriptor
+# - the graph structure of `v` is not preserved; the result will always be a tree;
+#   an error will be returned if `v` has cycles
+# - immutable structural values are copied rather than being returned as is
+# - numeric values can be converted using the NumericConvert abstract operation
+# - if a record type descriptor specifies default values, these will be used
+#   to supply any missing members
+public isolated function cloneWithType(anydata v, typedesc<anydata> t = <>) returns t|error = external;
+
+# Safely casts a value to a type.
+# This casts a value to a type in the same way as a type cast expression,
+# but returns an error if the cast cannot be done, rather than panicking.
+# + v - the value to be cast
+# + t - a typedesc for the type to which to cast it
+# return - `v` cast to the type described by `t`, or an error, if the cast cannot be done
+public isolated function ensureType(any|error v, typedesc<any> t = <>) returns t|error = external;
+
+# Performs a direct conversion of a value to a string.
+# The conversion is direct in the sense that when applied to a value that is already
+# a string it leaves the value unchanged.
+#
+# + v - the value to be converted to a string
+# + return - a string resulting from the conversion
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the direct style.
+public isolated function toString(any v) returns string = external;
+
+# Converts a value to a string that describes the value in Ballerina syntax.
+# + v - the value to be converted to a string
+# + return - a string resulting from the conversion
+#
+# If `v` is anydata and does not have cycles, then the result will
+# conform to the grammar for a Ballerina expression and when evaluated
+# will result in a value that is == to v.
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the expression style.
+public isolated function toBalString(any v) returns string = external;
+
+# Parses and evaluates a subset of Ballerina expression syntax.
+# + s - the string to be parsed and evaluated
+# return - the result of evaluating the parsed expression, or
+# an error if the string cannot be parsed
+# The subset of Ballerina expression syntax supported is that produced
+# by toBalString when applied to an anydata value.
+public isolated function fromBalString(string s) returns anydata|error = external;
+
+
+# Converts a value of type `anydata` to `json`.
+# This does a deep copy of `v` converting values that do
+# not belong to json into values that do.
+# A value of type `xml` is converted into a string as if
+# by the `toString` function.
+# A value of type `table` is converted into a list of
+# mappings one for each row.
+# The inherent type of arrays in the return value will be
+# `json[]` and of mappings will be `map<json>`.
+# A new copy is made of all structural values, including
+# immutable values.
+#
+# + v - anydata value
+# + return - representation of `v` as value of type json
+# This panics if `v` has cycles.
+public isolated function toJson(anydata v) returns json = external;
+
+# Returns the string that represents `v` in JSON format.
+# `v` is first converted to `json` as if by the `toJson` function.
+#
+# + v - anydata value
+# + return - string representation of `v` converted to `json`
+public isolated function toJsonString(anydata v) returns string = external;
+
+# Parses a string in JSON format and returns the value that it represents.
+# Numbers in the JSON string are converted into Ballerina values of type
+# decimal except in the following two cases:
+# if the JSON number starts with `-` and is numerically equal to zero, then it is
+# converted into float value of `-0.0`;
+# otherwise, if the JSON number is syntactically an integer and is in the range representable
+# by a Ballerina int, then it is converted into a Ballerina int.
+# A JSON number is considered syntactically an integer if it contains neither
+# a decimal point nor an exponent.
+# 
+# Returns an error if the string cannot be parsed.
+#
+# + str - string in JSON format
+# + return - `str` parsed to json or error
+public isolated function fromJsonString(string str) returns json|error = external;
+
+# Subtype of `json` that allows only float numbers.
+public type JsonFloat ()|boolean|string|float|JsonFloat[]|map<JsonFloat>;
+
+# Parses a string in JSON format, using float to represent numbers.
+# Returns an error if the string cannot be parsed.
+#
+# + str - string in JSON format
+# + return - `str` parsed to json or error
+public isolated function fromJsonFloatString(string str) returns JsonFloat|error = external;
+
+# Subtype of `json` that allows only decimal numbers.
+public type JsonDecimal ()|boolean|string|decimal|JsonDecimal[]|map<JsonDecimal>;
+
+# Parses a string in JSON format, using decimal to represent numbers.
+# Returns an error if the string cannot be parsed.
+#
+# + str - string in JSON format
+# + return - `str` parsed to json or error
+public isolated function fromJsonDecimalString(string str) returns JsonDecimal|error = external;
+
+# Converts a value of type json to a user-specified type.
+# This works the same as `cloneWithType`,
+# except that it also does the inverse of the conversions done by `toJson`.
+#
+# + v - json value
+# + t - type to convert to
+# + return - value belonging to type `t` or error if this cannot be done
+public isolated function fromJsonWithType(json v, typedesc<anydata> t = <>)
+    returns t|error = external;
+
+# Converts a string in JSON format to a user-specified type.
+# This is a combination of `fromJsonString` followed by
+# `fromJsonWithType`.
+# + str - string in JSON format
+# + t - type to convert to
+# + return - value belonging to type `t` or error if this cannot be done
+public isolated function fromJsonStringWithType(string str, typedesc<anydata> t = <>)
+    returns t|error = external;
+    
+# Merges two json values.
+#
+# + j1 - json value
+# + j2 - json value
+# + return - the merge of `j1` with `j2` or an error if the merge fails
+#
+# The merge of `j1` with `j2` is defined as follows:
+# - if `j1` is `()`, then the result is `j2`
+# - if `j2` is `()`, then the result is `j1`
+# - if `j1` is a mapping and `j2` is a mapping, then for each entry [k, j] in j2,
+#   set `j1[k]` to the merge of `j1[k]` with `j`
+#     - if `j1[k]` is undefined, then set `j1[k]` to `j`
+#     - if any merge fails, then the merge of `j1` with `j2` fails
+#     - otherwise, the result is `j1`.
+# - otherwise, the merge fails
+# If the merge fails, then `j1` is unchanged.
+public isolated function mergeJson(json j1, json j2) returns json|error = external;
+
+# Returns the number of arguments.
+# This is useful with aggregated variables created by `collect` and `group by` clauses.
+#
+# + vs - the arguments
+# + return - the number of arguments
+public isolated function count(any|error... vs) returns int = external;
+
+# Returns the first of its arguments.
+# This is useful with aggregated variables created by `collect` and `group by` clauses.
+#
+# + v - first argument
+# + vs - other arguments
+# + return - the first argument v
+public isolated function first(Type v, any|error... vs) returns Type = external;
+
+# Returns the last of its arguments.
+# This is useful with aggregated variables created by `collect` and `group by` clauses.
+#
+# + v - first argument
+# + vs - other arguments
+# + return - the last argument
+public isolated function last(Type v, Type... vs) returns Type = external;
+
+ +
+ +
+ +
+
+

A. References

+
    +
  • Unicode
  • +
  • XML
  • +
  • JSON
  • +
  • ECMAScript 2022 (ECMA-262 13th Edition)
  • +
  • RFC 3629 UTF-8
  • +
  • IEEE 754-2008
  • +
  • GitHub Markdown
  • +
+
+
+

B. Changes since previous releases

+
+

B.1 Summary of changes from 2023R1 to 2024R1

+
    +
  1. Isolated inference can infer isolated for an object constructor expression.
  2. +
  3. A query-select-expr can construct a stream without explicitly specifying +the stream keyword.
  4. +
  5. It is no longer allowed for a lock statement to contain a sync-send-action or a receive-action.
  6. +
  7. A retry or transaction statement may now have an on fail +clause.
  8. +
  9. A named worker declaration may now have an on fail clause.
  10. +
  11. The compile-time requirement that a send-action must always be executed +unless its containing worker terminates with an error or panic has been +removed.
  12. +
  13. An alternate-receive-action has been added.
  14. +
+
+
+

B.2 Summary of changes from 2022R4 to 2023R1

+
    +
  1. Query expressions now support grouping and aggregation, using new +group by and collect clauses.
  2. +
  3. Keywords that start clauses of a query expression, except for +from and let, are no longer reserved (and so can be +used as identifier names).
  4. +
  5. Functions useful for aggregation have been added to langlib: +int:avg, float:avg, decimal:avg, +boolean:some, boolean:every, value:count, +value:first, value:last.
  6. +
  7. A join clause in a query expression can contain remote method +calls and other actions.
  8. +
  9. Clarify that the self variable in a method is implicitly +final.
  10. +
  11. Regexp type has a filler value.
  12. +
  13. Readonly record types can have defaults.
  14. +
+
+ +
+

B.3 Summary of changes from 2022R3 to 2022R4

+
    +
  1. Regular expressions have been added as a new data type. This +feature has preview status in this release.
  2. +
  3. When an optional field cannot have the value nil, the field +can be manipulated conveniently by treating nil as representing the +absence of the field: this works for constructors, binding patterns +and assignment.
  4. +
  5. A byte-array-literal can construct a read-only value.
  6. +
  7. An optional semi-colon is now allowed after top-level definitions and +method definitions that are currentlty terminated by }.
  8. +
  9. An int:range langlib function allows convenient iteration +over integer sequences with steps other than 1.
  10. +
+
+
+

B.4 Summary of changes from 2022R2 to 2022R3

+
    +
  1. Client objects can declare resource methods, which can be accessed using new +client-resource-access-action syntax. Resource methods are now part +of the type of network interaction objects and can be specified in object type +descriptors.
  2. +
  3. The isolated feature can now be used to identify cases where +a strand created by start or a named worker can be run safely on +a separate thread.
  4. +
  5. The variable declaration in an on fail clause is now +optional.
  6. +
  7. Query expressions producing xml values will now work properly when used as +interpolated expressions in XML templates.
  8. +
  9. Query expressions may be used to construct maps.
  10. +
  11. Query expressions can now construct readonly values.
  12. +
  13. Annotations are now allowed on members of tuple type descriptors.
  14. +
  15. The call function has been added to lang.function +to allow for dynamically calling a function.
  16. +
  17. An onGracefulStop function has been added to +lang.runtime.
  18. +
  19. The grammar now allows an action such as a remote method call to occur +inside a query.
  20. +
  21. A check expression is now allowed as a statement, provided that +its type is nil.
  22. +
+
+ +
+

B.5 Summary of changes from 2022R1 to 2022R2

+
    +
  1. The *, / and % operators now allow +operands to mix numeric types in specific cases: * allows the case +where either operand is an int; / and * +allow the case where the right operand is an int.
  2. +
  3. It is no longer an error for a panic-stmt to be +unreachable.
  4. +
  5. The toExpString and toFixedString +functions have been added to lang.float.
  6. +
  7. The padStart, padEnd, padZero +functions have been added to lang.string.
  8. +
  9. The quantize function has been added to +lang.decimal.
  10. +
  11. The some and every functions have been added to +lang.array.
  12. +
  13. The round function in lang.float and +lang.decimal now takes an optional argument controlling the number +of digits after the decimal point.
  14. +
  15. The length of an array type is allowed to be * only when it is +the outermost array and there is an initializer from which it can be +inferred.
  16. +
  17. A list constructor can use ...E as in an argument list.
  18. +
+
+
+

B.6 Summary of changes from 2021R1 to 2022R1

+
    +
  1. Maps are required to preserve insertion order.
  2. +
  3. The static typing rules for == and != have been +relaxed to require only one operand to be anydata.
  4. +
  5. The identifiers of organizations and modules refererenced in import +declarations are restricted to ASCII alpha-numberic characters with underscores +separating words.
  6. +
  7. Floating pointer literals are not allowed to end with a trailing dot.
  8. +
  9. No white space is allowed within a qualified name.
  10. +
  11. Add the !is operator.
  12. +
  13. Allow null as a type descriptor.
  14. +
  15. An object type is not allowed to include a class with private members.
  16. +
  17. Conditional variable type narrowing from the condition of a while statement +is applied to the body of a while statement.
  18. +
  19. Conditional variable type narrowing is now done for a where clause in a +query expression or action.
  20. +
  21. A function call is only allowed with an expression in a match-guard when +there is no possibility that it can mutate the value being matched.
  22. +
  23. The interpretation of multiple dimensions in an array-type-descriptor has +been changed to make the order of dimensions in the type-descriptor consistent +with the order of dimensions in an expression that accesses the array.
  24. +
  25. The static type of an expression now has singleton type when all its +subexpressions have singleton type.
  26. +
  27. Unreachable statements are now an error.
  28. +
  29. Conditional variable type narrowing is now smarter. In particular, the types +of variables can be narrowed in statements following an if +statement that contains return.
  30. +
  31. Variable type narrowing in a match statement has been improved to work +better for types that are partially readonly.
  32. +
  33. Many expressions now perform nil lifting.
  34. +
  35. The rules for determining the basic type of a numeric literal have been +revised to work better in the case where the contextually expected type allows +two of the three possible numeric basic types.
  36. +
  37. Restrictions have been introduced on assigning within a loop to a variable +whose type has been narrowed outside the loop.
  38. +
  39. Optional fields can be accessed using the . operator as well as +the ?. operator, when the type of the accessed field does not allow +nil.
  40. +
+
+
+

B.7 Summary of changes from 2020R1 to 2021R1

+
    +
  1. There has been a major change to how objects works. All object type +descriptors are what was previously called abstract: they declare +methods but do not define them. Objects are now created either by using an +object constructor expression, which includes method definitions, or by applying +new to the name of a class defined by a class definition. The +methods and fields of an object are in a single symbol space. Classes and +object constructors can declare fields as final.
  2. +
  3. Services have become service objects that work in a similar way to client +objects; resource methods on service objects have become remote methods. Remote +methods are in a separate symbol space from regular methods. There is a new +concept for resource methods.
  4. +
  5. The readonly type has been added. Fields of records can also be +declared as readonly.
  6. +
  7. Functions, objects and module-level variables can be declared as +isolated; this works in conjunction with readonly to +support concurrency safety.
  8. +
  9. Module-level variables can be public, provided they are not isolated.
  10. +
  11. Intersection types have been added.
  12. +
  13. Distinct types have been added; these provide the functionality of nominal +types with the framework of a structural type system.
  14. +
  15. The error type has been revised to take advantage of distinct types. Instead +an error value having a reason string for categorizing the error and separate +message string in the detail record, an error value has a message string in the +error and distinct types are used for categorizing. The cause has also moved +from the detail record into the error value.
  16. +
  17. The syntax for an error constructor that uses a user-defined type name now +includes the error keyword before the type name.
  18. +
  19. Language-defined abstract object types now make use of distinct types, +instead of using names prefixed with double underscore.
  20. +
  21. The __init method of object and the __init function +of modules have been renamed to init.
  22. +
  23. Module variables can be initialized in the module's init +function.
  24. +
  25. The table type has been redesigned to be more consistent with other +structural types and no longer has preview status.
  26. +
  27. Enum declarations have been added.
  28. +
  29. The return type of a function with an external body can depend on the value +of a parameter of typedesc type, which can be defaulted from the contextually +expected type.
  30. +
  31. Query expressions support some new clauses: join clause, +order by clause, limit clause and on +conflict clause.
  32. +
  33. The relational operators (< <= > >=) have been +extended to apply to more than just numeric types.
  34. +
  35. Raw template expressions have been added.
  36. +
  37. The ability to specify the visibility of parameter names has been removed: a +parameter can always be specified by name as well as position; a parameter +cannot be declared as public.
  38. +
  39. Local type definitions have been removed.
  40. +
  41. The fail statement has been added, along with a on +fail clause for compound statements. If a check expression +or action fails, it behaves like a fail statement rather than a +return statement.
  42. +
  43. The language has a concept of configurability: module level variables can be +specified to be configurable, which allows their initial values to +be specified at runtime.
  44. +
  45. An import declaration can no longer specify a version.
  46. +
  47. The stream type no longer has Preview status.
  48. +
  49. Module prefixes for the langlib modules that correspond to keywords are +predeclared.
  50. +
  51. Backslash escapes can be used in identifiers without needing an initial +single quote.
  52. +
  53. Language support for transactions has been added.
  54. +
  55. The error<*> feature has been removed, because it does +not work well with distinct error types.
  56. +
  57. In message passing between workers, the function's default worker is now +referenced using the function keyword rather than the +default keyword.
  58. +
  59. Make trap expression have lower precedence.
  60. +
+
+
+

B.8 Summary of changes from 2019R3 to 2020R1

+
    +
  1. Query expressions and query actions have been added. This is the first stage +of language-integrated query.
  2. +
  3. The stream basic type has been added.
  4. +
  5. Let expressions have been added.
  6. +
  7. The XML design has been refined and no longer has Preview status. +
      +
    • The various kinds of xml item (e.g. element and text) are subtypes of the +xml type.
    • +
    • The xml type can have a type parameter specifying the item +types.
    • +
    • Iteration over xml values exposes characters as text items rather than strings
    • +
    • Adjacent characters in XML content are chunked into a single text item.
    • +
    • The meaning of === for xml has changed.
    • +
    • The item of an xml sequence value x with index i can be accessed using an +expression x[i].
    • +
    • The syntax x@ for accessing the attributes of an XML element has +been removed.
    • +
    +
  8. +
  9. The lock statement has been added.
  10. +
  11. When a list constructor or mapping constructor is used without a +contextually expected type, we now infer a tuple or record type rather than an +array or map type.
  12. +
  13. The syntax for Unicode escapes in strings has changed from +\u[CodePoint] to \u{CodePoint} so as +to align with ECMAScript. Although this is an incompatible change, the previous +syntax was not implemented.
  14. +
  15. The never type has been added.
  16. +
  17. Lang library modules can now provide built-in subtypes of existing basic +types.
  18. +
  19. There is a lang.boolean lang lib module.
  20. +
+
+
+

B.9 Summary of changes from 2019R2 to 2019R3

+
    +
  1. An import declaration can use as _ to include a module in the +program without using its symbols.
  2. +
  3. The specification of experimental features has been moved to a separate +document.
  4. +
  5. A wait-action can result in an error value when applied to a future that is +not a named worker.
  6. +
+
+ +
+

B.10 Summary of changes from 2019R1 to 2019R2

+
    +
  1. The concept of a built-in method has been replaced by the concept of a lang +library. A method call on a value of non-object type is now treated as a +convenient syntax for a call to a function in a module of the lang library. The +design of the many of the existing built-in methods has been changed to fit in +with this. There are many functions in the lang library that were not previously +available as built-in methods.
  2. +
  3. A mapping value is now iterable as a sequence of its members (like list), +rather than as a sequence of key-value pairs. The entries lang library +function allows it to be iterated as a sequence of key-value pairs.
  4. +
  5. The basic type handle has been added.
  6. +
  7. The table<T> type descriptor shorthand has been brought +back.
  8. +
  9. There is now a variation on check called +checkpanic, which panics rather than returns on error.
  10. +
  11. A range-expr now returns an object belonging to the Iterable abstract object +type, rather than a list.
  12. +
  13. The decimal type now uses a simplified subset of IEEE 754-2008 decimal +floating point.
  14. +
  15. The status of XML-related features has been changed to preview.
  16. +
  17. The ability to define a method outside the object type has been +removed.
  18. +
  19. The UnfrozenClone operation has been removed.
  20. +
  21. The Freeze operation has been replaced by the ImmutableClone operation.
  22. +
  23. The semantics of field access, member access and assignment are now +fully specified.
  24. +
  25. A ?. operator has been added for access to optional fields.
  26. +
  27. A type-cast-expr can include annotations.
  28. +
  29. The error detail record must belong to type Detail defined in the lang +library.
  30. +
  31. The compile-time requirement that the inherent type of a variable-length +list must allow members to be filled-in has been removed; this is instead caught +at run-time.
  32. +
  33. Parameter names now have public or module-level visibility, which determines +when a function call can use the parameter name to specify an argument.
  34. +
  35. A type descriptor record { } is open to anydata +rather than anydata|error.
  36. +
  37. Calls using start are treated as actions, and so are not +allowed within expressions.
  38. +
  39. There is a new syntax for allowing arbitrary strings as identifiers to +replace the old delimited identifier syntax ^"s".
  40. +
+ +
+
+

B.11 Summary of changes from 0.990 to 2019R1

+

+The specification has switched to a new versioning scheme. The n-th +version of the specification released in year 20xy will be labelled +20xyRn. +

+
    +
  1. Tuples types now use square brackets, rather than parentheses, as do tuple +binding patterns and tuple match patterns. Array constructors and tuple +constructors are now unified into list constructors, which use square brackets. +Tuple types can have zero members or one member, and can use T... +syntax allow trailing members of a specified type.
  2. +
  3. The way that record type descriptors express openness has changed. Instead +of the !... syntax, there are two flavours of record type +descriptor, which use different delimiters: record {| |} allows any +mapping that has exclusively the specified fields, whereas record { +} allows any mapping that includes the specified fields; the former can +use the T... syntax, whereas the latter cannot. The +!... is no longer allowed for record binding patterns and record +match patterns.
  4. +
  5. The syntax for an array with an array length that is inferred has changed +from T[!...] to T[*].
  6. +
  7. A type descriptor of error<*> can be used to specify an +error type whose subtype is inferred.
  8. +
  9. A new expression can no longer be used to create values of structural types; +it is only allowed for objects.
  10. +
  11. Symbolic string literals 'ident have been removed (compile time +constants provide a more convenient approach).
  12. +
  13. +untaint expression has been removed (this will be handled by +annotations instead).
  14. +
  15. The syntax for named arguments in a function call has reverted to +arg= from arg:, since the latter caused syntactic +ambiguities.
  16. +
  17. The syntax for error constructors specifies fields of the error detail +separately as named arguments, rather than specifying the error detail as a +single argument; the syntax for binding patterns and match patterns for error +values has also changed accordingly.
  18. +
  19. The error reason argument can be omitted from an error constructor if it +can be determined from the contextually expected type.
  20. +
  21. The syntax for annotation declarations has been revised; the places where +annotations are allowed has been revised to match the possible attachment +points.
  22. +
  23. An .@ binary operator has been added for accessing annotations +at runtime.
  24. +
  25. A unary typeof operator has been added.
  26. +
  27. The typedesc type now takes an optional type parameter.
  28. +
  29. The type parameters for future and stream are now +optional.
  30. +
  31. The syntax for a function with an external implementation has changed to use +=external in place of the curly braces.
  32. +
  33. A numeric literal can use a suffix of d or f to +indicate that it represents a value belonging to the decimal or float type +respectively.
  34. +
  35. Record type descriptors may now specify a default value for fields.
  36. +
  37. Providing a default value for a parameter no longer affects whether a function +call must supply the argument for that parameter positionally or by name. Instead +the argument for any parameter can be supplied either positionally or by name. +To avoid ambiguity, all arguments specified positionally must be specified before +arguments specified by name.
  38. +
  39. Expressions specifying the default value for function parameters are not +compile time constants, and are evaluated each time they are used to supply a +missing argument.
  40. +
  41. In the argument list of a function or method call, positional arguments are +now required to be specified before named arguments.
  42. +
  43. Types may now be defined within a block.
  44. +
+
+
+

B.12 Summary of changes from 0.980 to 0.990

+

+Structural types and values +

+
    +
  1. Concepts relating to typing of mutable structural values have been changed +in order to make type system sound.
  2. +
  3. The match statement has been redesigned.
  4. +
  5. The but expression has been removed.
  6. +
  7. The is expression for dynamic type testing has been added.
  8. +
  9. The type-cast-expr <T>E now performs unsafe type casts.The only +conversions it performs are numeric conversions.
  10. +
  11. The anydata type has been added, which is a union of simple and +structural types.
  12. +
  13. Records are now by default open to anydata|error, rather than +any.
  14. +
  15. Type parameters for built-in types (map, stream, future), which previously +defaulted to any, are now required.
  16. +
  17. The type parameter for json (e.g. json<T>) is not allowed any more.
  18. +
  19. Type for table columns are restricted to subtype of anydata|error.
  20. +
  21. There are now two flavors of equality operator: == and != for deep equality +(which is allowed only for anydata), and === and !== for exact +equality.
  22. +
  23. There is a built-in clone operation for performing a deep copy on values of +type anydata.
  24. +
  25. There is a built-in freeze operation for making structural values deeply +immutable.
  26. +
  27. Compile-time constants (which are always a subtype of anydata and frozen) +have been added.
  28. +
  29. Singleton types have been generalized: any compile-time constant can be made +into a singleton value.
  30. +
  31. Variables can be declared final, with a similar semantic to Java.
  32. +
  33. Errors are now immutable.
  34. +
  35. Module variables are not allowed to be public: only compile-time constants +can be public.
  36. +
+

+Error handling +

+
    +
  1. The any type no longer includes error.
  2. +
  3. +check is now an expression.
  4. +
  5. Exceptions have been replaced by panics +
      +
    1. the throw statement has been replaced by the panic +statement
    2. +
    3. the try statement has been replaced by the trap +expression
    4. +
    +
  6. +
  7. Object constructors (which could not return errors) have been replaced by +__init methods (which can return errors).
  8. +
+

+Concurrency +

+
    +
  1. Workers in functions have been redesigned. In particular, workers now have a +return value.
  2. +
  3. The done statement has been removed.
  4. +
  5. The fork/join statement has been redesigned.
  6. +
  7. A syntactic category between expression and statement, called action, has +been added.
  8. +
  9. A synchronous message send action has been added.
  10. +
  11. A flush action has been added to flush asynchronously sent messages.
  12. +
  13. A wait action has been added to wait for a worker and get its return value.
  14. +
  15. Futures have been unified with workers. A future<T> represents a value to +be returned by a named worker.
  16. +
  17. Error handling of message send/receive has been redesigned.
  18. +
+

+Endpoints and services +

+
    +
  1. Client endpoints have been replaced by client objects, and actions on client +endpoints have been replaced by remote methods on client objects. Remote methods +are called using a remote method call action, which replaces the action +invocation statement.
  2. +
  3. Module endpoint declaration has been replaced by module listener +declaration, which uses the Listener built-in object type.
  4. +
  5. The service type has been added as a new basic type of behavioral value, +together with service constructor expressions for creating service values.
  6. +
  7. Module service definitions have been redesigned.
  8. +
+

+Miscellaneous changes +

+
    +
  1. Public/private visibility qualifiers must be repeated on an outside method +definition.
  2. +
+
+
+

B.13 Summary of changes from 0.970 to 0.980

+
    +
  1. The decimal type has been added.
  2. +
  3. There are no longer any implicit numeric conversions.
  4. +
  5. The type of a numeric literal can be inferred from the context.
  6. +
  7. The error type is now a distinct basic type.
  8. +
  9. The byte type has been added as a predefined subtype of int; blobs have been +replaced by arrays of bytes.
  10. +
  11. The syntax of string templates and xml literals has been revised and +harmonized.
  12. +
  13. The syntax of anonymous functions has been revised to provide two +alternative syntaxes: a full syntax similar to normal function definitions and a +more convenient arrow syntax for when the function body is an expression.
  14. +
  15. The cases of a match statement are required to be exhaustive.
  16. +
  17. The + operator is specified to do string and xml concatenation as well as +addition.
  18. +
  19. Bitwise operators have been added (<<, >>, +>>>, &, |, ^, +~) rather than = after the argument name.
  20. +
  21. In a function call or method call, named arguments have changed to use +: +
  22. +
  23. A statement with check always handles an error by returning it, +not by throwing it.
  24. +
  25. +check is allowed in compound assignment statements.
  26. +
  27. Method names are now looked up differently from field names; values of types +other than objects can now have built-in methods.
  28. +
  29. The lengthof unary expression has been removed; the length +built-in method can be used instead.
  30. +
  31. The semantics of <T>expr have been specified.
  32. +
  33. The value space for tuples and arrays is now unified, in the same way as the +value space for records and maps was unified. This means that tuples are now +mutable. Array types can now have a length.
  34. +
  35. The next keyword has been changed to continue.
  36. +
  37. The syntax and semantics of destructuring is now done in a consistent way +for the but expression, the match statement, the foreach statement, +destructuring assignment statements and variable declarations.
  38. +
  39. The implied initial value is not used as a default initializer in variable +declarations. A local variable whose declaration omits the initializer must be +initialized by an assignment before it is used. A global variable declaration +must always have an initializer. A new expression can be used with any reference +type that has an implicit initial value.
  40. +
  41. Postfix increment and decrement statements have been removed.
  42. +
  43. The ... and ..< operators have been added for +creating integer ranges; this replaces the foreach statement's special treatment +of integer ranges.
  44. +
  45. An object type can be declared to be abstract, meaning it cannot be used +with new.
  46. +
  47. By default, a record type now allows extra fields other than those +explicitly mentioned; T... requires extra fields to be of type T +and !... disallows extra fields.
  48. +
  49. In a mapping constructor, an expression can be used for the field name by +enclosing the expression in square brackets (as in ECMAScript).
  50. +
  51. Integer arithmetic operations are specified to throw an exception on +overflow.
  52. +
  53. The syntax for documentation strings has changed.
  54. +
  55. The deprecated construct has been removed (data related to deprecation will +be provided by an annotation; documentation related to deprecation will be part +of the documentation string).
  56. +
  57. The order of fields, methods and constructors in object types is no longer +constrained.
  58. +
  59. A function or method can be defined as extern. The +native keyword has been removed.
  60. +
+
+
+
+

C. Planned future functionality

+ +

+The vision for the Ballerina language includes a range of functionality +that is not yet included in this specification. +

+ +
    +
  • +Security will combine language and platform features to make +programs secure by default.
  • +
  • +Date/time basic types will provide one or more basic types related +to date and time.
  • +
  • +Event stream processing will build on the stream type +to allow queries over timestamped sequences of events
  • +
  • +Generic types will provide types that can be instantiated with one +or more type parameters.
  • +
  • +Flexible message passing will support patterns of communication +between workers/strands, where the number of messages is not fixed and/or +workers are not peers.
  • +
  • +Long-running processes will allow the execution of a program to be +automatically suspended and then later resumed upon the occurrence of particular +external events.
  • +
  • +Reliable messaging will allow for sending messages across the +network with some guarantees about reliability.
  • +
+ +

+Proposals +for new language features relating to this and other functionality are +maintained in the specification's GitHub repository. +

+ +
+ +
+

D. Other contributors

+

+The following contributed to establishing the design principles of the language: +

+ +

+The following also contributed to the language in a variety of ways (in +alphabetical order): +

+ +
+ + diff --git a/public/spec/lang/2024R1/spec.xml b/public/spec/lang/2024R1/spec.xml new file mode 100644 index 000000000000..752dc15db4bd --- /dev/null +++ b/public/spec/lang/2024R1/spec.xml @@ -0,0 +1,14723 @@ + + + + Ballerina Language Specification + + + + +

Ballerina Language Specification, 2024R1

+

+Primary contributors: +

+ +

+(Other contributors are listed in Appendix D.) +

+

+Copyright © 2018-2024 WSO2 +

+

+Licensed under the Creative Commons +Attribution-NoDerivatives 4.0 International license +

+

+Language and document status +

+

+The language described in this specification is now stable. We do not plan to +make changes that introduce significant incompatibilities. +

+

+This release contains a preview of the regular expression feature. Minor +changes may be made before it becomes stable. +

+

+Comments on this document are welcome and should be made by creating an issue in +https://github.com/ballerina-platform/ballerina-spec, which is the +GitHub repository where this specification is maintained. +

+
+

Table of contents

+

1. Introduction

+

2. Notation

+

3. Program structure

+

4. Lexical structure

+

5. Values, types and variables

+

6. Expressions

+

7. Actions and statements

+

8. Module-level declarations

+

9. Metadata

+

10. Data tags

+

11. Lang library

+

A. References

+

B. Changes since previous versions

+

C. Planned future functionality

+

D. Other contributors

+
+
+

1. Introduction

+

+Ballerina is a statically typed, concurrent programming language, focusing on +network interaction and structured data. It is intended to be the core of a +language-centric middleware platform. It has all the general-purpose +functionality expected of a modern programming language, but it also has several +unusual aspects that make it particularly suitable for its intended purpose. +

+

+First, it provides language constructs specifically for consuming and providing +network services. Future versions of Ballerina will add language constructs for +other middleware functionality such as event stream processing and reliable +messaging; this is described in more detail in Appendix C. +

+

+Second, its abstractions and syntax for concurrency and network interaction have +been designed so that there is a close correspondence with sequence diagrams. +This enables a bidirectional mapping for any Ballerina function between its +textual representation in the syntax described in this specification and its +graphical representation as a sequence diagram, such that the sequence diagram +fully shows the aspects of the behavior of that function that relate to +concurrency and network interaction. +

+

+Third, it has a type system that is more flexible and allows for looser coupling +than traditional statically typed languages. The type system is structural: +instead of requiring the program to explicitly say which types are compatible +with each other, compatibility of types and values is determined automatically +based on their structure; this is particularly useful when combining data from +multiple, independently-designed systems. In addition, the type system provides +union types and open records. This flexibility allows the type system to be used +as a schema for the data that is exchanged in distributed applications. +Ballerina's data types are designed to work particularly well with JSON; any +JSON value has a direct, natural representation as a Ballerina value. Ballerina +also provides support for XML and tabular data. +

+

+Ballerina is not a research language. It is intended to be a pragmatic language +suitable for mass-market commercial adoption. It tries to feel familiar to +programmers who are used to popular, modern C-family languages, notably Java, C# +and JavaScript. It also gets ideas and inspiration from many other existing +programming languages including TypeScript, Go, Rust, D, Kotlin, Swift, Python +and Perl. +

+

+The Ballerina language has been designed in conjunction with the Ballerina +platform, which provides comprehensive support for a module-based software +development model, including versioning, dependency management, testing, +documentation, building and sharing. Modules are organized into repositories; +there is a globally-shared, central repository, but repositories can also be +local. +

+

+The Ballerina language includes a small library, the lang library, which +provides fundamental operations on the data types defined by the language; the +lang library is defined by this specification. The Ballerina platform includes +an extensive standard library, which includes not only the usual low-level, +general-purpose functionality, but also support for a wide variety of network +protocols, interface standards, data formats and authentication/authorization +standards, which make writing secure, resilient distributed applications +significantly easier than with other languages. The standard library is not +specified in this document. +

+
+
+

2. Notation

+

+Productions are written in the form: +

+ +
symbol := rhs
+
+

+where symbol is the name of a nonterminal, and rhs is as follows: +

+
    +
  • 0xX means the single character whose Unicode code point is +denoted by the hexadecimal numeral X
  • +
  • ^x means any single Unicode code point that does not match x +and is not a disallowed character;
  • +
  • x..y means any single Unicode character whose code point is +greater than or equal to that of x and less than or equal to that of y
  • +
  • xyz means the characters xyz literally
  • +
  • xyzNR means the characters xyz literally, +and xyz is not a reserved keyword
  • +
  • symbol means a reference to production for the nonterminal +symbol
  • +
  • x|y means x or y
  • +
  • x&y means x and y, interleaved in any order
  • +
  • [x] means zero or one times
  • +
  • x? means x zero or one times
  • +
  • x* means x zero or more times
  • +
  • x+ means x one or more times
  • +
  • (x) means x (grouping)
  • +
+

+The rhs of a symbol that starts with a lower-case letter implicitly allows white +space and comments, as defined by the production TokenWhiteSpace, +between the terminals and nonterminals that it references. +

+
+
+

3. Program structure

+

+A Ballerina program is divided into modules. A module has a source form and a +binary form. The source form of a module consists of an ordered collection of +one or more source parts; each source part is a sequence of bytes that is the +UTF-8 encoding of part of the source code for the module. The format of a source +part is defined by this specification. The format of a binary module is +specified by the Ballerina platform. +

+

+A source module can reference other modules. Each source module can be +separately compiled into a binary module: compilation of a source module needs +access only to the binary form of other modules referenced from the source +module. A source module identifies each module that it references using an +organization name and a module name, which is divided into one or more parts. +Both the organization name and each part of the module name are Unicode strings. +Any organization name starting with the string ballerina is +reserved for use by the Ballerina platform. +

+

+The Ballerina platform defines a packaging system for Ballerina modules, which +allows one or more modules to be combined into a package. The packaging system +treats the first part of each module's name as being a package name. All the +modules combined into a package share the same package name. Packages have both +a source and a binary format. The source format stores the source form of a +package's modules in a hierarchical filesystem. The binary format stores the +binary form of a package's module as a sequence of bytes. +

+

+Binary packages can be stored in a package repository. Packages are versioned; +versions are semantic, as described in the SemVer specification. A package +repository can store multiple versions of the same package. Thus, within a +repository, binary packages are organized into a three-level hierarchy: +

+
    +
  1. organization;
  2. +
  3. package name;
  4. +
  5. version.
  6. +
+

+The source format of a package includes a Ballerina.toml file that +allows control over the package versions used for referenced modules. +

+

+The packaging system also allows control over which modules are exported from a +package; modules that are not exported from a package are visible only to +modules within the package. +

+
+
+

4. Lexical structure

+

+The grammar in this document specifies how a sequence of Unicode code points is +interpreted as part of the source of a Ballerina module. A Ballerina module part +is a sequence of octets (8-bit bytes); this sequence of octets is interpreted as +the UTF-8 encoding of a sequence of code points and must comply with the +requirements of RFC 3629. +

+

+After the sequence of octets is decoded from UTF-8, the following two +transformations must be performed before it is parsed using the grammar in this +document: +

+
    +
  • if the sequence starts with a byte order mark (code point 0xFEFF), it must +be removed
  • +
  • newlines are normalized as follows: +
      +
    • the two character sequence 0xD 0xA is replaced by 0xA
    • +
    • a single 0xD character that is not followed by 0xD is replaced by 0xA
    • +
    +
  • +
+

+The sequence of code points must not contain any of the following disallowed +code points: +

+
    +
  • surrogates (0xD800 to 0xDFFF)
  • +
  • non-characters (the 66 code points that Unicode designates as +non-characters)
  • +
  • C0 control characters (0x0 to 0x1F and 0x1F) other than white space (0x9, +0xA, 0xC, 0xD)
  • +
  • C1 control characters (0x80 to 0x9F)
  • +
+

+Note that the grammar notation ^X does not allow the above disallowed code +points. +

+ +
identifier := UnquotedIdentifier | QuotedIdentifier
+UnquotedIdentifier := (IdentifierInitialChar | IdentifierEscape) (IdentifierFollowingChar | IdentifierEscape)*
+QuotedIdentifier := ' (IdentifierFollowingChar | IdentifierEscape)+
+IdentifierInitialChar :=  AsciiLetter | _ | UnicodeIdentifierChar
+IdentifierFollowingChar := IdentifierInitialChar | Digit
+IdentifierEscape := IdentifierSingleEscape | NumericEscape
+IdentifierSingleEscape := \ ^ ( AsciiLetter | 0x9 | 0xA | 0xD | UnicodePatternWhiteSpaceChar )
+NumericEscape := \u{ CodePoint }
+CodePoint := HexDigit+
+AsciiLetter := A .. Z | a .. z
+UnicodeIdentifierChar := ^ ( AsciiChar | UnicodeNonIdentifierChar )
+AsciiChar := 0x0 .. 0x7F
+UnicodeNonIdentifierChar :=
+   UnicodePrivateUseChar
+   | UnicodePatternWhiteSpaceChar
+   | UnicodePatternSyntaxChar
+UnicodePrivateUseChar :=
+   0xE000 .. 0xF8FF
+   | 0xF0000 .. 0xFFFFD
+   | 0x100000 .. 0x10FFFD
+UnicodePatternWhiteSpaceChar := 0x200E | 0x200F | 0x2028 | 0x2029
+UnicodePatternSyntaxChar := character with Unicode property Pattern_Syntax=True
+Digit := 0 .. 9
+
+

+Note that the set of characters allowed in identifiers follows the requirements +of Unicode TR31 for immutable identifiers; the set of characters is immutable in +the sense that it does not change between Unicode versions. +

+

+The QuotedIdentifier syntax allows a reserved keyword +K can be used as an identifier by preceding it with a +single quote i.e. 'K. The IdentifierEscape +syntax allows an arbitrary non-empty string to be treated as an identifier. In a +NumericEscape, CodePoint must valid Unicode code +point; more precisely, it must be a hexadecimal numeral denoting an integer +n where 0 ≤ n < 0xD800 or 0xDFFF < n ≤ +0x10FFFF. +

+ +
RestrictedIdentifier := AsciiLetter RestrictedFollowingChar* RestrictedIdentifierWord*
+RestrictedIdentifierWord := _ RestrictedFollowingChar+
+RestrictedFollowingChar := AsciiLetter | Digit
+
+ +

+Identifiers used for the names of organizations and modules are restricted to +RestrictedIdentifier. +

+ +
TokenWhiteSpace := (Comment | WhiteSpaceChar)*
+Comment := // AnyCharButNewline*
+AnyCharButNewline := ^ 0xA
+WhiteSpaceChar := 0x9 | 0xA | 0xD | 0x20
+
+

+TokenWhiteSpace is implicitly allowed on the right hand side of +productions for non-terminals whose names start with a lower-case letter. +

+ +
NoSpaceColon := :
+
+

+When NoSpaceColon is used in a production, +TokenWhiteSpace is not allowed immediately before or after the +colon. When a literal : is used in a production, white space is +handled in the same was as for any other character. +

+ +
+
+

5. Values, types and variables

+ +
+

Overview

+ +
+

Type system fundamentals

+

+Ballerina programs operate on a rich universe of values. This universe of values +is partitioned into a number of basic types; every value belongs to +exactly one basic type. +

+

+Values are of four kinds, each corresponding to a kind of basic type: +

+
    +
  • simple values, like booleans and floating point numbers, which are not +composed from other values;
  • +
  • structured values, like mappings and lists, which contain values of arbitrary basic types;
  • +
  • sequence values, which consists of sequences of values of the same basic type;
  • +
  • behavioral values, like functions and objects, which are not just data.
  • +
+

+There is a fundamental distinction between values that have a storage +identity and values that do not. A value that has storage identity has an +identity that comes from the location where the value is stored. All structural +and behavioural values have a storage identity, whereas all simple values +do not. Storage identity for sequence values is more complicated and will be +explained in the section on sequence values. +

+

+Values can be stored in variables or as members of structures or in constituents +of sequences. When a value has no storage identity, it can be stored directly in +the variable, structure or sequence. However, when a value has storage identity, +what is stored in the variable, structure or sequence is a reference to the +location where the value is stored rather than the value itself. Storage +identity allows values in Ballerina to represent not just trees but graphs. +

+

+Ballerina provides the ability to test whether two values have the same storage +identity, but does not expose the specific storage location of a value. For +values with storage identity, there is the concept of creating a new +value: this means creating a value that has a storage identity that is different +from any existing value. For values with storage identity, there is also the +concept of copying: it means to create a value that is the same, except +for having a new storage identity. The concept of having storage identity is +similar to the concept of a reference type in some other programming languages, +but also accomodates the concept of a sequence value. +

+

+Ballerina programs use types to categorize values both at compile-time and +runtime. Types deal with an abstraction of values that does not consider storage +identity. This abstraction is called a shape. A type denotes a set of +shapes. Subtyping in Ballerina is semantic: a type S is a subtype of +type T if the set of shapes denoted by S is a subset of the set of shapes +denoted by T. Every value has a corresponding shape. A shape is specific to a +basic type: if two values have different basic types, then they have different +shapes. The shape of the values contained in a structured value are part of the +shape of the structured value. Since shapes do not deal with storage identity, +they represent trees rather graphs. For simple values, there is no difference +between a shape and a value, with the exception of floating point values where +the shape does not consider representation details that do not affect the +mathematical value being represented. +

+

+A value is plain data if it is a simple value, a sequence value, or a +structured value that does not contain a behavioral value at any depth. +More precisely, a value is defined to be plain data if it is +

+
    +
  • a simple value,
  • +
  • a sequence value,
  • +
  • a structured value, all of whose members are also plain data.
  • +
+

+Plain data values can in general contain cycles of references, but in some +contexts are restricted to be acyclic. Plain data values, including values with +cycles, can be compared for equality. +

+

+The two most important kinds of behavioural values are functions and objects. A +function value can be executed by calling it; when a function is called, it is +passed values and arguments and returns a value. An object encapsulates data +with functions that operate on the data: an object's members are divided into +fields, which hold the data, and methods, which are the functions that operate +on the data. +

+
+ +
+

Mutation

+

+There are two kinds of things that can be mutated in Ballerina: variables and +values. Mutation of values is tied to storage identity: mutation is only +possible for values with storage identity. When a value stored in some storage +location is mutated, the change will be visible through all variables referring +to the value in that location. But not all values with storage identity can be +mutated: a value may not support mutation even though it has a storage identity. +

+

+The possibility of mutation gives rise to two relations between a value and a +type: +

+
    +
  • a value looks like a type at a particular point in the execution of +a program if its shape at that point is a member of the type;
  • +
  • a value belongs to a type if it looks like the type, and it will +necessarily continue to look like the type no matter how the value is mutated.
  • +
+

+If a value cannot be mutated, looking like a type and belonging to a type are +the same thing. +

+

+When a Ballerina program declares a variable to have a compile-time type, this +means that the Ballerina compiler together with the runtime system will ensure +that the variable will only ever hold a value that belongs to the type. +Ballerina also provides mechanisms that take a value that looks like a type and +use it to create a value that belongs to a type. +

+

+Every value has a read-only bit. If the read-only bit is on, it means that the +value is immutable. A value's read-only bit is fixed when the value is +constructed, and cannot be changed thereafter. Ballerina maintains the invariant +that immutability is deep: any value reachable from a value with its read-only +bit set is guaranteed to have its read-only bit set. Here reachable +means reachable through read operations: every member of a structure value is +reachable from the structure value; every constituent of a sequence value is +reachable from the sequence value; every member of an object value is reachable +from the object value. Reachability is transitive: if t is reachable +from s, and s is reachable from r, then +t is reachable from r. Reachability is also considered +reflexive: a value is reachable from itself. +

+

+Some basic types are inherently immutable: the read-only bit is always on for a +value that belongs to an inherently immutable basic type. All simple types are +inherently immutable as are functions. Some basic types are selectively +immutable: a type is selectively immutable if it is possible to construct both +values of the type that have the read-only bit on and values that do not have +the read-only bit on. All structured types are selectively immutable as are +objects. Finally, some basic types are inherently mutable: the read-only bit is +never on for a value belonging to an inherently mutable basic type. +

+

+Each selectively immutable basic type can be partitioned into two +uniform types, one containing values with the read-only bit on, and one +containing values where the read-only bit is off. For every other basic type, +there is a single uniform type. Every uniform type is thus either completely +readonly or completely mutable; every value thus belongs to exactly one uniform +type, and mutation cannot change the uniform type to which a value belongs. +

+

+It is also possible to limit the mutability of variables, by making them final. +This means that the value that a variable holds cannot be changed after the +variable has been initialized. Unlike immutability of variables, this is not +deep. A final variable can hold a mutable value. +

+
+ +
+

Isolation

+

+There are three possible operations on storage: read, write and execute. The +concept of immutability relates to reading and writing storage, and provides +limited information about execution: execution cannot lead to mutation of an +immutable value. For functions and objects, it is useful to have more +information about how execution may lead to mutation. Ballerina has a concept of +isolation that provides this. +

+

+In addition to defining when a value is reachable from a value, we can define +when a value is reachable from a variable: a value is reachable from a variable +if the value is reachable from the value that the variable holds. We +can also define when mutable state is reachable from a value or variable: the +mutable state of a value v is reachable from a value or variable, if v is +reachable from the value or variable; the mutable state of a variable v is +reachable only from the variable v. +

+

+Objects have an isolated bit in addition to a read-only bit; an object value is +isolated if its isolated bit is set. Mutable state is defined to be freely +reachable from a value or variable if it is reachable without following a +reference to an isolated object. A variable or value is an isolated +root if its mutable state is isolated from the rest of the program's +mutable state: any mutable state that is freely reachable from the isolated root +is reachable from outside only through the isolated root. More precisely, if +some mutable state s is freely reachable from an isolated root value +r, then s is not freely reachable from a variable or value +that is not reachable from r except by following a reference through +r; similarly, if some mutable state s is freely reachable +from an isolated root variable r, then s is not freely +reachable from a value that is not reachable from r and is not freely +reachable from any variable other than r. A variable can also be +declared to be isolated. Ballerina maintains the invariant that isolated objects +and isolated variables are isolated roots. Ballerina also guarantees that any +mutable state freely reachable from an isolated object or isolated variable is +accessed only within the scope of a lock +statement, which ensures that there is no data race in accessing that +mutable state. This implies that there will be no data race accessing any +mutable state that is reachable (not just freely reachable) from an isolated +object or isolated variable. +

+

+Functions and methods have an isolated bit in addition to a read-only bit; a +function or method is isolated if its isolated bit is set. Ballerina guarantees +that a call an isolated method or function will only result in access to mutable +state if at least one of the following conditions applies: +

+
    +
  • the mutable state is freely reachable from an argument passed to the +function or method and the access happens on the strand on which the function is +called; the object on which a method is invoked is considered as an argument for +this purpose;
  • +
  • the mutable state is freely reachable from an isolated variable or an +isolated object;
  • +
  • the mutable state is part of a new value created by the call.
  • +
+

+The caller of a function can thus ensure that a function call will not lead to a +data race by ensuring that no data race is possible for the mutable state freely +reachable from the arguments that it passes to the function, for example by +passing only immutable values or isolated objects. +

+ +
+
+

Type descriptors

+

+Ballerina provides a rich variety of type descriptors, which programs use to +describe types. For example, there is a type descriptor for each simple basic +type; there is a type descriptor that describes a type as a union of two types; +there is a type descriptor that uses a single value to describe a type that +contains a single shape. This means that values can look like and belong to +arbitrarily many types, even though they look like or belong to exactly one +basic type. +

+

+The following table summarizes the type descriptors provided by Ballerina. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KindNameSet of values denoted by type descriptor
basic, simplenil()
booleantrue, false
int64-bit signed integers
float64-bit IEEE 754-2008 binary floating point numbers
decimaldecimal floating point numbers
basic, sequencestringa sequence of Unicode scalar values
XMLa sequence of zero or more elements, processing instructions, comments or +text items
basic, structuredarrayan ordered list of values, optionally with a specific length, where a +single type is specified for all members of the list
tuplean ordered list of values, where a type is specified separately for each +member of the list
mapa mapping from keys, which are strings, to values; specifies mappings in +terms of a single type to which all keys are mapped
recorda mapping from keys, which are strings, to values; specifies maps in +terms of names of fields (required keys) and value for each field
tablea ordered collection of mappings, where a mapping is uniquely identified +within the table by a key derived from the mapping
basic, behavioralerroran indication that there has been an error, with a string identifying the +reason for the error, and a mapping giving additional details about the error
functiona function with 0 or more specified parameter types and a single return +type
futurea value to be returned by a function execution
objecta combination of named fields and named methods
typedesca type descriptor
handlereference to externally managed storage
streama sequence of values that can be generated lazily
othersingletona single value described by a literal
readonlyany value whose read-only bit is on
anyany value other than an error
neverno value
optionala value that is either () or belongs to a type
uniona value that belongs to at least one of a number of types
intersectiona value that belongs to all of a number of types
distinct
anydataplain data (a simple value, sequence value or structured value that + does not contain behavioral members at any depth)
jsonthe union of (), int, float, decimal, string, and maps and arrays whose +values are, recursively, json
byteint in the range 0 to 255 inclusive
+

+A shape is divided into two aspects: the primary aspect and +the read-only aspect. A value's read-only bit is a part of the +read-only aspect of the value's shape. The read-only bit of values +contained in a structured value is part of the read-only aspect of those values +and of the read-only aspect of the structured value. Everything about a shape +except the read-only bits constitutes the primary aspect of the shape. If two +plain data values compare equal, then the primary aspect of their shapes is the +same, but there may be differences in the read-only aspect. +

+

+Type descriptors other than readonly describes types using only the +primary aspect of shape: whether a value belongs to the type is not affected by +the read-only aspect of the value's shape. The readonly type uses +only the read-only aspect: whether a value belongs to the readonly +type depends only on the read-only aspect of the value's shape. +

+

+In addition to describing a type, a type descriptor may also include information +used to construct a value of the type, as well as metadata. Whereas the type +described by a type descriptor is known at compile time, this additional +information may need to be resolved at runtime. The typedesc basic type +represents a type descriptor that has been resolved. +

+ +
type-descriptor :=
+   simple-type-descriptor
+   | sequence-type-descriptor
+   | structured-type-descriptor
+   | behavioral-type-descriptor
+   | other-type-descriptor
+
+

+For simplicity, the type-descriptor grammar is ambiguous. The following table +shows the various types of type descriptor in decreasing order of precedence, +together with associativity. +

+ + + + + + + + + + + + + + + + + + + + + + + + + +
OperatorAssociativity
distinct T
T[]
T?
T1 & T2left
T1 | T2left
function(args) returns Tright
+ + +
+
+

Type-ids

+

+Ballerina has a feature, called distinct types, which provides +functionality similar to that provided by nominal types, but which works within +Ballerina's structural type system. Distinct types are similar to the branded +types found in some other structurally typed languages, such as Modula-3. +

+

+The semantics of distinct types are based on type-ids. These are similar to the +brands used by branded types. A distinct type is created by the use of the +distinct keyword in either a distinct-type-descriptor or the +class-type-quals of a module-class-defn. Each such +occurrence of the distinct keyword has a distinct type-id, which +uniquely identifies it within a Ballerina program. A type-id has three parts: +

+
    +
  1. a module id, which identifies the module within which the +distinct-type-descriptor occurs; this consists of an organization, a module +name, and an array of platform-specified strings, which could include +information about, for example, the repository or version of the package the +module comes from;
  2. +
  3. a local id, which identifies the occurrence of the +distinct within the module; this takes one of two forms: +
      +
    • named - +
        +
      • if the distinct keyword is part of a distinct-type-descriptor +that is the only distinct-type-descriptor occurring within a module-type-defn, +then the local id is the name of the type defined by the module-type-defn;
      • +
      • if the distinct keyword is part of the class-type-quals +of a module-class-defn, then the local id is the name of the class defined +by the module-class-defn;
      • +
      +
    • +
    • anonymous - otherwise, the local id is a compiler-generated integer;
    • +
    +
  4. +
  5. a boolean flag saying whether the type-id is public; this flag is on if and +only if the local id part is named and is the name of a module-type-defn that is +public.
  6. +
+

+Distinct types can be used with only the object or error basic types. An object +value or error value has a set of type-ids. These type-ids are fixed at the +time of construction and are immutable thereafter. A value's set of type-ids may +be empty. The type-ids of a value are part of the value's shape and so can +affect when an object belongs to a type. The set of type-ids of an object or +error value are divided into primary type-ids and secondary type-ids: the +secondary type-ids could be inferred from the primary type-ids using the +program's source. +

+

+An object or error value is always constructed using a specific type descriptor. +A type descriptor for objects and errors thus performs a dual role: it denotes a +type and it defines a mechanism to construct a value of the type. A type +descriptor is definite if it induces a specific set of type-ids. The +set of type-ids of an object or error value are those induced by the +type-descriptor used to construct it; such a type descriptor must therefore be +definite. A type descriptor that denotes a type that does not allow object or +error values induces an empty set of type-ids and so is vacuously definite. For +other type descriptors, the section that specifies that type descriptor will say +when it is definite, the set of type-ids that it induces when it is, and which +of those are primary. +

+ +
+
+

Iterability

+

+Values of some basic types are iterable. An iterable value supports an +iteration operation, which treats the iterable value as consisting of a sequence +of zero or more simpler values, which are in some sense a part of the iterable +value; the iteration operation provides the values in the sequence, one after +another. The sequence of values that an iteration operation on a value provides +is the iteration sequence of the value. Each iterable basic type +defines the iteration sequence for a value of that basic type. There is also a +value associated with the completion of the iteration operation, which is nil if +the iteration completed successfully and an error otherwise. The iteration +operation thus determines two associated types for an iterable type: the value +type, which is the type of the values in the iteration sequence, and the +completion type, which is the type of the iteration completion value. +

+

+The following tables summarizes the iterable basic types. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic typeIteration sequenceType descriptorValue typeCompletion type
stringlength 1 substringsstringstring:Char()
xmlsingleton xml valuesxml<T>T()
listmembers in orderT[]T()
mappingmembersmap<T>T()
tablemembers in ordertable<T>T()
streamitemsstream<T,C>TC
+
+
+ +
+

Simple values

+

+The basic type of a simple value is either one of the following +

+
    +
  • nil
  • +
  • boolean
  • +
  • int
  • +
  • float
  • +
  • decimal
  • +
+

+or is a tagged data type. +

+

+All simple basic types are inherently immutable. +

+ +
simple-type-descriptor :=
+   nil-type-descriptor
+   | boolean-type-descriptor
+   | int-type-descriptor
+   | floating-point-type-descriptor
+   | tagged-data-type-descriptor
+
+

+The type descriptor for each simple basic type contains all the values of the +basic type. +

+
+

Nil

+ +
nil-type-descriptor := nil-literal
+nil-literal :=  ( ) | null
+
+

+The nil type contains a single value, called nil, which is used to represent the +absence of any other value. The nil value is written (). The nil +value can also be written null, for compatibility with JSON; the +use of null should be restricted to JSON-related contexts. +

+

+The nil type is special, in that it is the only basic type that consists of a +single value. +

+
+
+

Boolean

+ +
boolean-type-descriptor := boolean
+boolean-literal := true | false
+
+

+The boolean type consists of the values true and false. +

+
+
+

Int

+ +
int-type-descriptor := int
+int-literal := DecimalNumber | HexIntLiteral
+DecimalNumber := 0 | NonZeroDigit Digit*
+HexIntLiteral := HexIndicator HexNumber
+HexNumber := HexDigit+
+HexIndicator := 0x | 0X
+HexDigit := Digit | a .. f | A .. F
+NonZeroDigit := 1 .. 9
+
+

+The int type consists of integers between -9,223,372,036,854,775,808 and +9,223,372,036,854,775,807 (i.e. signed integers than can fit into 64 bits using +a two's complement representation). +

+

+The byte type is a subtype of +int. The lang.int lang library module also +provides built-in subtypes for signed and +unsigned integers representable in 8, 16 and 32 bits. +

+ +
+
+

Floating point types

+ +
floating-point-type-descriptor := float | decimal
+floating-point-literal :=
+   DecimalFloatingPointNumber | HexFloatingPointLiteral
+DecimalFloatingPointNumber :=
+   DecimalNumber Exponent [FloatingPointTypeSuffix]
+   | DottedDecimalNumber [Exponent] [FloatingPointTypeSuffix]
+   | DecimalNumber FloatingPointTypeSuffix
+DottedDecimalNumber :=
+   DecimalNumber . Digit+
+   | . Digit+
+Exponent := ExponentIndicator [Sign] Digit+
+ExponentIndicator := e | E
+HexFloatingPointLiteral := HexIndicator HexFloatingPointNumber
+HexFloatingPointNumber :=
+   HexNumber HexExponent
+   | DottedHexNumber [HexExponent]
+DottedHexNumber :=
+   HexDigit+ . HexDigit+
+   | . HexDigit+
+HexExponent := HexExponentIndicator [Sign] Digit+
+HexExponentIndicator := p | P
+Sign := + | -
+FloatingPointTypeSuffix := DecimalTypeSuffix | FloatTypeSuffix
+DecimalTypeSuffix := d | D
+FloatTypeSuffix :=  f | F
+
+ +
+
Float
+ +

+The float type corresponds to IEEE 754-2008 64-bit binary (radix 2) floating +point numbers. A float value can be represented by either a +DecimalFloatingPointNumber with an optional FloatTypeSuffix, or by a +HexFloatingPointLiteral. +

+

+The multiple bit patterns that IEEE 754 treats as NaN are considered to be the +same value in Ballerina. Positive and negative zero of a floating point basic +type are distinct values, following IEEE 754, but are defined to have the same +shape, so that they will usually be treated as being equal. +

+

+IEEE-defined operations on float values must be performed using a +rounding-direction attribute of roundTiesToEven (which is the default IEEE +rounding direction, sometimes called round to nearest). All float +values, including the intermediate results of expressions, must use the value +space defined for the float type; implementations must not use extended +precision for intermediate results. This ensures that all implementations will +produce identical results. (This is the same as what is required by strictfp in +Java.) +

+
+
+
Decimal
+ +

+The decimal type corresponds to a subset of IEEE 754-2008 128-bit decimal (radix +10) floating point numbers. Any decimal value can be represented by a +DecimalFloatingPointNumber with an optional DecimalTypeSuffix. +

+

+A decimal value is a triple (s, c, e) where +

+
    +
  • s is sign, either 0 or -1
  • +
  • c is the coefficient, an unsigned integer that can be exactly +represented in 34 decimal digits
  • +
  • e is the exponent, a signed integer
  • +
+

+representing the mathematical value -1s × +c × 10e. The range for the exponent +e is implementation dependent, but must be at least the range +supported by the IEEE 754-2008 decimal128 format (which is -6176 to 6111 +inclusive). +

+

+The decimal type corresponds to the ANSI X3.274 subset of IEEE 754-2008, which +has the following simplifications: +

+
    +
  • +0 and -0 are not distinguished; if the coefficent is zero, then the sign is +also constrained to be zero;
  • +
  • NaN, infinities and subnormals are not supported; operations that would +result in one of these values according to the normal rules of IEEE 754-2008 +instead result in a panic.
  • +
+

+Operations on the decimal type use the roundTiesToEven rounding mode, like the +float type. +

+

+The shape of a decimal value is its mathematical value. Thus two decimal values +have the same shape if they represent the same mathematical value, even if they +do so using different exponents. +

+
+
+
+

Tagged data values

+ +

+Tagged data types are used for well-known data types that are not +application-specific, but are widely supported across multiple protocols and +programming languages. Each of these data types has its own conventional string +syntax. The use of tagged data types allows programs to work with these data +types using their normal string syntax, while distinguishing the values as +belonging to a specific tagged data type. +

+

+Data tags are defined either by this specification or the Ballerina platform. +For each such data tag, there is a corresponding basic type. The definition of a +data tag specifies the set of values belonging to the corresponding basic type. +A tagged data value is a value belonging to one of these basic types. Every +tagged data value is plain data, immutable and has no storage identity. The +shape of a tagged data value is the value. +

+

+The definition of a data tag with corresponding basic type B specifies: +

+
    +
  • the name of the data tag; this is an unqualified identifier that is used +with the tagged-data-template-expr to construct a value of type B;
  • +
  • the set of values that B consists of;
  • +
  • an abstract parsing function, used at compile-time; a sequence of characters +into which n values can be interpolated is represented by an array of +n + 1 strings; the abstract parsing function accordingly takes an +array of n + 1 strings, with n ⁥ 0, and returns +either an error or a function of n arguments that interpolates its +arguments into the result of the parse; the type of both the arguments and the +return value of the returned function is B;
  • +
  • an abstract function mapping from values of type B to strings;
  • +
  • a library module; method call expressions on values of type B will call +functions in this module.
  • +
+

+Note that errors cannot happen during interpolation. The abstract parsing +function must therefore allow interpolations only in places where any valid +value of type B can be interpolated. +

+

+Most of the functionality of a tagged data type is provided by its library +module. +

+ +
tagged-data-type-descriptor := qualified-identifier
+
+

+The qualified-identifier in a tagged-data-type-descriptor refers to a type that +is defined in a module that is part of the language library or standard library. +

+

+In this version of the Ballerina language, only the data tag re +is defined, with associated lang library module lang.regexp. +

+ +
+ +
+
+

Sequence values

+ +
sequence-type-descriptor :=
+   string-type-descriptor
+   | xml-type-descriptor
+
+

+A sequence value belongs to one of the following two basic types: +

+
    +
  • string
  • +
  • xml
  • +
+

+A sequence value consists of an ordered sequence of zero or more constituent +items, where the constituent items belong to the same basic type as the sequence +value itself. The length of a sequence value is the number of its +constituent items. Each constituent of a sequence value has an integer index +≥ 0 and < length. A sequence value is a singleton if its +length is 1. For each sequence basic type, there is an empty value, +which has length 0. As with other basic types, the sequence basic types are +disjoint with themselves and with other basic types. Thus the empty value for +string is distinct from the empty value for xml, and these are both distinct +from nil. +

+

+The values belonging to a sequence basic type B can be defined in terms of its +singleton values and a concatenation operation, by the following rules: +

+
    +
  • +the singleton values of B belong to B; +
  • +
  • +the empty value of B belongs to B; +
  • +
  • +if v1 and v2 belong to B, then the concatenation of +v1 and v2 belongs to B. +
  • +
+

+The concatenation of any value v belonging to B with the empty sequence of B in +either order is v. +

+

+Note that for a sequence consisting of a single item v is the same thing as v. A +single item is a sequence. The type of the constituent items of a +sequence of basic type B is thus a subtype of B. This is a fundamental +difference between sequences and lists. +

+

+Only singleton values of a sequence type can have storage identity. When a +constituent of a sequence value has storage identity, what is stored in the +sequence value is a reference to the location where the constituent value is +stored rather than the constituent value itself. +

+

+A sequence value is iterable: the iteration sequence consists of the singleton +items of the sequence value in order and the iteration completion value is +always nil. +

+ +
+

Strings

+ +
string-type-descriptor := string
+string-literal := DoubleQuotedStringLiteral
+DoubleQuotedStringLiteral := " (StringChar | StringEscape)* "
+StringChar := ^ ( 0xA | 0xD | \ | " )
+StringEscape := StringSingleEscape | NumericEscape
+StringSingleEscape := \t | \n | \r | \\ | \"
+
+

+A string is an sequence of zero or more Unicode characters. More precisely, it +is a sequence whose singleton values represent Unicode scalar values, where a +Unicode scalar value is any code point in the Unicode range of 0x0 to 0x10FFFF +inclusive, other than surrogate code points, which are 0xD800 to 0xDFFF +inclusive. Note that a string may include Unicode noncharacters, such as 0xFFFE +and 0xFFFF. +

+

+String values do not have storage identity and so the string basic type is +inherently immutable. +

+

+There is a built-in subtype +string:Char for single character strings. +

+
+
+

XML

+ +

+An xml value is a sequence representing parsed XML, such as occurs in the +content of an XML element. The singleton values are of the following types: +

+
    +
  • element
  • +
  • processing instruction
  • +
  • comment
  • +
  • text
  • +
+

+The element, processing instruction and comment singletons correspond directly +to information items in the XML Information Set. A text singleton corresponds to +one or more character information items. When an xml value is constructed, +consecutive text singletons are merged, so that an xml value never contains +consecutive text singletons. There are built-in +subtypes xml:Element, xml:ProcessingInstruction, +xml:Comment and xml:Text corresponding to the above +singletons; xml:Text also allows the empty xml value. +

+
xml-type-descriptor := xml [type-parameter]
+type-parameter := < type-descriptor >
+
+

+A shape belongs to type xml if its basic type is xml. +A type parameter of an xml-type-descriptor must be a subtype of +xml. A shape belongs to type xml<T> if all of +its constituent items belong to T. So, for example, +xml<xml:Element> is the type for xml values containing +only elements. Note that xml<xml<T>> is the +same as xml<T> and that +xml<xml:Text> is the same as xml:Text. +

+

+The name of an element is represented by a string. The attributes of an element +are represented by a value of type map<string>. The children +of an element is represented by a value of type xml. +

+

+Singleton element, processing instruction and comment values have storage +identity. Other xml values do not. +

+

+The xml:Text type is inherently immutable. This implies that both +text singletons and empty xml values always have their read-only bits on. The +xml:Element, xml:ProcessingInstruction and +xml:Comment types are selectively immutable. The read-only bit of a +xml value with length greater than one is on if and only if the read-only bit of +all its constituent items is on. The attributes and children of an element are +reachable from the element. Thus, if the read-only bit of an +xml:Element is on, then the read-only bits of the mapping +representing its attributes and of the xml value representing its children are +also on. +

+

+Note that although the mutable constituents of mutable xml value can be mutated, +the number and the storage identity of the constituents of a xml value are fixed +when the value is constructed. The storage identity of the attributes map of an +element are also fixed when the element is constructed. +

+
+
XML namespaces
+

+The name of an element or attribute, which in the XML Information Set is +represented by a combination of the [namespace name] and [local name] properties +of an element information item (EII) or attribute information item (AII), is +represented by a single expanded name string. If the [namespace name] +property has no value, then the expanded name consists of just the value of the +[local name] property; otherwise, the expanded name is of the form: +

+
+   {namespace-uri}local-name
+
+

+where namespace-uri and +local-name are the values of the [namespace name] and +[local name] properties respectively. +

+

+The attributes map for an element includes not only an entry for each AII in the +[attributes] property of the EII, but also an entry for each attribute in the +[namespace attributes] property. The key of the entry is the string representing +the name of the attribute, constructed from the AII item as described in the +previous paragraph. The name of every namespace attribute will thus start with +the string {http://www.w3.org/2000/xmlns/}. +

+

+The attributes map can also contain entries representing namespace attributes +synthesized from the [in-scope namespaces] property. There will be a synthesized +namespace attribute for every prefix other than xml that occurs as +a prefix of the EII or of an AII in the element's [attributes] property and for +which there is no declaration in the [namespace attributes] property. No +namespace attribute will be synthesized for the default namespace. (The +synthesized namespace attributes ensure that namespace prefixes will not be lost +if the element is extracted into a new context.) +

+

+An xml value can be converted to an XML information set for serialization. This +is done in the context of a set of namespace declarations that are in-scope from +the xml value's parent element, if any. The process of converting an xml element +singleton into an EII has the following stages. +

+
    +
  1. The [namespace name] and [local name] properties of the EII are determined +from the element's expanded name.
  2. +
  3. An AII is constructed for each entry in the element's attribute map, with +the [namespace name] and [local name] properties of the AII determined from the +entry's key, which is the attribute's expanded name. Each AII is added to either +the [attributes] or [namespace attributes] property of the EII depending on the +AII's [namespace name] property. The [prefix] property of each AII in the +[namespace attributes] property can also be set at this point.
  4. +
  5. The [namespace attributes] property of the EII is pruned by removing an +AII with [normalized value] N if the AII is not a default namespace declaration, +and the in-scope namespace declarations include a declaration with namespace +name N, and either the EII or one of the AIIs has a [namespace name] property +equal to N. (In this case, the entry for the namespace attribute would get +synthesized when the information set is converted to an xml value.)
  6. +
  7. For each AII in the EII's [attributes] property that has a [namespace name] +property, a [prefix] property is assigned. If the namespace name is +http://www.w3.org/XML/1998/namespace, then use a prefix of +xml. If there is already a namespace declaration in the [namespace +attributes] that declares a prefix with that namespace name, then that prefix is +used. Otherwise if there is a namespace declaration in the in-scope namespaces +that declares a prefix with that namespace and it is not redeclared or +undeclared by the [namespace attributes], then that prefix is used. Otherwise +generate a prefix and add an AII to the [namespace attributes] to declare +it.
  8. +
  9. If the EII has no [namespace name] property, but a default namespace +declaration is in scope, then an xmlns="" AII is added to the +[namespace attributes] property to undeclare the default namespace.
  10. +
  11. If the EII has a [namespace name] property N, then we need +to ensure that there is an applicable namespace declaration: +
      +
    1. if one of the [namespace attributes] declares N as the default namespace, +then nothing needs to be done;
    2. +
    3. similarly, if an in-scope namespace declaration declares N as the default +namespace, and the [namespace attributes] do not undeclare it, then nothing +needs to be done;
    4. +
    5. otherwise, try to find, in the same way as for an AII, a prefix P which is +already declared as N; if there is one, set the [prefix] property of the EII to +P;
    6. +
    7. otherwise, if the [namespace attributes] property does not contain a default +namespace declaration or undeclaration, generate a default namespace declaration +for N and add it to the [namespace attributes] property;
    8. +
    9. otherwise, generate a new prefix P, set the [prefix] property of the EII to +P, and add an AII to the [namespace attributes] to declare it.
    10. +
    +
  12. +
  13. Generate the [in-scope namespaces] property for this EII, using the parent's +in-scope namespaces and the [namespace attributes].
  14. +
  15. Convert the children of the xml element, including the element children, to +a list of information items, in the context of this EII's in-scope +namespaces.
  16. +
+ +
+ +
+ +
+
+

Structured values

+

+Structured values are containers for other values, which are called their +members. There are three basic types of structured value: list, mapping and +table. +

+

+Structured values are usually mutable. Mutating a structured value changes which +values it contains. Structured values can also be constructed as immutable. +Immutability is deep: immutable structured values cannot contain mutable +structured values; if the read-only bit of a structured value is on, then the +read-only bit of each of its members is on. +

+

+The shape of the members of a structured value contributes to the shape of the +structured value. A structured type descriptor describe the shape of the +structured value in terms of the shapes of its members. Mutating a member of a +structured value can cause the shape of the structured value to change. A +structured value has an inherent type, which is a type descriptor which is part +of the structured value's runtime value. At runtime, the structured value +prevents any mutation that might lead to the structured value having a shape +that is not a member of its inherent type. Thus a structured value belongs to a +type if and only if its inherent type is a subtype of that type. +

+

+The inherent type of an immutable structured value is a singleton type with the +structured value's shape as its single member. Thus, an immutable structured +value belongs to a type if and only if the type contains the shape of the value. +

+

+Every structured value has a length, which is the number of its members. +All structured values are iterable: the iteration sequence consists of the +members of the structure and the completion type is always nil. +

+

+A structured value provides random access to its members using a key that +uniquely identifies each member within the structure. A key can be out-of-line, +meaning it is independent of the member, or in-line, meaning it is part of the +member. The member type for a key type K in a structured type T +consists of all shapes v such that there is a shape in T with key in K and shape +v. A type K is an optional key type for T if there is a shape v in T +and a key k in K such that v does not have a member k; a type that is not an +optional key type is a required key type. +

+ +
structured-type-descriptor :=
+   list-type-descriptor
+   | mapping-type-descriptor
+   | table-type-descriptor
+
+

+The following table summarizes the type descriptors for structured types. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Structured typelistmappingtable
Key sourceout-of-lineout-of-linein-line
Key typeintegerstringanydata
Type descriptor with uniform member typearraymaptable
Type descriptor with separate member typestuplerecord-
+ +
+

Lists

+

+A list value is a container that keeps its members in an ordered list. The +number of members of the list is called the length of the list. The key +for a member of a list is the integer index representing its position in the +list, with the index of the first member being 0. For a list of length +n, the indices of the members of the list, from first to last, are +0,1,...,n - 1. The shape of a list value is an ordered list of the +shapes of its members. +

+

+A list is iterable: the iteration sequence consists of the members of the +list in order and the iteration completion value is always nil. +

+

+The type of list values can be described by two kinds of type descriptors. +

+ +
list-type-descriptor :=
+   array-type-descriptor | tuple-type-descriptor
+
+

+The inherent type of a list value must be a list-type-descriptor. +The inherent type of a list value determines a type Ti for a +member with index i. The runtime system will enforce a constraint that +a value written to index i will belong to type Ti. +Note that the constraint is not merely that the value looks like +Ti. +

+

+Both kinds of type descriptor are covariant in the types of their members. +

+
+
Array types
+

+An array type-descriptor describes a type of list value by specifying the type +that the value for all members must belong to, and optionally, a length. +

+ +
array-type-descriptor := array-member-type-descriptor inferable-array-dimension array-dimension*
+inferable-array-dimension := [ [ inferable-array-length ] ]
+array-dimension := [ [ array-length ] ]
+array-member-type-descriptor := type-descriptor but not array-type-descriptor
+inferable-array-length := array-length | inferred-array-length
+array-length := int-literal | constant-reference-expr
+inferred-array-length := *
+
+

+A type T[] contains a list shape if all members of the list shape +are in T. A type T[n] contains a list shape if in +addition the length of the list shape is n. +

+

+When an array-type-descriptor includes multiple +array dimensions, th array dimensions are interpreted +so that the order of the dimensions in the array-type-descriptor is +consistent with the order of the dimensions in a +member-access-expr. Specifically, a type +T[n1]...[nk - 1][nk] is +interpreted as (T[nk])[n1]...[nk - +1]. Thus, for a value v of type T[M][N], +a member-access-expr v[i][j] will evaluate to an value of type +T if and only if 0 ≤ iM +and 0 ≤ jN. An +array-type-descriptor is parsed to include all following +array-dimensions: an array-type-descriptor is not +recognized as array-member-type-descriptor. +

+

+A constant-reference-expr in an array-length must +evaluate to a non-negative integer. An array length of * means that +the length of the array is to be inferred from an initializer; this is allowed +when the array-type-descriptor specifies the type of variable for which an +initializer is specified, i.e. in a local-init-var-decl-stmt, a +module-init-var-decl or a module-const-decl; its +meaning is the same as if the length was specified explicitly. +

+

+Note also that T[n] is a subtype of T[], and that if +S is a subtype of T, then S[] is a +subtype of T[]; this is a consequence of the definition of +subtyping in terms of subset inclusion of the corresponding sets of shapes. +

+

+The type of the values in the iteration sequence of a value belonging +T[] is T. +

+
+
+
Tuple types
+

+A tuple type descriptor describes a type of list value by specifying a separate +type for each member of the list. +

+ +
tuple-type-descriptor :=
+   [ tuple-member-type-descriptors ]
+tuple-member-type-descriptors :=
+   member-type-descriptor (, member-type-descriptor)* [, tuple-rest-descriptor]
+   | [ tuple-rest-descriptor ]
+member-type-descriptor := [annots] type-descriptor
+tuple-rest-descriptor := type-descriptor ...
+
+
+

+A tuple type descriptor T with m member type descriptors contains a list shape L +of length n if and only if: +

+
    +
  • m is less than or equal to n
  • +
  • the i-th member type descriptor of T contains the i-th member of L for each +i from 1 to m;
  • +
  • if n is greater than m, then T has a tuple-rest-descriptor +R..., and R contains the j-th member of L for each j from m + 1 to +n.
  • +
+

+Note that a tuple type where all the member-type-descriptors are +the same and there is no tuple-rest-descriptor is equivalent to an +array-type-descriptor with a length. +

+
+
+
+

Mappings

+

+A mapping value is a container where each member has a key, which is a string, +that uniquely identifies within the mapping. We use the term field to +mean the member together its key; the name of the field is the key, and the +value of the field is that value of the member; no two fields in a mapping value +can have the same name. +

+

+The shape of a mapping value is an unordered collection of field shapes one for +each field. The field shape for a field f has a name, which is the same as the +name of f, and a shape, which is the shape of the value of f. +

+

+Each field also has a read-only bit. This is in addition to the read-only bit of +the mapping value. If a mapping value's field has its read-only bit on, then +that field cannot be assigned to nor removed. If the mapping value's read-only +bit is on, then the read-only bit of every field is also on. A field's read-only +bit is fixed when the mapping value is constructed, and cannot be changed +thereafter. If a field's read-only bit is on, the read-only bit of the value of +the field is also on. The read-only bit of a field is part of the read-only +aspect of the mapping value's shape. +

+

+The type of mapping values can be described by two kinds of type descriptors. +

+ +
mapping-type-descriptor :=
+   map-type-descriptor | record-type-descriptor
+
+

+The inherent type of a mapping value must be a +mapping-type-descriptor. The inherent type of a mapping value +determines a type Tf for the value of the field with name +f. The runtime system will enforce a constraint that a value written to +field f will belong to type Tf. Note that the +constraint is not merely that the value looks like Tf. +

+

+Both kinds of type descriptor are covariant in the types of their members. +

+

+A mapping value is iterable: the iteration sequence consists of the members of +the mapping value and the iteration completion value is always nil. When the +inherent type of a mapping value is equivalent to a +map-type-descriptor, the order of iteration must correspond to the +order in which fields were added. In other cases, the order of the iteration +sequence is implementation-dependent. +

+ +
+
Map types
+

+A map type-descriptor describes a type of mapping value by specifying the type +that the value for all fields must belong to. +

+ +
map-type-descriptor := map type-parameter
+
+

+A type map<T> contains a mapping shape m if every field +shape in m has a value shape that is in T. +

+

+The type of the values in the iteration sequence of a value belonging +map<T> is T. +

+

+If a type descriptor T has lax static typing, +then the type map<T> also has lax static typing. +

+
+
+
Record types
+

+A record type descriptor describes a type of mapping value by specifying a type +separately for the value of each field. +

+ +
record-type-descriptor :=
+   inclusive-record-type-descriptor | exclusive-record-type-descriptor
+inclusive-record-type-descriptor :=
+   record { field-descriptor* }
+exclusive-record-type-descriptor :=
+   record {| field-descriptor* [record-rest-descriptor] |}
+field-descriptor :=
+   individual-field-descriptor | record-type-inclusion
+individual-field-descriptor :=
+   metadata [readonly] type-descriptor field-name [? | (= default-expression)] ;
+field-name := identifier
+default-expression := expression
+record-type-inclusion := * type-reference ;
+record-rest-descriptor := type-descriptor ... ;
+
+

+Each individual-field-descriptor specifies an additional constraint +that a mapping value shape must satisfy for it to be a member of the described +type. The constraint depends on whether ? is present: +

+
    +
  • if ? is not present, then the constraint is that the mapping +value shape must have a field shape with the specified field-name and with a +value shape that is a member of the specified type-descriptor; this is called a +required field;
  • +
  • if ? is present, then the constraint is that if the mapping +value shape has a field shape with the specified field-name, then its value +shape must be a member of the specified type-descriptor; this is called an +optional field.
  • +
+

+If an individual-field-descriptor specifies readonly, +then there is also a constraint that the field has its read-only bit set. +Furthermore, the type of the field is the intersection of readonly +and the type specified by the type-descriptor. +

+

+The order of the individual-field-descriptors within a +record-type-descriptor is not significant. Note that the delimited +identifier syntax allows the field name to be any non-empty string. +

+

+An exclusive-record-type-descriptor, which uses the {| and +|} delimiters, allows exclusively the fields described. More +precisely, for a mapping value shape and a record-type-descriptor, let the extra +field shapes be the field shapes of the mapping value shapes whose names are not +the same as field-name of any individual-field-descriptor; a mapping value shape +is a member of the type described by an exclusive-record-type-descriptor only if +either: +

+
    +
  • there are no extra fields shapes, or
  • +
  • there is a record-rest-descriptor T..., and the value shape of +every extra field shape is a member of T.
  • +
+

+An inclusive-record-type-descriptor, which uses the { and +} delimiters, allows any mapping value that includes the fields +described, provided that the values of all other fields are plain data. A type +descriptor record { F }; is thus equivalent to record {| F; +anydata...; |}, where anydata is defined below as the type descriptor for plain data. +

+

+A record type descriptor that either is an inclusive-record-type-descriptor or +is an exclusive-record-type-descriptor with a record-rest-descriptor is called +open; a record type descriptor that is not open is called +closed. +

+

+If a record type descriptor is closed and every individual-field-descriptor +specifies readonly, then it describes a type that is a subtype of +readonly: a shape belongs to the type only if its read-only bit is +set. +

+

+A default-expression is an expression that specifies a default +value for the field, which is used when the record type descriptor is used to +construct a mapping value but no value is specified explicitly for the field. +The type descriptor contains a 0-argument function closure for each default +value. The closure is created from the expression when the type descriptor is +resolved. The expression must meet the requirements for an isolated function. The closure is evaluated to +create a field value each time the default is used in the construction of a +mapping value. The default value does not affect the type described by the type +descriptor. It is a compile-time error if a default-expression +contains a checking-expr with a checking-keyword of check, +i.e. if evaluation of the expression could complete abruptly with a check-fail. +

+

+A record-type-inclusion includes fields from a named record type. +The type-reference must reference a type described by a +record-type-descriptor. The field-descriptors and any +record-rest-descriptor are included the type being defined; the +meaning is the same as if they had been specified explicitly. For default +values, the closure rather than the expression is copied in. +It is an error for an record-type-descriptor to directly or +indirectly include itself. An individual-field-descriptor in a +record-type-descriptor can override an +individual-field-descriptor of the same name in an included +record-type-descriptor, provided the type declared for the field in +the overriding field descriptor is a subtype of the type declared in the +overridden field descriptor. It is an error if a +record-type-descriptor has two or more +record-type-inclusions that include an +individual-field-descriptor with the same name, unless those +individual-field-descriptors are overridden by an +individual-field-descriptor in the including +record-type-descriptor. A record-rest-descriptor in +the including type overrides any record-rest-descriptor in the +included type. It is an error if a record-type-descriptor has two +or more record-type-inclusions that include different +record-rest-descriptors, unless those +record-rest-descriptors are overridden by an +record-rest-descriptor in the including +record-type-descriptor. For the purposes of +resolving a record-type-inclusion, an including or included type +that is an inclusive-record-type-descriptor is treated as if it +were the equivalent exclusive-record-type-descriptor with an +explicit record-rest-descriptor. +

+
+
+
+

Tables

+

+A table is a structural value, whose members are mapping values. A table +provides access to its members using a key that comes from the read-only fields +of the member. It keeps its members in order, but does not provide random access +to a member using its position in this order. +

+

+Every table value has, in addition to its members, a key sequence, which is used +to provide keyed access to its members. The key sequence is an ordered sequence +of field names. The key sequence of a table is fixed when a table is +constructed and cannot be changed thereafter. For each field name in the key +sequence, every member of the table must have a read-only field with that name +and the value of the field must be acyclic plain data. A table's key sequence +determines a key value for each member of the table: if the key sequence +consists of a single field name f, then the key value of a member is that value +of field f of that member. If the key sequence consists of multiple field names +f1,f2,...,fn where n is ≥ 2, then the +key value for a member r is a tuple with members +v1,v2,...,vn where vi is the value +of field fi of r. A table constrains its membership so that a key +value uniquely identifies a member within the table. More precisely, for every +two rows ri and rj in a table with i not equal to j, the +key value for ri must not be equal to the key value for +rj. Key values are compared for equality using the DeepEquals abstract operation. This constraint is +enforced by the table both when the table is constructed and when the table is +mutated. As a special case, a table's key sequence may be empty; this represents +a keyless table, whose members are not uniquely identified by a key. +

+

+The shape of a table value is a triple consisting of +

+
    +
  • an ordered list containing for each table member, the shape of that member
  • +
  • the table's key sequence, and
  • +
  • a set containing for each table member, the shape of the key value of that +member (derived from the table members and the key sequence)
  • +
+ +
table-type-descriptor := table row-type-parameter [key-constraint]
+row-type-parameter := type-parameter
+key-constraint := key-specifier | key-type-constraint
+key-specifier := key ( [ field-name (, field-name)* ] )
+key-type-constraint := key type-parameter
+
+

+The row-type-parameter specifies the shape of the table's members. A table type +table<R> KC contains a table shape if +and only if every table member shape belongs to R and +the table shape satisfies the key constraint KC. The +type specified by a row-type-parameter must be a subtype of +map<any|error> +

+

+In a table-type-descriptor table<R> +key(ks), R and +ks must be consistent in the following sense: for each +field name fi in ks, fi must be a +required, read-only field of R with a type that is a +subtype of anydata. A table shape satisfies a key-constraint +key(ks) if and only if its key sequence is +ks. A table shape satisfies a key-constraint +key<K> if and and only if its set of key value shapes are a +subset of K. The shape of a keyless table satisfies the +key-constraint key<never>. +

+

+As with other structured values, a table value has an inherent type. The +inherent type of a table value must be a table-type-descriptor with a +key-constraint that is a key-specifier. +

+

+A table is iterable: the iteration sequence consists of the members of the +table in order and the iteration completion value is always nil. +

+ +
+
+
+

Behavioral values

+ +
behavioral-type-descriptor :=
+   error-type-descriptor
+   | function-type-descriptor
+   | object-type-descriptor
+   | future-type-descriptor
+   | typedesc-type-descriptor
+   | handle-type-descriptor
+   | stream-type-descriptor
+
+ +
+

Errors

+ +
error-type-descriptor := error [type-parameter]
+
+

+An error value provides information about an error that has occurred. Error +values belong to a separate basic type; this makes it possible for language +constructs to handle errors differently from other values. +

+

+The error type is inherently immutable. An error value contains the following +information: +

+
    +
  • a message, which is a string containing a human-readable message describing +the error
  • +
  • a cause, which is either nil or another error value that was the cause of +this error
  • +
  • a detail, which is an immutable mapping providing additional information about +the error
  • +
  • a stack trace, which is an immutable snapshot of the state of the execution +stack
  • +
+

+The detail mapping must be a subtype of map<Cloneable>. +

+

+The shapes of the message, cause and detail record are part of the shape of the +error; the stack trace is not part of the shape. A type descriptor +error<T> contains an error shape if +T contains the shape of its detail. The type +error contains a shape if its basic type is error. +

+

+An error-type-descriptor is always definite and induces an empty set of +type-ids. An intersection type can be used to describe an error type that induces +a non-empty set of type-ids. +

+
+ +
+

Functions

+ +
function-type-descriptor :=
+   function-quals function function-signature
+   | [isolated-qual] function
+function-quals :=
+   transactional-qual [isolated-qual]
+   | [isolated-qual] [transactional-qual]
+isolated-qual := isolated
+transactional-qual := transactional
+function-signature := ( param-list ) return-type-descriptor
+
+

+A function is a part of a program that can be explicitly executed. In Ballerina, +a function is also a value, implying that it can be stored in variables, and +passed to or returned from functions. When a function is executed, it is passed +an argument list as input and returns a value as output. +

+ +
param-list :=
+   required-params [, defaultable-params] [, included-record-params] [, rest-param]
+   | defaultable-params [, included-record-params] [, rest-param]
+   | included-record-params [, rest-param]
+   | [rest-param]
+required-params := required-param (, required-param)*
+required-param := [annots] type-descriptor [param-name]
+defaultable-params := defaultable-param (, defaultable-param)*
+defaultable-param := [annots] type-descriptor [param-name] = (default-expression | inferred-typedesc-default) 
+included-record-params := included-record-param (, included-record-param)*
+included-record-param := [annots] * type-reference [param-name]
+rest-param := [annots] type-descriptor ... [param-name]
+param-name := identifier
+inferred-typedesc-default := < >
+
+

+A param-name can be omitted from a required-param, defaultable-param, +included-record-param or rest-param only when occuring in the function-signature +of a function-type-descriptor. The type-descriptor in a required-param or +defaultable-param must not be never. +

+

+The argument list passed to a function consists of zero or more arguments in order; +each argument is a value, but the argument list itself is not passed as a value. +The argument list must conform to the param-list as described in this section. +Usually, the compiler's type checking will ensure that this is the case; if not, +the function will panic. +

+

+It is convenient to consider the complete param-list as having a type. This type +is described by a tuple-type-descriptor that has a member-type-descriptor for +each required-param, defaultable-param and included-record-param, and has a +tuple-rest-descriptor if and only if there is a rest-param. The i-th +member-type-descriptor of the tuple type descriptor is the same as the +type-descriptor of the i-th member of the param-list; for an +included-record-param, the type-descriptor is the type-reference; the +type-descriptor of the tuple-rest-descriptor, if present, is the same as the +type-descriptor of the rest-param. +

+

+An argument list consisting of values v1,..., vn conforms +to a param-list that has type P, if and only if for each i with 1 ≤ i ≤ +n, vi belongs to Ti, where Ti is defined to be the type +that contains a shape s if and only if P contains a list shape whose i-th member +is s. +

+

+A defaultable-param is a parameter for which a default value is specified. An +expression can be used to specify the default value; this expression may refer +to previous parameters. Each such expression is turned into a closure that +computes the default value for the parameter using the values of previous +parameters, and this closure is part of the type descriptor for the function. It +is also possible for the default to be specified as <>; this +means that the default value is a typedesc value that is to be +inferred by the caller from the contextually expected type of the function call. +It is allowed only when the parameter name to which the default value applies is +referenced in the return-type-descriptor, as described below, and is allowed for +at most one parameter in a function. The caller of the function uses the +function's type descriptor to compute default values for any defaultable +arguments that were not specified explicitly. These default values are included +in the argument list passed to the function. Whether a parameter is defaultable, +and what its default is, do not affect the shape of the function and thus do not +affect typing. The closures computing the defaultable parameters are created +when the type descriptor is resolved; the default value is computed by calling +the closure each time the function is called and the corresponding parameter is +not specified. Whether a parameter is defaultable is used at compile time, but +the closure that computes the default value is only used at runtime. If the +function-type-descriptor includes an isolated-qual, then an expression used as a +default-expression must meet the requirements for an isolated function. +

+

+The name of each parameter is included in the function's type descriptor. A +caller of the function may specify the name of the parameter that an argument is +supplying. In this case, the caller uses the parameter name at compile time in +conjunction with the type descriptor to create the argument list. The +parameter names do not affect the shape of the function and thus do not affect +typing. +

+

+The type-reference in an included-record-param must refer to a type defined by a +record-type-descriptor. Specifying an included-record-param *T +p is similar to specifying a required-param T +p. The difference is that the caller of the function may +specify the value for a field of an included-record-param using the field's name +as if it had been declared as a parameter. Any field of the +included-record-param not so specified is defaulted using the +record-type-descriptor. A field-descriptor is a parameter field +descriptor of a function if it is a field descriptor of a +record-type-descriptor referenced by an included-record-param of the function. +The field names of all the parameter field descriptors whose type is not +never must be distinct from each other and from the names of the +parameters. Whether a parameter is an included-record-param is part of the +function's type-descriptor, but does not affect the shape of the function and +thus does not affect whether a function value belongs to a function type. +

+

+The process by which the function caller creates an argument list, which may +make use of arguments specified both by position and by name, is described in +more detail in the section on function calls. +

+
return-type-descriptor := [ returns [annots] type-descriptor ]
+
+

+When the execution of a function returns to its caller, it returns exactly one +value. A function that would in other programming languages not return a value +is represented in Ballerina by a function returning (). Note that +the function definition does not have to explicitly return (); a +return statement or falling off the end of the function body will implicitly +return (). +

+

+The value returned by a function will belong to the type specified in the +return-type-descriptor. An empty return-type-descriptor is equivalent to +returns (). The type-descriptor in a return-type-descriptor may be +never. +

+

+A return-type-descriptor may be depend on the param-list in the following way. A +type-reference occurring in a return-type-descriptor can refer to a parameter +name if the type of the parameter is a subtype of typedesc. If p is +such a parameter, then a reference to p in the return-type-descriptor denotes +the type that is the value of p. If the default value for p is +<> and p occurs in the return-type-descriptor in a union p|T, +then for every basic type B, either the intersection of B and T must be empty, +or the intersection of typedesc<B> and the declared type of p must be +empty, or both. The return-type-descriptor thus denotes a +distinct set of shapes for each invocation of the function. A function-signature +with a return-type-descriptor that uses a type-reference to refer to a parameter +name in this way is said to be dependently-typed. Functions with +dependently-types signatures can be declared and used within Ballerina, but +Ballerina does not yet provide a mechanism to define such functions. +

+

+Function types are covariant in their return types and contravariant in the type +of their parameter lists. More precisely, a function type with return type R and +parameter list type P is a subtype of a function type with return type R' and +parameter list type P' if and only if R is a subtype of R' and P' is a subtype +of P. A function value f belongs to a function type T if the declared type of f +is a subtype of T. +

+

+If a function-type-descriptor includes an isolated-qual, then a +function value belongs to the type only if the value's isolated bit is set; if +the function type does not include an isolated-qual, then whether a +function value belongs to the type is not affected by the value's isolated bit. +

+

+All function values belongs to a function-type-descriptor function; +a function value belongs to the function-type-descriptor isolated +function if and only if it is an isolated function. +

+

+In addition to a readonly bit and an isolated bit, a function value also has a +transactional bit. A function value with its transactional bit set can only be +called in a transactional scope; this is enforced by +the type system. A function value with its transactional bit not set belongs to +the type described by a function-type-descriptor with a function-signature only +if the function-type-descriptor does not include a transactional +qualifier. This means that a function-type-descriptor with a function-signature +but without a transactional qualifier is a subtype of the +corresponding function-type-descriptor with a transactional +qualifier. Note that the subtyping relationship for transactional +is in the opposite direction from isolated. A function value's +transactional bit does not affect whether it belongs to the type described by a +function-type-descriptor without a function-signature. +

+
+
+

Objects

+

+An object value encapsulates data with functions that operate on the data. An +object consists of named members, where each member is either a field or a +method. A field of an object stores a value. A method of an object is a function +that can be invoked on the object using a method-call-expr; when a +method is invoked on an object, the function can access the object using the +self variable. An object's methods are associated with the object +when the object is constructed and cannot be changed thereafter. Fields and +methods have names that uniquely identify them within their object; fields and +methods share a single symbol space; it is not possible for an object to have a +field and a method with the same name. +

+

+The type of object values can be described using an +object-type-descriptor, as specified in this section. It can also +be described using a class. A class both describes an object type and +provides a way to construct an object belonging to the type; in particular, it +provides the method definitions that are associated with the object when it is +constructed. A class is defined using a module-level class definition. +

+

+The object basic type is selectively immutable. An object value has a read-only +bit, which is fixed when the object is constructed. An +object-type-descriptor does not describe whether the object's +read-only bit is set: whether a value belongs to the type described by an +object-type-descriptor is not affected by the object's read-only +bit. Whether an object is read-only can be described separately using a +readonly type descriptor, which can be combined with an +object-type-descriptor using the type intersection operator. +

+ +
object-type-descriptor :=
+   object-type-quals object {
+      object-member-descriptor*
+   }
+object-type-quals :=
+   isolated-qual [object-network-qual]
+   | [object-network-qual [isolated-qual]]
+object-member-descriptor :=
+   object-field-descriptor
+   | method-decl
+   | remote-method-decl
+   | resource-method-decl
+   | object-type-inclusion
+
+ +

+If an isolated-qual is specified, then an object belongs to the described type +only if the object's isolated bit is set. If an isolated-qual is not specified, +then an object's isolated bit does not affect whether it belongs to the +described type. +

+ +
+
Network interaction
+

+Objects are the basis for Ballerina's network interaction primitives. There are +two special kinds of object for network interaction: client objects and service +objects. A client object supports network interaction with a remote system that +is originated by the Ballerina program. A service object supports network +interaction with a remote system that is originated by the remote system. An +object may be a client object or a service object or neither; it cannot be both +a client object and a service object. An object that is a client object or a +service object is a network interaction object. +

+ +
object-network-qual := client | service
+
+ +

+If the object-network-qual is client, then an object +belongs to the type only if it is a client object. If the +object-network-qual is service, then an object belongs +to the type only if it is a service object. If object-network-qual +is not present, then an object belongs to the type regardless of whether it is a +client object or service object or neither. A object-network-qual +is not allowed in conjunction with public. +

+ +

+Network interaction objects can have, in addition to fields and methods, two +additional kinds of member: remote methods and resources; both of these are in a +different symbol space from fields and (non-remote) methods. +

+ +
+ +
+
Fields
+ +
object-field-descriptor :=
+   metadata [public] type-descriptor field-name ;
+
+

+An object-field-descriptor describes a field of the object. The +field-name of an object-field-descriptor must be +distinct from the field-name of every other +object-field-descriptor in the object-type-descriptor +and from the method-name of every method-decl in the +object-type-descriptor. +

+

+If an object's read-only bit is set, then the read-only bit of the value of +every field must also be set and the value of a field cannot be changed after +the object has been constructed. +

+
+ +
+
Methods
+ +
method-decl :=
+   metadata [public] method-quals
+   function method-name function-signature ;
+method-quals := function-quals
+method-name := identifier | special-method-name
+special-method-name := map | join | start
+
+

+A method-decl describes a method of the object. The +method-name of a method-decl must be distinct from the +method-name of every other method-decl in the +object-type-descriptor and from the field-name of +every object-field-descriptor in the +object-type-descriptor. Note that here is no method overloading. +The method-name in a method-decl must not be +init. The identifiers map, join and +start, which are usually reserved keywords, are allowed as method +names. +

+ +

+The isolated-qual together with the function-signature +give the function type of the method. An isolated method has the same access to +the object on which the method is invoked that it has to parameters. +

+
+ +
+
Remote methods
+
remote-method-decl :=
+   metadata remote-method-quals 
+   function remote-method-name function-signature ;
+remote-method-quals :=
+   remote-qual function-quals
+   | isolated-qual [transactional-qual] remote-qual
+   | transactional-qual [isolated-qual] remote-qual
+   | isolated-qual remote-qual transactional-qual
+   | transactional-qual remote-qual isolated-qual
+remote-qual := remote
+remote-method-name := identifier
+
+

+A remote-method-decl declares a remote method. An object can +include a remote-method-decl only if it is a network interaction +object. A remote method is a method for network interaction: a remote method of +a client object is for outbound network interaction; a remote method of a +service object is for inbound network interaction. The remote-method-name +of a remote-method-decl must be distinct from the +remote-method-name of every other remote-method-decl in the +object-type-descriptor. However, a method-decl and a +remote-method-decl can have the same name. A remote method cannot +be called using the normal method call syntax. A remote method of a client +object can only be invoked by a client-remote-method-call-action. +The return type of the remote method of a client object must not be +never. A remote method of a service object is invoked by a listener +object provided by a library module; Ballerina does not yet define a mechanism +to allow such a library module to be implemented completely in Ballerina. +

+ +
+ +
+
Resources
+ +
resource-method-decl :=
+   metadata resource-method-quals
+   function resource-method-name resource-path function-signature ;
+resource-method-quals :=
+   resource-qual function-quals
+   | isolated-qual [transactional-qual] resource-qual
+   | transactional-qual [isolated-qual] resource-qual
+   | isolated-qual resource-qual transactional-qual
+   | transactional-qual resource-qual isolated-qual
+resource-qual := resource
+resource-method-name := identifier
+resource-path :=
+   dot-resource-path
+   | resource-path-segment (/ resource-path-segment)* [/ resource-path-rest-param]
+   | resource-path-rest-param
+dot-resource-path := .
+resource-path-segment := resource-path-segment-name | resource-path-segment-param
+resource-path-segment-name := identifier
+resource-path-segment-param := [[annots] type-descriptor [param-name]]
+resource-path-rest-param := [[annots] type-descriptor ... [param-name]]
+
+

+As well as remote methods, a network interaction object may include members that +are resources. Resources support a more data-oriented style of network +interaction, which complements the RPC style supported by remote methods. A +resource of a client object is for outbound network interaction; a resource of a +service object is for inbound network interaction. A resource of a client object +can be accessed only using a client-resource-access-action. A +resource of a service object is accessed by a listener object provided by a +library module; Ballerina does not yet define a mechanism to allow such a +library module to be implemented completely in Ballerina. +

+

+Each resource is named within an object by a resource path, which +consists of a list of resource path segments. A resource path segment is most +commonly a string, but can be any value of type anydata. A resource has one or +more named methods. A resource method is thus uniquely identified within its +object by its path and method name. Each resource method corresponds to a way +that the resource can be accessed; the name get should be used for +a resource method that just fetches the resource. For a service object, the +supported resource method names are determined by the listener; a listener that +supports resources should always support the name get. +

+

+A resource-method-decl declares a resource method for one or more +resources. An object can include a resource-method-decl only if it +is a network interaction object. +

+

+A resource-path can be mapped onto a tuple type descriptor as +follows. A dot-resource-path maps to [] (an empty +tuple type). A resource-path-segment-name maps to a member type +descriptor that is a singleton string. A +resource-path-segment-param with type descriptor T +maps to a member type descriptor T. A +resource-path-rest-param with type descriptor T maps +to a tuple rest descriptor T.... +

+

+It is a compile error if a object-type-descriptor has two +resource-method-decls with the same name and with +resource-paths that map to the same tuple type descriptor. +

+

+When a resource with path [s1,...,sm] of a service object +S has a method get with a return value that includes a service +object type, then this has the semantics that the service object S delegates +each resource with a path [s1,...,sm,...,sn] to +a resource [sm+1,...,sn] of the service object returned by +the get method of S. Accordingly, if the return type of a +resource-method-decl with a method name of get and a +resource-path p includes a service object type: +

+
    +
  • the return type must not allow anything other than service objects and +errors;
  • +
  • the resource-path must not end with a +resource-path-rest-param;
  • +
  • there must be no resource-method-decl that has a +resource-path with p as a prefix.
  • +
+

+The set of resource method names applicable for a +resource-method-decl with resource-method-name m at a +resource path position is defined as follows: +

+
    +
  • if the position is not the last position of the resource path, then the +applicable set consists of just get
  • +
  • otherwise, if the resource-path ends with a resource-path-segment, +then the applicable set consists of just m;
  • +
  • otherwise, the resource-path ends with +resource-path-rest-param and the applicable set consists of +get and m.
  • +
+

+Two resource-method-decls X and Y that map to tuple type descriptors +[X1,...,Xm] and [Y1,...,Yn] +diverge at position i if and only if: +

+
    +
  • i ≤ m;
  • +
  • i ≤ n;
  • +
  • the intersection of the sets of resource method names applicable for X and Y +at position i is non-empty;
  • +
  • for all j < i, Xj is the same type as as Yj;
  • +
  • Xi and Yi are not the same (to be the same, they must +both be a member-type-descriptor or both be a tuple-rest-descriptor, and the +types must be the same).
  • +
+

+If two resource-method-decls diverge at position i, then it is a +compile-time error unless the resource-path of at least one of them +maps to a tuple type descriptor that at position i has a +member-type-descriptor that denotes a singleton string. +

+

+A resource-path-segment that maps to a singleton string takes +priority over other types in the following sense. When a +resource-method-decl R has a resource path that has a +resource-path-segment at position i that maps to a +member-type-descriptor that denotes a type T that is not a +singleton string, then T is narrowed to a type T' by removing every singleton +string type S such that there is a resource-method-decl that +diverges from R at position i and has has a resource path that has a +resource-path-segment at position i that maps to a +member-type-descriptor that denotes S. The +resource-method-decl declares resources methods for resources that +whose corresponding path segment belongs to the narrowed type T' rather than T. +

+

+The return type of a resource method must not allow values belonging to the +function basic type and must not allow client object types. +

+ +
+ +
+
Visibility
+

+Each field and method of an object has a visibility region, which is +the region of code within which the field or method is visible and can be +accessed. The visibility region of a remote-method-decl or of +object-field-descriptor or method-decl that includes +public consists of all the modules of the program. Otherwise the +visibility region is the module containing this object type descriptor; this is +called module-level visibility. +

+
+
+
Typing
+ +

+The shape of an object consists of a read-only bit, an isolated bit, a network +interaction kind and an unordered collection of object field shapes and object +method shapes. A network interaction kind has one of three values: service, +client or empty. An object field shape or object method shape is a 4-tuple +consisting of the name of the field or method, the visibility region, a remote +flag and a shape for the value of the field or for the method's function. +

+

+An object type is inclusive, in a similar way to an +inclusive-record-type-descriptor: an object shape belongs to an object type if +it has at least the fields and methods described in the object-type-descriptor. +Thus all object values belong to the type object { }. +

+

+An object-type-descriptor that has a field with name f, visibility region R and +type T contains an object shape only if the object shape contains an object +field shape that has name f, visibility region R and a value shape that is +contained in T. An object-type-descriptor that has a method with name m, +visibility region R, remote qualifier r and function type T contains an object +shape only if the object shape contains an object method shape that has name m, +visibility region R, a remote flag that matches r and a function value that +belongs to type T. +

+

+Thus an object type T' is a subtype of an object type T only if for each field +or method f of T there is a corresponding field or method f' of T such that the +type of f' in T' is a subtype of the type of f in T and the visibility region of +f' in T' is the same as the visibility region of f in T. This implies that if an +object type descriptor T has fields or methods with module-level visibility, +then it is possible to define another object type descriptor that is a subtype +of T only within the same module as T. +

+ +
+
+
Inclusion and type-ids
+ +
object-type-inclusion := * type-reference ;
+
+

+Every type descriptor referenced directly or indirectly by a +type-reference in an object-type-inclusion must be an +object-type-descriptor, distinct-type-descriptor, +intersection-type-descriptor or +a class that has no private members and no readonly qualifier; the +referenced type descriptor will thus necessarily be definite and a subtype of +object. If a referenced object-type-descriptor or class has an +isolated, service or client qualifier +Q, then the referencing object-type-descriptor must also have the +qualifier Q. The object-field-descriptors and +method-decls from the referenced type are included in the type +being defined. A type-reference to a class is treated as a reference to the +class's type; only the types of the methods and fields are copied from the +referenced type. An object-field-descriptor or +method-decl in a object-type-descriptor can override +respectively an object-field-descriptor or method-decl +of the same name in an included object-type-descriptor, provided +the type declared for the field or method in the overriding descriptor is a +subtype of the type declared in the overridden descriptor. An +object-field-descriptor cannot override a method-decl, +nor can a method-decl override an +object-field-descriptor. It is an error if an +object-type-descriptor has two or more +object-type-inclusions that include an +object-field-descriptor with the same name, unless those +object-field-descriptors are overridden by an +object-field-descriptor in the including +object-type-descriptor. It is an error if an +object-type-descriptor has two or more +object-type-inclusions that include method-decls with +the same name but different function-signatures, unless those +method-decls are overridden by a method-decl in the +including object-type-descriptor. +

+

+An object-type-descriptor is always definite. The set of type-ids induced by an +object-type-descriptor is the union of the set of type-ids induced by the type +descriptors that it includes. An induced type-id is primary in an +object-type-descriptor if and only if it is primary in any of the included type +descriptors. It is an error if the induced set of type-ids includes a non-public +type-id from another module. +

+

+It is an error for an object-type-descriptor to directly or +indirectly include itself. +

+
+
+
+

Futures

+ +
future-type-descriptor := future [type-parameter]
+
+

+A future value refers to a named worker, which will return a value. A future +value belongs to a type future<T> if the return type of the +named worker is a subtype of T. +

+

+A value belongs to a type future (without the type-parameter) +if it has basic type future. +

+
+
+

Type descriptors

+
typedesc-type-descriptor := typedesc [type-parameter]
+
+

+A type descriptor value is an immutable value representing a resolved type +descriptor. The type typedesc contains all values with basic type typedesc. A +typedesc value t belongs to a type typedesc<T> if +and only if the type described by t is a subtype of T. +The typedesc type is thus covariant with its type parameter. +

+

+Referencing an identifier defined by a type definition in an expression context +will result in a type descriptor value. +

+ +
+
+

Handles

+
handle-type-descriptor := handle
+
+

+A handle value is a reference to storage managed externally to a Ballerina +program. Handle values are useful only in conjunction with functions that have +external function bodies; in particular, a new handle value can be created only +by a function with an external function body. Handle values are inherently +immutable. +

+

+A value belongs to a type handle if it has a basic type of handle. +

+ +
+ +
+

Streams

+ +
stream-type-descriptor := stream [stream-type-parameters]
+stream-type-parameters := < type-descriptor [, type-descriptor]>
+
+

+A stream is an object-like value that can generate a sequence of values. There +is also a value associated with the completion of the generation of the +sequence, which is either nil, indicating the generation of the sequence completed +successfully, or an error. A stream belongs to type +stream<T,C> if the values in the generated sequence all +belong to T and if the completion value belongs to C. The type +stream<T> is equivalent to stream<T,()>. A +value belongs to a type stream (without the type-parameter) if it +has basic type stream. A type stream<T,C> where C does not +include nil describes an unbounded stream. +

+

+A stream supports two primitive operations: a next operation and a close +operation. The next operation has the same semantics as the next method on the +Iterator object type. The close operation informs the stream that there will be +no more next operations and thus allows the stream to release resources used by +the stream; the close operation on a stream<T,C> has a result +of type C?, where nil means that the close operation was +successful. The close operation is idempotent: performing the close operation on +a stream on which the close operation has already been performed has no effect. +When the generation of the sequence is complete, the stream automatically +performs the close operation to release resources used by the stream. +

+

+The type descriptor stream<T,C> works like a class, in that +it can be used with new to construct stream values that belong to +the type. The normal implementation of a stream<T,C> is a +wrapper around an object belonging to object type +StreamImplementor<T,C>. The next and close operations on +the stream delegate to the next and close methods on the StreamImplementor. +

+

+The stream module of the lang library provides +additional operations on stream that can be implemented in terms of the +primitive next and close operations. +

+

+A stream is iterable. A stream of type stream<T,C> has value +type T and completion type C. Calling the next method +on the iterator created for an iteration has the same effect as performing the +next operation on the stream. The stream does not keep a copy of the sequence of +values returned by the next operation. Any subsequent iteration operation on the +same stream will not generate further values, so the iteration sequence for +iterations other than the first will be the empty sequence. +

+

+Note that in this version of Ballerina the stream type is not a class because +Ballerina does not yet support parameterized classes. +

+
+ +
+
+

Other type descriptors

+ +
other-type-descriptor :=
+   | type-reference
+   | singleton-type-descriptor
+   | any-type-descriptor
+   | never-type-descriptor
+   | readonly-type-descriptor
+   | distinct-type-descriptor
+   | union-type-descriptor
+   | intersection-type-descriptor
+   | optional-type-descriptor
+   | anydata-type-descriptor
+   | json-type-descriptor
+   | byte-type-descriptor
+   | ( type-descriptor )
+
+

+It is important to understand that the type descriptors specified in this +section do not add to the universe of values. They are just adding new ways to +describe subsets of this universe. +

+
+

Type reference

+
type-reference := identifier | qualified-identifier
+
+ +

+A type descriptor can use a type-reference to refer to a type definition in the +same module or another module. +

+

+A type-reference referring to a type descriptor T is definite if and +only if T. If it is, the type-ids induced by are the same as those +induced by T and a type-id is primary in t if and only if +it is primary in T. It is an error if the induced set of type-ids +includes a non-public type-id from another module. +

+ +
+
+

Singleton types

+ +
singleton-type-descriptor := simple-const-expr
+
+
+

+A singleton type is a type containing a single shape. A singleton type is +described using a compile-time constant expression for a single value: the type +contains the shape of that value. Note that it is possible for the +variable-reference within the simple-const-expr to reference a structured value; +in this case, the value will have its read-only bit set; a value without its +read-only bit set will thus not belong to any singleton type. +

+
+
+

Any type

+ +
any-type-descriptor := any
+
+

+The type descriptor any describes the type consisting of all values +other than errors. A value belongs to the any type if and only if its basic type +is not error. Thus all values belong to the type any|error. Note +that a structure with members that are errors belongs to the any +type. +

+

+The any-type-descriptor is not definite. +

+
+
+

Never type

+ +
never-type-descriptor := never
+
+

+The type descriptor never describes the type that does not contain +any shapes. No value ever belongs to the never. +

+

+This can be useful to describe for the return type of a function, if the +function never returns. It can also be useful as a type parameter. For example, +xml<never> describes the an xml type that has no +constituents, i.e. the empty xml value. +

+

+Note that for any type T, the type T|never is the same +as T. +

+
+
+

Readonly type

+
readonly-type-descriptor := readonly
+
+

+A shape belongs to the type readonly if its read-only bit is on. +

+

+A value belonging to an inherently immutable basic type will always have its +read-only bit on. These basic types are: +

+
    +
  • all simple types +
      +
    • nil
    • +
    • boolean
    • +
    • int
    • +
    • float
    • +
    • decimal
    • +
    +
  • +
  • string
  • +
  • error
  • +
  • function
  • +
  • typedesc
  • +
  • handle
  • +
+

+A value belonging to a selectively immutable basic type may have its read-only +bit on. These basic types are: +

+
    +
  • xml
  • +
  • list
  • +
  • mapping
  • +
  • table
  • +
  • object
  • +
+ +
+
+

Distinct types

+
distinct-type-descriptor := distinct type-descriptor
+
+

+Each occurrence of a distinct-type-descriptor describes a type that is distinct +from any other occurrence of a distinct-type-descriptor. Only object and error +values can belong to a type described by a distinct-type-descriptor. +

+

+The type denoted by a distinct-type-descriptor D, where +D is distinct T, and +d is the type-id of this occurrence of D, +contains a shape s of an object or error value if and only if both +T contains s and the set of type-ids of +s contains d. The set of type-ids induced by +D consists of d as the primary type-id and +the type-ids induced by T as the secondary type-ids. The +type T must be definite and must be a subtype of object +or a subtype of error. The type D is always definite. +Note that D is always a proper subtype of +T. +

+ +
+
+

Union types

+ +
union-type-descriptor := type-descriptor | type-descriptor
+
+

+The set of shapes denoted by an union type T1|T2 is the union of +the set of shapes denoted by T1 and the set of shapes denoted by +T2. Thus, the type T1|T2 contains a shape if and only +if either the type denoted by T1 contains the shape or the type +denoted by T2 contains the shape. A type descriptor +T1|T2 is not a class and cannot be used with new, +even if one or both of T1 and T2 are classes. +

+

+A union type T1|T2 is definite if and only if both T1 +and T2 are definite and the set of type-ids induced by +T1 and T2 are the same. If it is definite, then it +induces the same set of type-ids as T1 and T2, and a +type-id is primary if it is primary in either T1 or +T2. +

+
+
+

Intersection types

+ +
intersection-type-descriptor := type-descriptor & type-descriptor
+
+

+The set of shapes denoted by an intersection type is the +intersection of the set of shapes denoted by T1 and the set of +shapes denoted by T2. Thus, the type T1&T2 +contains a shape if and only if the types denoted by T1 and +T2 both contain the shape. It is a error to have an intersection +type that denotes an empty set of shapes. In an intersection type +T1&T2, it is an error if T1 and T2 +are both function types unless there is a single function-type-descriptor that +denotes a type that is a subtype of both T1 and T2. +A type descriptor T1&T2 is not a class and cannot be used +with new, even if one or both of T1 and T2 are classes. +

+

+An intersection type T1&T2 is definite if and only if both +T1 and T2 are definite. If it is definite, then it +induces the union of the set of type-ids induced by T1 and +T2, and a type-id is primary if it is primary in either +T1 or T2. +

+

+Intersection types are particularly useful in conjunction with +readonly. A set of readonly shapes can be described by +readonly&T, where T describes the primary aspect +of the shape. +

+

+When T is either R&readonly or readonly&R, +where R is a record type descriptor, and a field in R has a default value with +closure C, then, if the return type of C belongs to Cloneable, the field in T has a default value with a +closure that applies the ImmutableClone operation +to result of evaluating C; otherwise, the field in T does not have a default +value. +

+
+ +
+

Optional types

+ +
optional-type-descriptor := type-descriptor ?
+
+

+A type T? means the union of T +and (). It is completely equivalent to +T|(). +

+
+ +
+

Anydata type

+ +
anydata-type-descriptor := anydata
+
+

+The type descriptor anydata describes the type of plain data. The +type anydata contains a shape if and only if it is the shape of a +value that is plain data. The anydata type can thus be defined as: +

+ +
  () | boolean | int | float | decimal
+    | string | xml | regexp:RegExp
+    | anydata[] | map<anydata> | table<map<anydata>>
+
+ +

+In the above, regexp refers to the lang library module +lang.regexp. Since there is only one tagged data type defined in +this version of Ballerina, all tagged data values belong to +regexp:RegExp. +

+ +
+
+

JSON types

+ +
json-type-descriptor := json
+
+

+The json type is designed for processing data expression in JSON +format. It is a built-in name for a union defined as follows: +

+
type json = () | boolean | int | float | decimal | string | json[] | map<json>;
+
+

+In addition, the json type is defined to have lax static typing. +

+ +
+ +
+

Byte type

+ +
byte-type-descriptor := byte
+
+

+The byte type is a predefined name for a union of the int values in the range 0 +to 255 inclusive. It is equivalent to the built-in +subtype int:Unsigned8. +

+
+ +
+
+

Built-in object types

+

+There are several object types that are built-in in the sense that the +language treats objects with these types specially. There are two kinds of +object type: +

+
    +
  • purely structural types; the name of the type is internal to this +specification and not exposed to the language;
  • +
  • distinct types; the name of the type is defined in a lang library +module.
  • +
+ +
+

Iterator

+

+A value of iterable type with iteration value type T and iteration completion +type C provides a way of creating an iterator object that belongs to the object +type +

+ +
    object {
+       public function next() returns record {| T value; |}|C;
+    }
+
+

+In this specification, we refer to this type as Iterator<T,C>. +

+

+Conceptually an iterator is at a position between members of the iteration sequence. +Possible positions are at the beginning (immediately before the first member if +any), between members and at the end (immediately after the last member if any). +A newly created iterator is at the beginning position. For an empty sequence, +there is only one possible position which is both at the beginning and at the +end. +

+

+The next() method behaves as follows: +

+
    +
  • if the iteration has encountered an error, return an error value
  • +
  • otherwise, if the iterator has completed successfully by reaching the end +position without an error, return nil
  • +
  • otherwise +
      +
    • move the iterator to next position, and
    • +
    • return a record { value: v } where v is the member of the +sequence between the previous position and the new position
    • +
    +
  • +
+

+Mutation of a structured value during iteration is handled as follows. A call to +next() must panic if there has been any mutation to the structured +value since the iterator was created other than the following:

+
    +
  • removing a member of the structured value that a preceding call to the +iterator has already returned;
  • +
  • changing the member associated with an existing key.
  • +
+

+In the latter case, next() must return the value associated with +the key at the point when next() is called. +

+

+Note that it is not possible for the next() method simply to return +the values in the iteration sequence, since there would be no way to distinguish +a nil or error value that is part of the iteration sequence from a nil or error +value that represents the result of the iteration. +

+
+
+

Iterable

+

+An object belongs to the object type Iterable<T,C> if it has a +method named iterator with no arguments and a return type that is +subtype of Iterator<T,C> and it belongs to the distinct type +Iterable defined in lang.object. An object that +belongs to Iterable<T,C> is iterable: the object returned by the +iterator method determines the iteration sequence and iteration +completion value. +

+
+
+

StreamImplementor

+

+An object belongs to the object type StreamImplementor<T,C> if it +belongs to Iterator<T,C> and also optionally has a method +close() with return value C?. This is equivalent to +belonging to the following type. +

+ +
    object {
+       public isolated function next() returns record {| T value; |}|C;
+    }
+    | object {
+       public isolated function next() returns record {| T value; |}|C;
+       public isolated function close() returns C?;
+    }
+
+ +

+The close method says that there will be no more calls to the next method. Any +call to a next method after the close method has been called must result in a +panic. A missing close method behaves like a close method that puts the object +into a closed state, in which calls to next will result in a panic, and then +immediately returns (). +

+ +
+
+

Listener

+

+The object type Listener<T,A>, where T is a a subtype of service +object {} and A is a subtype of string[]|string|(), is +described by the following object type descriptor: +

+ +
object {
+   public function attach(T svc, A attachPoint) returns error?;
+   public function detach(T svc) returns error?;
+   public function start() returns error?;
+   public function gracefulStop() returns error?;
+   public function immediateStop() returns error?;
+}
+
+

+The role of a Listener is to handle incoming network messages by making +calls on service objects as described in Listeners and services. Each method is used +as follows: +

+
    +
  • the attach method is used to provide the Listener with a +service object that it can use to handle incoming network messages; the +attachPoint argument is used to identify which network messages the +service object should be used for;
  • +
  • the detach method tells the Listener to stop using a service +object that was previously provided using the attach method;
  • +
  • the start method tells the Listener to start handling incoming +network messages;
  • +
  • the gracefulStop and immediateStop messages tell +the Listener to stop handling incoming network messages; +
      +
    • in the case of gracefulStop, the listener should complete the +handling of any incoming messages that it has started to handle; in particular, +it should wait for the completion of any strands that it created to execute +service object methods;
    • +
    • in the case of immediateStop, the listener should not try to +complete the hanlding of any incoming messages that is has started to handle; in +particular, it should cancel any strands that it created to execute service +object methods.
    • +
    +
  • +
+

+Each method returns an error value if an error occurred, and return nil +otherwise. The listener object is responsible for creating and keeping track of +any strands that it needs. +

+

+A type is a listener object type if it is a subtype of the object type +Listener<T,A>, for some type T that is a subtype of service object +{} and some type A that is a subtype of string[]|string|(). +

+
+
+

RawTemplate

+

+The RawTemplate type describes the type of object constructed by a raw template +expression. The type is defined in lang.object as follows. +

+
distinct object {
+    public (readonly & string[]) strings;
+    public (any|error)[] insertions;
+}
+
+ +
+
+

RetryManager

+ +

+Classes of type RetryManager are defined by the application to allow control +over retries performed by the retry statement and retry transaction statement +The object type RetryManager<E>, where E is a a subtype of +error, is described by the following object type descriptor: +

+ +
object {
+   public function shouldRetry(E e) returns boolean;
+}
+
+

+Note that RetryManager<E> is contravariant in E i.e. RetryManager<E> +is a subtype of RetryManager<E'> if and only if E' is a subtype of E. +

+ +
+ +
+
+

Abstract operations

+

+These section specifies a number of operations that can be performed on values. +These operations are for internal use by the specification. These operations are +named in CamelCase with an initial upper-case letter to distinguish them from +functions in the lang library. +

+
+

FillMember

+

+The FillMember(s, k) operation is defined for a structured value s and an +out-of-line key value k. It can be performed when s does not have a member with +key k; if it succeeds, it will result in a member with key k being added to s. +It will succeed if the inherent type of s allows the addition of a member with +key k and there is a way to construct a filler value for the type descriptor +that the inherent type of s requires for member k. The following table specifies +when and how a filler value can be constructed for a type descriptor. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type descriptorFiller valueWhen available
()()
booleanfalse
int0
float+0.0f
decimal+0d
string""
array or tuple type descriptor[]if that is a valid constructor for the type
map or record type descriptor{ }if that is a valid constructor for the type
readonly & Tthe filler value for T constructed as read-onlyif that belongs to the type
tableempty table (with no rows)
objectnew T()if T is a class, where T is the type descriptor for the object, and the +static type of T's init method allows no arguments and does not include error
streamempty stream
xmlxml``
built-in subtype of xmlxml``if this belongs to the subtype, i.e. if the subtype is +xml:Text
regexp:RegExpre``
singletonthe single value used to specify the type
union()if () is a member of the union
the filler value for basic type Bif all members of the union belong to a single basic type B, +and the filler value for B also belongs to the union
T?()
any()
anydata()
byte0
built-in subtype of int0
json()
+ +
+
+

Cloning

+

+There are two cloning operations. Both of these operate on values belonging to the +Cloneable type defined as follows: +

+
+public type Cloneable readonly|xml|Cloneable[]|map<Cloneable>|table<map<Cloneable>>;
+
+

+This type is defined in the lang.value module of the lang library. In this document, +the type will be referred to as value:Cloneable. +

+ +
+
Clone
+

+Clone(v) is defined for any value v that belongs to the type +value:Cloneable. It performs a deep copy, recursively copying all +structural values and their members and recursively copying all sequence values +and their constituents. Clone(v) for an immutable value v returns v. If v is of +a basic type that has an inherent type, Clone(v) has the same inherent type as +v. The graph of references of Clone(v) must have the same structure as that of +v. This implies that the number of distinct references reachable from Clone(v) +must be the same as the number of distinct references reachable from v. Clone(v) +must terminate even if v has cycles. +

+

+Clone(v) cannot be implemented simply by recursively calling Clone on all +members of v. Rather Clone must maintain a map that records the result of +cloning each reference value. When a Clone operation starts, this map as empty. +When cloning a reference value, it must use the result recorded in the map if +there is one. +

+

+The Clone operation is exposed by the clone function in the +lang.value module of the lang library. +

+
+
+
ImmutableClone
+

+ImmutableClone(v) is defined for any value v that belongs to the type +value:Cloneable. It performs a deep copy of v similar to Clone(v), +except that newly constructed values will be constructed as immutable and so +have their read-only bit on. Any immutable value is not copied. So the result +of Immutable always has its read-only bit on. +

+

+Like Clone, ImmutableClone must preserve graph structure, including cycles. +Conceptually the whole graph is constructed before being made immutable. +

+

+The ImmutableClone operation is exposed by the cloneReadOnly +function in the lang.value module of the lang library. +

+
+
+
+

DeepEquals

+

+DeepEquals(v1, v2) is defined for any values v1, v2 that belong to type anydata. +It returns true or false depending of whether the primary aspect of the shape v1 +and of v2 are the same. In other words, DeepEquals returns true if and only if +the values are the same ignoring whether read-only bits are on or off. +DeepEquals(v1, v2) must terminate for any values v1 and v2 of type anydata, even +if v1 or v2 have cycles. DeepEquals(v1, v2) returns true if v1 and v2 have the +same shape, even if the graphs of references of v1 and v2 have different +structures. If two values v1 and v2 have different basic types, then +DeepEquals(v1, v2) will be false. +

+

+The possibility of cycles means that DeepEquals cannot be implemented simply by +calling DeepEquals recursively on members. Rather DeepEquals must maintain a +mapping that records for each pair of references whether it is already in +process of comparing those references. When a DeepEquals operation starts, this +map is empty. Whenever it starts to compare two references, it should see +whether it has already recorded that pair (in either order), and, if it has, +proceed on the assumption that they compare equal. +

+

+DeepEquals(Clone(x), x) is guaranteed to be true for any value of type anydata. +

+
+
+

NumericConvert

+

+NumericConvert(t, v) is defined if t is the typedesc for float, decimal or int, +and v is a numeric value. It converts v to a value in t, or returns an error, +according to the following table. +

+ + + + + + + + + + + + + + + + + + + + + + + + +
from \ tofloatdecimalint
floatunchangedclosest math valueround, error for NaN or out of int range
decimalclosest math valueunchanged
intsame math valuesame math valueunchanged
+
+
+

ToString

+

+ToString(v,style) converts a value to a string in one of three styles. The +conversion can be performed in one of three styles, specified by the style +parameter, which are as follows. +

+
    +
  • expression style: produces a string that looks like a Ballerina expression; there are +two cases +
      +
    • when v belongs to anydata and does not have cycles, it will produce a string that +is a valid Ballerina expression, such that evaluating that string will result in a value v' +for which DeepEquals(v, v') is true
    • +
    • otherwise, it will produce a string that is either not a valid Ballerina expression +or is a valid Ballerina expression that evaluates to a value that does not belong type type anydata
    • +
    +
  • +
  • informal style: similar to expression style, but does not preserve all the distinctions that +expression style does, and avoids syntax that requires a knowledge of Ballerina
  • +
  • direct style: this does a direct conversion of the value to a string rather than producing +a string that describes the value +
      +
    • if v is a string, then the result of ToString(v,direct) is v
    • +
    • if v is XML, then the result of ToString(v,direct) is v in XML syntax
    • +
    • direct style falls back to informal style for basic types where there is no +other natural more direct conversion
    • +
    +
  • +
+

+The following table summarizes the result of ToString(v,style) for each basic type. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic type of v + style +
expression + informal + direct +
nil + () + null + +
true + true +
int + 2 +
float + 1.0 +
float:NaN + NaN +
float:Infinity + Infinity +
decimal + 1d + 1 +
1.20d + 1.20 +
string + "xyz" + xyz +
xml + xml`<d>t</d>` + `<d>t</d>` + <d>t</d> +
tagged data type + re`xyz` + `xyz` + xyz +
array + [X,Y] +
X, Y expression style + X,Y informal style +
map + {"x":X,"y":Y} +
X, Y expression style + X,Y informal style +
table + table key(k) [R1,R2] + [R1,R2] +
R1,R2 expression style + R1,R2 informal style +
error + error D1&D2 (M,C,F1=V1,F2=V2) +
V1, V2 expression style, D1,D2 in the form {module-id}local-id, M expression style, C expression style + V1, V2 informal style, just local id of D1,D2, M informal style, C informal style +
D1,D2 are type-ids, M is the error message, C is the error cause, F1=V1,F2=V2 are field names and values of the error detail +
object w/o toString method + object D1&D2 U where U is an identifier that uniquely identifies the object (objects will have the same identifier only if they are ===) +
object with toString method + object S + S +
S in direct style where S is the result of calling the toString method
behavioural type other than error or objectidentifier for behavioural type (function, + future, typedesc, stream or handle) followed + by implementation-dependent string +
cycle detected + ...[N] + ... +
N is 0-based index down path from root object to object where cycle is detected + +
+
+
+

Ordering

+

+There are three abstract operations related to ordering: Compare(x, y), +CompareA(x, y), CompareD(x, y). CompareA(x, y) and CompareD(x, y), which are +used to define sorting, return one of the values LT, EQ, GT representing the +cases where x is less than, equal to or greater than y. Compare(x, y), which is +used to define the relational operators, can also return the value UN to +represent the case where x is unordered with respect to y; this is used to deal +with NaN. +

+

+The three operations are related as follows: Compare(x, y) is the same as +CompareA(x, y) and CompareD(x, y) unless Compare(x, y) is UN. +

+

+A type is ordered if all the values that belong to the type can be compared to +each other using the above three abstract operations. Thus each of the abstract +operations are defined when there is an ordered type to which both arguments +belong. +

+

+If C is any of the three abstract operations, and there is an ordered type to +which both x and y belong, then: +

+
    +
  • C(x, y) is LT if and only if C(y, x) is GT
  • +
  • C(x, y) is EQ if and only if C(y, x) is EQ
  • +
  • C(x, y) is UN if and only if C(y, x) is UN
  • +
+

+The most straightforward ordered types are basic types where all the values of +the type can be put into an order. These types are nil, boolean, int, string. For +each of these three types, for any pair of values x, y belonging to the type +

+
    +
  • Compare(x, y) is EQ if x and y are the same value
  • + +
  • Compare(x, y) is LT in the following cases: +
      +
    • for int, if x is mathematically less than y
    • +
    • for boolean, if x is false and y is true
    • +
    • for string, if x is lexicographically less than y in Unicode code point +order, more precisely, if +
        +
      • x is an proper initial substring of y, or
      • +
      • for the first index at which x and y differ, the code point at that index in +x is less than the code point at that index in y
      • +
      +
    • +
    +
  • +
  • CompareA(x,y), and CompareD(x,y) have the same value as Compare(x, y)
  • +
+

+The basic type decimal is ordered. The abstract operations are defined the same +as for int, except that Compare(x, y) is EQ if x and y have the same shape. In +other words, the compare operations ignore precision. +

+

+The basic type float is also ordered. Compare(x,y) is as defined by IEEE +754-2008 clause 5.11. In particular: +

+
    +
  • the Compare operation does not distinguish +0 from -0 i.e. +Compare(-0.0,+0.0) is EQ
  • +
  • Compare(x, y) is UN if x or y or both is NaN
  • +
+

+When x and y belong to type float, CompareA(x, y) and CompareD(x, y) differ from +Compare(x, y) as follows: +

+
    +
  • CompareA(NaN,NaN) and CompareD(NaN, NaN) are EQ
  • +
  • CompareA(x, NaN) is LT if x is not NaN
  • +
  • CompareD(NaN, x) is LT if x is not NaN
  • +
+

+If type T is ordered, then type T? Is also ordered. Comparison operations +involving nil are defined as follows: +

+
    +
  • Compare((),()), CompareA((),()) and CompareD((),()) are all EQ
  • +
  • Compare(x,()) is UN if x is not ()
  • +
  • CompareA(x,()) is LT if x is not ()
  • +
  • CompareA((), x) is LT if x is not ()
  • +
+

+The CompareA operation is used for sorting in ascending order; the CompareD +operation is used in reverse for sorting in descending order. The net effect of +the above rules is thus that both () and NaN will appear at the end of a sorted +list, with NaN before (), in both ascending and descending order. +

+

+The following rules determine when a subtype of list is ordered: +

+
    +
  • [T...] is ordered, if T is ordered;
  • +
  • [] is ordered;
  • +
  • [T, rest] is ordered if T is ordered and [rest] is ordered.
  • +
+

+Each of the three abstract operations C are extended to apply to lists as +follows: +

+
    +
  • C([], []) is EQ;
  • +
  • C([], [y1,...]) is LT;
  • +
  • C([x1,x2,...],[y1, y2...]) is r unless r is EQ and otherwise C([x2,...],[y2,...]), where r is C(x1, y1).
  • +
+
+
+
+

Binding patterns, variables and identifiers

+
+

Binding patterns

+

+Binding patterns are used to support destructuring, which allows different parts +of a single structured value each to be assigned to separate variables at the +same time. +

+ +
binding-pattern :=
+   capture-binding-pattern
+   | wildcard-binding-pattern
+   | list-binding-pattern
+   | mapping-binding-pattern
+   | error-binding-pattern
+capture-binding-pattern := variable-name
+variable-name := identifier
+wildcard-binding-pattern := _
+list-binding-pattern := [ list-member-binding-patterns ]
+list-member-binding-patterns :=
+   binding-pattern (, binding-pattern)* [, rest-binding-pattern]
+   | [ rest-binding-pattern ]
+mapping-binding-pattern := { field-binding-patterns }
+field-binding-patterns :=
+   field-binding-pattern (, field-binding-pattern)* [, rest-binding-pattern]
+   | [ rest-binding-pattern ] 
+field-binding-pattern :=
+   field-name : binding-pattern
+   | variable-name
+rest-binding-pattern := ... variable-name
+error-binding-pattern := error [error-type-reference] ( error-arg-list-binding-pattern )
+error-type-reference := type-reference
+error-arg-list-binding-pattern :=
+   error-message-binding-pattern [, error-cause-binding-pattern] [, error-field-binding-patterns]
+   | [error-field-binding-patterns]
+error-message-binding-pattern := simple-binding-pattern 
+error-cause-binding-pattern := simple-binding-pattern | error-binding-pattern
+simple-binding-pattern := capture-binding-pattern | wildcard-binding-pattern
+error-field-binding-patterns :=
+   named-arg-binding-pattern (, named-arg-binding-pattern)* [, rest-binding-pattern]
+   | rest-binding-pattern
+named-arg-binding-pattern := arg-name = binding-pattern
+
+

+A binding pattern may succeed or fail in matching a value. A successful match +causes values to be assigned to all the variables occurring the binding-pattern. +

+

+A binding pattern matches a value in any of the following cases. +

+
    +
  • a capture-binding-pattern always matches a value and causes the matched +value to be assigned to named variable;
  • +
  • a wildcard-binding-pattern matches a value if the value belongs to type any, +in other words if the basic type of the value is not error; it does not cause +any assignments to be made;
  • +
  • a list-binding-pattern with m binding patterns matches a list with n +members if m is less than or equal to n, and the i-th binding pattern matches +the i-th member of the list for each i in 1 to m, and either m is equal to n or +the list-binding-pattern includes a rest-binding-pattern; if there is a +rest-binding-pattern ...v, then a successful match causes a new +list value consisting of all members of the matched list except for the the +first m values to be assigned to v;
  • +
  • a mapping-binding-pattern { f1: p1, f2: +p2, ..., fn: pn, r } matches a mapping value m +if each field-binding-pattern fi: pi matches m for each i +in 1 to n; if r is ...v then a successful match causes a new +mapping value consisting of all fields other than f1 to fn +to be assigned to v;
  • +
  • a field-binding-pattern f: p matches a mapping value m if +
      +
    • m contains a field f and p matches its value; or
    • +
    • m does not have a field f and p matches nil; this case is applied only when +the field-binding-pattern is used in a context where it is known at compile-time +that the field f is optional and cannot have the value nil;
    • +
    +
  • +
  • a field-binding-pattern consisting of just a variable-name x +is equivalent to a field-binding-pattern x: x;
  • +
  • an error-binding-pattern error ET(pm, pc, +f1 = p1, f2 = p2, ..., fn += pn, r) matches an error value e if +
      +
    • e has a message that matches pm,
    • +
    • if pc is present, e has a cause that matches pc,
    • +
    • e has a detail record that has fields f1, f2, ... , +fn such that pi matches the value of field fi +for each i in 1 to n,
    • +
    • if ET is present, the shape of e is in ET,
    • +
    • if r is ...v, then a successful match causes a new mapping +value consisting of all fields of the detail record other than f1, +f2, ... , fn to be assigned to v;
    • +
    +
  • +
+

+All the variables in a binding-pattern must be distinct e.g. [x, x] is not +allowed. +

+

+Given a type descriptor for every variable in a binding-pattern, there is a type +descriptor for the binding-pattern that will contain a value just in case that +the binding pattern successfully matches the value causing each variable to be +assigned a value belonging to the type descriptor for that variable. +

+
    +
  • for a capture-binding-pattern, the type descriptor is the type descriptor +for that variable;
  • +
  • for a wildcard-binding-pattern, the type descriptor is any
  • +
  • for a list-binding-pattern, the type descriptor is a tuple type descriptor;
  • +
  • for a mapping-binding-pattern, the type descriptor is a record type +descriptor;
  • +
  • for an error-binding-pattern, the type descriptor is an error type +descriptor.
  • +
+ +
+
+

Typed binding patterns

+ +
typed-binding-pattern := inferable-type-descriptor binding-pattern
+inferable-type-descriptor := type-descriptor | var
+
+

+A typed-binding-pattern combines a type-descriptor and a binding-pattern, and is +used to create the variables occurring in the binding-pattern. If +var is used instead of a type-descriptor, it means the type is +inferred. +

+

+There are two ways in which a typed-binding-pattern can be used. +

+
    +
  • Single use. In the language syntax, this kind of use of a +typed-binding-pattern is usually followed by = (the only case where +it is not followed by = is when it follows on fail). +The typed-binding-pattern is matched once against the result of evaluating an +expression. When var is used, the type is inferred from the static +type of the expression (in the on fail case there can be multiple +expressions from which it is inferred); in this case, it is an error if the +intersection of error and the inferred type is non-empty, the +binding-pattern of the typed-binding-pattern is a capture-binding-pattern, and +the variable referenced in the capture-binding-pattern is not used. It is an +error if the type-descriptor in the typed-binding-pattern is +never.
  • +
  • Iterative use. In the language syntax, this kind of use of a +typed-binding-pattern is followed by the in keyword. An iterator is +created from the result of evaluating an expression, and the +typed-binding-pattern is matched against each value returned by the iterator. +When var is used, the type is inferred to be T, where the static +type of the expression is an iterable type with value type T.
  • +
+

+The simplest and most common form of a typed-binding-pattern is for the binding +pattern to consist of just a variable name. In this case, the variable is +constrained to contain only values matching the type descriptor. +

+

+When the binding pattern is more complicated, the binding pattern must be +consistent with the type-descriptor, so that the type-descriptor unambiguously +determines a type for each variable occurring in the binding pattern. A binding +pattern occurring in a typed-binding-pattern must also be irrefutable with +respect to the type of value against which it is to be matched. In other words, +the compiler will ensure that matching such a binding pattern against a value +will never fail at runtime. +

+
+
+

Variable and identifier scoping

+

+For every variable, there is place in the program that declares it. Variables +are lexically scoped: every variable declaration has a scope which determines +the region of the program within which the variable can be referenced. +

+

+There are two kinds of scope: module-scope and block-scope. A variable with +module-scope can be referenced anywhere within a module; if declared +public, it can also be referenced from outside the module. +

+

+Identifiers with module-scope are used to identify not only variables but other +module-level entities such as functions. Within module-scope, identifiers are +separated into three symbol spaces: +

+
    +
  • the main symbol space includes identifiers for variables, +constants, types, functions and other identifiers that do not belong to any of +the other two symbol spaces;
  • +
  • the prefix symbol space contains prefixes declared by import +declarations and XML namespace declaration statements;
  • +
  • the annotation tag symbol space contains annotation tags declared +by annotation declarations.
  • +
+

+The prefix symbol space is special in that it is associated with a source part +rather than a module. +

+

+Block-scope is divided into symbol spaces in the same way as module-scope, +except that block-scope does not have a symbol space for annotation tags, since +annotation tags cannot be declared with block-scope. +

+

+An identifier declared with block-scope can be referenced only within a +particular block (always delimited with curly braces). Block-scope variables are +created by a variety of different constructs, many of which use a +typed-binding-pattern. Parameters are treated as read-only variables with +block-scope. +

+

+It is not an error if an identifier is declared with block-scope and there is +already a declaration of the same identifier in the same symbol space with +module-scope. In this case, the block-scope declaration will hide the +module-scope declaration for the region where the block-scope declaration is in +scope. However, it is a compile error if an identifier is declared with +block-scope and its scope overlaps with the scope of another declaration of the +same identifier in the same symbol space also with block-scope. +

+ +
qualified-identifier := module-prefix NoSpaceColon identifier
+module-prefix := identifier | predeclared-prefix
+
+

+A module-prefix is a name that is used locally within the source of +a module to refer to another module. A module-prefix in a +qualified-identifier must refer to a module-prefix specified in an +import declaration in the same source part. +

+ +
+
+
+
+

6. Expressions

+ +
expr-only := 
+   literal
+   | template-expr
+   | structural-constructor-expr
+   | object-constructor-expr
+   | new-expr
+   | variable-reference-expr
+   | field-access-expr
+   | optional-field-access-expr
+   | xml-attribute-access-expr
+   | annot-access-expr
+   | member-access-expr
+   | function-call-expr
+   | method-call-expr
+   | error-constructor-expr
+   | anonymous-function-expr
+   | let-expr
+   | typeof-expr
+   | unary-logical-expr
+   | nil-lifted-expr
+   | range-expr
+   | relational-expr
+   | is-expr
+   | equality-expr
+   | logical-expr
+   | conditional-expr
+   | xml-navigate-expr
+   | transactional-expr
+
+expression :=
+   expr-only
+   | type-cast-expr
+   | checking-expr
+   | trap-expr
+   | query-expr
+   | ( expression )
+
+

+For simplicity, the expression grammar is ambiguous. The following table shows +the various types of expression in decreasing order of precedence, together with +associativity. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OperatorAssociativity
+m:x +
+x.k +
+x.@a +
+f(x) +
+x.f(y) +
+x[y] +
+new T(x) +
++x +
+-x +
+~x +
+!x +
+<T> x +
+typeof x +
+check x +
+checkpanic x +
+x * y +
+x / y +
+x % y +
left
x + y +
+x - y +
left
+x << y +
+x >> y +
+x >>> y +
left
+x ... y +
+x ..< y +
non
+x < y +
+x > y +
+x <= y +
+x >= y +
+x is y +
+x !is y +
non
+x == y +
+x != y +
+x === y +
+x !== y +
left
x & yleft
x ^ yleft
x | y + left
x && yleft
x || yleft
x ?: yright
x ? y : zright
+(x) => y +
+let x = y in z +
+from x in y select z +
+trap x +
right
+
+

Expression evaluation

+

+When the evaluation of an expression completes normally, it produces a result, +which is a value. The evaluation of an expression may also complete abruptly. +There are two kinds of abrupt completion: check-fail and panic. With both kinds +of abrupt completion there is an associated value, which always has basic type +error. +

+

+The following sections describes how each kind expression is evaluated, assuming +that evaluation of subexpressions complete normally. Except where explicitly +stated to the contrary, expressions handle abrupt completion of subexpressions +as follows. If in the course of evaluating an expression E, the evaluation of +some subexpression E1 completes abruptly, then the evaluation of E also +completes abruptly in the same way as E1. +

+
+
+

Static typing of expressions

+

+A type is computed for every expression at compile time; this is called the +static type of the expression. The compiler and runtime together guarantee that +if the evaluation of an expression at runtime completes normally, then the +resulting value will belong to the static type. A type is also computed for +check-fail abrupt completion, which will be a (possibly empty) subtype of error; +however, for panic abrupt completion, no type is computed. +

+

+It is an error if the static type of an expression is never, except +in cases where the expression is one that this specification explicitly permits +to have static type never and the expression occurs in a context +where this specification explicitly permits an expression with static type +never to occur. +

+

+The detailed rules for the static typing of expressions are quite elaborate and +are not yet specified completely in this document. +

+ +
+

Lax static typing

+

+In some situations it is convenient for static typing to be less strict than +normal. One such situation is when processing data in Ballerina using a static +type that is less precise than the type that the data is in fact expected to +belong to. For example, when the Ballerina json type is used for +the processing of data in JSON format, the Ballerina static type will not +capture the constraints of the particular JSON format that is been processed. +

+

+Ballerina supports this situation through the concept of lax static typing, +which has two parts: the first part is that a type descriptor can be classified +as lax; the second part is that particular kinds of expression can have less +strict static typing rules when the static type of a subexpression is described +by a lax type descriptor. With these less strict rules, a potential type error +that would have been a compile-time error according to the normal strict static +typing rules would instead be allowed at compile-time and result in an error +value at runtime; the effect is thus that some static type-checking is instead +done dynamically. +

+

+In this version of Ballerina, only the first step has been taken towards +supporting this concept. There is a fixed set of type descriptors that are +classified as lax: specifically json is lax, and +map<T> is lax if T is lax. The only kinds of expression for +which lax typing rules are specified are field-access-expr, +optional-field-access-expr and checking-expr. +

+ +
+
+

Contextually expected type

+

+For a context in which an expression occurs, there may be a type descriptor that +describes the static type that the expression is expected to have. This is +called the contextually expected type. For example, if a variable is +declared by a type descriptor TD, then TD will be the contextually expected type +for the expression initializing the variable. A type descriptor must be +resolved before it can be used to provide a contextually expected type.

+

+Many kinds of expression that construct values use the contextually expected +type to determine the type of value constructed, rather than requiring the type +to be specified explicitly. For each such kind of expression, there is a set of +basic types (most often consisting of a single basic type) that the value +constructed by that kind of expression will always belong to. In this case, the +contextually expected type is narrowed by intersecting it with this set of basic +types; this narrowed type is called the applicable contextually +expected type. The narrowing is performed on the type descriptor by first +normalizing the type descriptor into a union, where each member of the union is +not a union and describes shapes from a single basic type, and then eliminating +any members of the union with the wrong basic type; if this leaves no members, +then it is a compile-time error; if it leaves a single member of the union, then +the the applicable contextually expected type is this single member, otherwise +it is a union of the remaining members. +

+

+Note the language provides a way to say that the type of a variable is to be +inferred from the static type of the expression used to initialize the variable. +In this case, there is no contextually expected type for the evaluation of the +expression. Not having a contextually expected type is different from having a +contextually expected type that allows all values. +

+
+
+

Precise and broad types

+

+There is an additional complexity relating to inferring types. Expressions in +fact have two static types, a precise type and a broad type. Usually, the +precise type is used. However, in a few situations, using the precise type would +be inconvenient, and so Ballerina uses the broad type. In particular, the broad +type is used for inferring the type of an implicitly typed non-final variable. +Similarly, the broad type is used when it is necessary to infer the member type +of the inherent type of a structured value. +

+

+In most cases, the precise type and the broad type of an expression are the +same. For a compound expression, the broad type of an expression is computed +from the broad type of the sub-expressions in the same way as the precise type +of the expression is computed from the precise type of sub-expressions. +Therefore in most cases, there is no need to mention the distinction between +precise and broad types. +

+

+The most important case where the precise type and the broad type are different +is literals. The precise type is a singleton type containing just the shape of +the value that the literal represents, whereas the broad type is the precise +type widened to contain the entire basic type of which it is a subtype. For +example, the precise type of the string literal "X" is the +singleton type "X", but the broad type is string. +

+
+
+

Singleton typing

+

+The specification of a particular kind of compound expression may say that the +static type of the result of an expression E is a type T modified by the +usual singleton typing rules. This means that when all subexpressions of +the compound expression have a singleton type, then the static type of E is a +singleton subtype of T. This subtype is computed by evaluating the expression at +compile-time with operands whose values belong to the corresponding singleton +types. +

+
+
+

Nil lifting

+ +
nil-lifted-expr := 
+  unary-numeric-expr
+  | multiplicative-expr
+  | additive-expr
+  | shift-expr
+  | binary-bitwise-expr
+
+

+A nil-lifted-expr supports nil lifting for its operands. This means +that the operators used in a nil-lifted-expr have two forms: an +underlying form and a lifted form. The underlying form of the operator is used +when the static type of the subexpressions for all operands does not allow nil; +this form of the operator is described in the section for each kind of operator. +The lifted form of the operator is used when the static type of the +subexpressions for one or more operands does allow nil; the semantics of this +form of the operator are derived from the underlying form as described in this +section. +

+

+A nil-lifted-expr is evaluated by evaluating the subexpressions for +every operand. If the result of any of these evaluations is nil, then the result +of the nil-lifted-expr is nil. Otherwise, the evaluation is +completed in the same way as with the underlying form of the operator. +

+

+The static types of the operand subexpressions with nil removed must be valid +for the underlying form of the operator. The static type of the +nil-lifted-expr is T?, where T is what the static type +of the nil-lifted-expr would be if nil was removed from the static +type of the operand subexpressions, except that the usual singleton typing rules are not applied in computing +T. (The singleton typing rules are applied to the static types before the +removal of nil and thus have no effect, because the lifted form of the operator +is never applicable when all operands have singleton type.) +

+ +
+ +
+

Isolated expressions

+

+Ballerina defines requirements for when an expression is isolated. If +an expression meets the requirements, then it is compile-time guaranteed that +the value of the expression will be an isolated root and will not be aliased. +

+

+If the static type of an expression is immutable, i.e. a subtype of +readonly, or an isolated object, i.e. a subtype of isolated +object {}, then the expression is isolated. +

+

+Also, an expression of one of the following syntactic kinds is isolated if all +its subexpressions are isolated (regardless of its static type): +

+
    +
  • list-constructor-expr
  • +
  • table-constructor-expr
  • +
  • mapping-constructor-expr
  • +
  • template-expr
  • +
  • type-cast-expr
  • +
  • checking-expr
  • +
  • trap-expr
  • +
  • conditional-expr
  • +
+

+The section for each kind of expression will describe any alternative conditions +under which that kind of expression is also isolated. +

+
+
+
+

Casting and conversion

+

+Ballerina makes a sharp distinction between type conversion and type casting. +

+

+Casting a value does not change the value. Any value always belongs to multiple +types. Casting means taking a value that is statically known to be of one type, +and using it in a context that requires another type; casting checks that the +value is of that other type, but does not change the value. +

+

+Conversion is a process that takes as input a value of one type and produces as +output a possibly distinct value of another type. Note that conversion does not +mutate the input value. +

+

+Ballerina always requires programmers to make conversions explicit, even between +different types of number; there are no implicit conversions. +

+
+
+

Constant expressions

+ +
const-expr := 
+   literal
+   | template-expr
+   | structural-constructor-expr
+   | constant-reference-expr
+   | type-cast-expr
+   | unary-logical-expr
+   | nil-lifted-expr
+   | range-expr
+   | relational-expr
+   | is-expr
+   | equality-expr
+   | logical-expr
+   | conditional-expr
+   | ( const-expr )
+
+

+A value resulting from the evaluation of a const-expr always has +its read-only bit on. +

+

+Within a const-expr, any nested expression must also be a +const-expr. +

+ +
constant-reference-expr := variable-reference-expr
+
+

+A constant-reference-expr must reference a constant defined with +module-const-decl. +

+

+A const-expr is evaluated at compile-time. Constructors called +within a const-expr construct their values as immutable. Note that +the syntax of const-expr does not allow for the construction of error values. +The result of a const-expr is always immutable. +

+ +
simple-const-expr :=
+  nil-literal
+  | boolean-literal
+  | [Sign] int-literal
+  | [Sign] floating-point-literal
+  | string-literal
+  | constant-reference-expr
+
+

+A simple-const-expr is a restricted form of const-expr used in contexts where +various forms of constructor expression would not make sense. Its semantics are +the same as a const-expr. +

+
+
+

Literals

+ +
literal :=
+   nil-literal
+   | boolean-literal
+   | numeric-literal
+   | string-literal
+   | byte-array-literal
+numeric-literal := int-literal | floating-point-literal
+
+

+A numeric-literal represents a value belonging to one of the basic types int, +float or decimal. The basic type to which the value belongs is determined in +three stages. +

+
    +
  1. The syntactic form of numeric literal determines which of int, float and +decimal are candidates: +
      +
    • if the numeric-literal includes a FloatTypeSuffix or is a +HexFloatingPointLiteral, then the the only candidate is float;
    • +
    • if the numeric-literal includes a DecimalTypeSuffix, then the +only candidate is decimal;
    • +
    • otherwise, if the numeric-literal is a floating-point-literal, +the candidates are float and decimal;
    • +
    • otherwise, all three basic types are candidates.
    • +
    +
  2. +
  3. Any candidate basic type N such that the intersection of N with the +contextually expected type is empty is eliminated, unless this would eliminate +all candidates remaining after the first stage.
  4. +
  5. From remaining candidates, the first in the order int, float, decimal is +selected.
  6. +
+

+The precise type of a numeric-literal is the singleton type containing just the +shape of the value that the numeric-literal represents. The broad type is +the basic type of which the precise type is a subset. +

+ +
byte-array-literal := Base16Literal | Base64Literal
+Base16Literal := base16 WS ` HexGroup* WS `
+HexGroup := WS HexDigit WS HexDigit
+Base64Literal := base64 WS ` Base64Group* [PaddedBase64Group] WS `
+Base64Group :=
+   WS Base64Char WS Base64Char WS Base64Char WS Base64Char
+PaddedBase64Group :=
+   WS Base64Char WS Base64Char WS Base64Char WS PaddingChar
+   | WS Base64Char WS Base64Char WS PaddingChar WS PaddingChar
+Base64Char := A .. Z | a .. z | 0 .. 9 | + | /
+PaddingChar := =
+WS := WhiteSpaceChar*
+
+

+Let N be number of bytes encoded by the Base16Literal or Base64Literal. If the +applicable contextually expected type is a subtype of readonly or if the +byte-array-literal occurs within a const-expr, then the literal constructs a +list value with its read-only bit set; in this case, the static type of the +byte-array-literal is a singleton subtype of readonly & +byte[N]. Otherwise, the static type of byte-array-literal is +byte[N], and the inherent type of the list value created is also +byte[N]. +

+
+
+

Template expressions

+

+Template expressions make use of strings enclosed in backticks with interpolated +expressions. +

+
BacktickString :=
+  ` BacktickItem* Dollar* `
+BacktickItem :=
+   BacktickSafeChar
+   | BacktickDollarsSafeChar
+   | Dollar* interpolation
+interpolation := ${ expression }
+BacktickSafeChar := ^ ( ` | $ )
+BacktickDollarsSafeChar :=  $+ ^ ( { | ` | $)
+Dollar := $
+
+ +
template-expr := 
+   string-template-expr
+   | xml-template-expr
+   | tagged-data-template-expr
+   | raw-template-expr
+
+ +
+

String template expression

+ +
string-template-expr := string BacktickString
+
+

+A string-template-expr interpolates the results of evaluating +expressions into a literal string. The static type of the expression in each +interpolation must be a subtype of +boolean|int|float|decimal|string. Within a +BacktickString, every character that is not part of an +interpolation is interpreted as a literal character. A +string-template-expr is evaluated by evaluating the expression in each +interpolation in the order in which they occur, and converting the result of the +each evaluation to a string using the ToString abstract +operation with the direct style. The result of evaluating the +string-template-expr is a string comprising the literal characters +and the results of evaluating and converting the interpolations, in the order in +which they occur in the BacktickString. +

+

+The static type of the result of the string-template-expr is +string, modified by the usual singleton +typing rules. +

+

+A literal ` can be included in string template by using an +interpolation ${"`"}. +

+
+
+

XML template expression

+ +
xml-template-expr := xml BacktickString
+
+

+An XML template expression constructs an xml value as follows: +

+
    +
  1. The backtick string is parsed to produce a string of literal characters with +interpolated expressions
  2. +
  3. The result of the previous step is parsed as XML content. More precisely, it +is parsed using the production content in the W3C XML +Recommendation. For the purposes of parsing as XML, each interpolated expression +is interpreted as if it were an additional character allowed by the CharData and +AttValue productions but no other. The result of this step is an XML Infoset +consisting of an ordered list of information items such as could occur as the +[children] property of an element information item, except that interpolated +expressions may occur as Character Information Item or in the [normalized value] +of an Attribute Information Item. Interpolated expressions are not allowed in +the value of a namespace attribute.
  4. +
  5. This infoset is then converted to an xml value, as described in the XML type section, together with an ordered list of interpolated +expressions, and for each interpolated expression a position within the XML +value at which the value of the expression is to be inserted.
  6. +
  7. The static type of an expression occurring in an attribute value must be a +simple type and must not be nil. The static type type of an expression occurring +in content can either be xml or a non-nil simple type.
  8. +
  9. When the xml-template-expr is evaluated, the interpolated expressions are +evaluated in the order in which they occur in the BacktickString, +and converted to strings if necessary. A new copy is made of the xml value and +the result of the expression evaluations are inserted into the corresponding +position in the newly created xml value. This xml value is the result of the +evaluation. The contextually expected type for an interpolated expression that +occurs within an Attribute Information Item is string, and otherwise is xml; +this ensures that a query expr will work as expected. Note that if the static +type is not a subtype of the contextually expected type, it is not an error: +rather the value will be converted to a string.
  10. +
+

+An xml-template-expr occurring within a const-expr will construct an xml value +that has its read-only bit on. +

+
+ +
+

Tagged data template expression

+ +
tagged-data-template-expr := data-tag BacktickString
+data-tag := identifier
+
+

+A tagged-data-template-expr with data tag t constructs a tagged data +value of the basic type corresponding to t. The data-tag identifier +must be the name of a data tag by this specification or the Ballerina platform. +

+

+The BacktickString is parsed in two stages: +

+
    +
  1. the BacktickString is parsed resulting in a sequence of literal characters +and interpolations, represented as an array of n expressions, one for +each interpolation, and an array of n + 1 strings, where the +interpolations occur between the strings;
  2. +
  3. the array of strings is parsed using the abstract parsing function defined +for the data tag; it is a compile-time error if the abstract parsing function +returns an error.
  4. +
+

+The static type of the expression in an interpolation must be the data tag's +basic type. When the tagged-data-template-expr is evaluated, each expression in +an interpolation is evaluated in order. The result of evaluating the +tagged-data-template-expr is the result of applying the function that was +created by the abstract parsing function at compile-time to the values resulting +from the evaluation of these expressions. Note that the result of evaluating a +tagged-data-template-expr cannot be an error. +

+ +
+ + +
+

Raw template expression

+ +
raw-template-expr := BacktickString
+
+

+A raw-template-expr constructs an object belonging to the abstract RawTemplate +object type. +

+

+A raw-template-expr is evaluated by +

+
    +
  • constructing an array v whose members are the result of +evaluating each interpolation's expression in the order in which they occur in +the BacktickString;
  • +
  • constructing an object with two fields +
      +
    • an insertions field with value v
    • +
    • a strings field consisting of a read-only array of strings +containing the characters in BacktickString outside of interpolations, split at +the interpolation points; the length of the this array is one more than the +length of v.
    • +
    +
  • +
+

+The result of the raw-template-expr is the newly constructed object. +

+

+For each raw-template-expr there is a separate class, which +is a subtype of the RawTemplate type. The objects constructed by a +raw-template-expr belong to this class. The type of the +insertions field is determined from the contextually expected type +or the static type of the expressions in the BacktickString in the same way as +with a list-constructor-expr. The strings and +insertions fields will be read-only if required by the contextually +expected type. The value of the strings field is constructed once +by the class. The value of the insertions is +constructed once for each evaluation of the raw-template-expr. +

+ +
+
+ +
+

Structural constructors

+

+Each basic type of structure has its own expression syntax for constructing a +value of the type. +

+
structural-constructor-expr := list-constructor-expr | table-constructor-expr | mapping-constructor-expr
+
+ +

+An structural-constructor-expr occurring within a const-expr will construct a +structural value that has its read-only bit on. +

+ +
+

List constructor

+ +
list-constructor-expr := [ [ list-member-list ] ]
+list-member-list := list-member (, list-member)*
+list-member := single-list-member | spread-list-member
+single-list-member := expression
+spread-list-member := spread | aggregated-variable-reference
+spread := ... expression
+
+

+A list-constructor-expr creates a new list value. It is a compile-time error if +the static type of the expression in a spread in a spread-list-member is not a +subtype of list. The list is constructed by processing each list-member in the +order specified as follows. If the list-member is a single-list-member, then the +expression in the list-member is first evaluated resulting in a value +v and v is added to the list being constructed. If the +list-member is a spread, then the expression in the spread is evaluated and each +member of the resulting list is added in order to the list being constructed. An +aggregated-variable-reference is handled like the equivalent spread. +

+

+If there is a contextually expected type, then the inherent type of the newly +created list is derived from the applicable contextually expected type. If the +applicable contextually expected type is a list type descriptor, then that used +as the inherent type. If the applicable contextually expected type is a union +type descriptor, then it is a compile-time error unless there is exactly one +member of the union that is a list type descriptor and that allows list shapes +of a length that the static types of the expressions in the list-member-list +make it possible for the constructed list to have; this list type descriptor is +used as the inherent type. If there is a spread, and the type of its +expression is not fixed length, then the minimum of the total number of members +that may be added to the list being constructed by this spread-list-member and +any previous list-member must be greater than or equal to the minimum length +required by the inherent type. The static type of the list-constructor-expr will +be the same as the inherent type. +

+

+If there is no contextually expected type, then the inherent type will be a +tuple-type-descriptor derived from the static type of each expression in the +list-member-list. Each single-list-member that does not have a preceding +spread-list-member contributes a member-type-descriptor to the +tuple-type-descriptor; the type of the member-type-descriptor will be the broad +type of the expression in the single-list-member. If there is a +spread-list-member, then a tuple-rest-descriptor T... is added +where T is the smallest type such that the broad type of the expression in every +other single-list-member is a subtype of T, and the type of the +expression in each spread-list-member is a subtype of T[]. +

+

+If the list-constructor-expr does not have a contextually expected type, then +the contextually expected type for the expression in a spread-list-member is +(any|error)[], and the expression in a single-list-member does not +have a contextually expected type. Otherwise the contextually expected type for +each list-member is derived from the contextually expected type of the +list-constructor-expr. If there is a spread-list-member that is not the last +list-member in the list-member-list, then the contextually expected type used +from that point on is approximated with a tuple-rest-descriptor. +

+

+A member of a list can be filled in automatically if the FillMember abstract operation would succeed on it. The +inherent type of a list establishes either a fixed length for the list or just a +minimum length for the list, which may be zero. In either case, a list +constructor may specify only the first k members, provided that for +each i from k + 1 up to the fixed length of the list, the +i-th member can be filled in automatically. +

+ +
+
+

Mapping constructor

+ +
mapping-constructor-expr := { [field (, field)*] }
+field := 
+  specific-field
+  | computed-name-field
+  | spread-field
+specific-field :=
+   [readonly] (field-name | string-literal) : value-expr
+   | [readonly] variable-name
+value-expr := expression
+computed-name-field := [ field-name-expr ] : value-expr
+field-name-expr := expression
+spread-field := spread
+
+

+A mapping-constructor-expr creates a new mapping value. +

+

+A specific-field specifies a single field, where the field name is known at +compile-time. A specific-field that consists of just a variable name +x is equivalent to a field x: +x. +

+

+The static type of the expression in a spread-field must allow only mapping +values, i.e. must be a subtype of map<any|error>. All the +fields of the mapping value that results from evaluating that expression are +included in the mapping value being constructed. It is a compile-time error if +the static type of the expression in a spread-field allows a field that +duplicates a specific-field or that could also occur in another spread-field. +Note that a spread-field with an inclusive record type of record { never +x?; } cannot duplicate a specific field for x. +

+

+If there is a contextually expected type, then the inherent type of the newly +created mapping is derived from the applicable contextually expected type. If +the applicable contextually expected type is a mapping type descriptor, then +that used as the inherent type. If the applicable contextually expected type is +a union type descriptor, then any members of the union that are inconsistent +with the field names specified in a specific-field in the +mapping-constructor-expr will be ignored; it is a compile-time error if this +does not leave a single mapping type descriptor, which is then used as the +inherent type. The static type of the mapping-constructor-expr will be the same +as the inherent type. +

+

+If there is no contextually expected type, then the inherent type will be an +exclusive-record-type-descriptor with an individual-field-descriptor for each +specific-field; the type of each field-descriptor will be the broad type of the +value-expr in the field, unless the field is read-only in which case the type of +the field-descriptor will be the precise type. The static type of the expression +in every spread-field will also be added to the inherent type. If there are +fields specified as a computed-name-field, then there will also be a +record-rest-descriptor T..., where T is the union of +the broad types of the value-expr in all such fields. +

+

+If a specific-field does not use a string-literal for the name of the field and +the inherent type descriptor is a record type descriptor, then the record type +descriptor must include an individual-field-descriptor for that field. +

+

+If there is a specific-field with name x and there is a +contextually expected type that allows an x field but +does not allow a nil value for the x field, then the +static type of the value-expr for the x field may +include nil; if the result of evaluating the value-expr is nil, then no field +will be added to the constructed value. +

+

+Default values are added to the mapping value being constructed after fields +have been added for every specific-field and spread-field: if the inherent type +descriptor is a record type descriptor, then for each field-descriptor with name +f having a default-expression, if the mapping value so far +constructed does not have a field with name f, then the closure for +the default-expression is evaluated resulting in a value v, and +a field with name f and value v is added to the mapping +value. +

+

+If there is a contextually expected type, then the type that the inherent type +requires for each field provides the contextually expected type for the +value-expr in a field; otherwise there is no contextually expected type for the +value-expr for fields. If there is a contextually expected type, the +contextually expected type for the expression in a spread-field is map<T>, +where the T is the smallest type such that the inherent type is a subtype of +map<T>. The contextually expected type for a field-name-expr is string. +

+

+A computed-name-field specifies a single field, where the name of the field is +specified by an expression enclosed in square brackets. A +mapping-constructor-expr first constructs a mapping value without considering +any computed-name-field. The effect of a computed-name-field is to modify the +member of the mapping with the specified name after the mapping has been +constructed. If the modification is incompatible with the inherent type, then +the mapping-constructor-expr will panic. The modifications are performed in the +order in which the computed-name-fields occur in the mapping-constructor-expr. +

+

+When the inherent type is equivalent to a map-type-descriptor, the order in +which fields are added to mapping value being constructed (and thus the +iteration order of the fields) is the same as the order of the fields in the +mapping-constructor-expr, except that all fields specified by a +computed-named-field are added after all other fields. +

+

+If the applicable contextually expected type is a subtype of readonly, then the +mapping will be constructed with its read-only bit on. If the inherent type +makes a specific field readonly, then that field will be constructed with its +read-only bit on. A specific-field that starts with readonly will +also be constructed with its read-only bit on. The read-only bit of the +mapping value or field will be set only after the mapping value has been fully +constructed, including any field specified by a computed-name-field. +

+ +
+
+

Table constructor

+ +
table-constructor-expr := table [key-specifier] [ [row-list] ]
+row-list := mapping-constructor-expr (, mapping-constructor-expr)*
+
+

+A table-constructor-expr creates a new table value. The members of the table +come from evaluating each mapping-constructor-expr in the row-list in order. +

+

+For example, +

+ +
table key(email) [
+   { email: "sanjiva@weerawarana.org", firstName: "Sanjiva", lastName: "Weerawarana" },
+   { email: "jjc@jclark.com", firstName: "James", lastName: "Clark" }
+]
+
+

+The inherent type of the constructed table is a table type descriptor including +a key-specifier table<T> key(ks), where +T is the member type and ks is +the key sequence. The inherent type is determined from the contextually expected +type together with the table-constructor-expr. The static type of the +table-constructor-expr will be the same as this inherent type. +

+

+If there is a contextually expected type, then the member type of inherent type +of the newly created table is derived from the applicable contextually expected +type, which must be a table-type-descriptor. If there is no contextually +expected type, then the member type of the inherent type is derived from the the +static type of the expressions for the members: the member type will be the +smallest record type that is a supertype of the static types of all the +expressions in the row-list. It is an error if there is no contextually expected +type and the row-list is empty. +

+

+The key sequence of the inherent type comes from the key-specifier of applicable +contextually expected type or the key-specifier in the table-constructor-expr. +If both of these are present, then they must be the same. If neither of them are +present, then the key sequence is empty. The key sequence of the table value is +the same as that of its inherent type. The key sequence and member type must +meet the same consistency requirements as if they were specified together in a +table type descriptor. For every field-name in the key +sequence of the inherent type every mapping-constructor-expr in the row-list +must include a specific-field that has a value-expr that is a const-expr. It is +a compile-time error if two or more rows of the table have the same key value. +

+

+If there is a contextually expected type, then the type that the inherent type +requires for each table member provides the contextually expected type for the +expressions in the row-list; otherwise there is no contextually expected type +for these expressions. +

+ +
+
+ +
+

Object construction

+

+There are two kinds of expression that can be used to construct an object: with +an object constructor expression, the methods and fields of the constructed +object are defined within the expression; with a new expression, the methods and +fields come from a separate, named class definition. +

+ +
+

Object constructor

+ +
object-constructor-expr :=
+   [annots] object-type-quals object [type-reference] object-constructor-block
+object-constructor-block := { object-member* }
+object-member := object-field | method-defn | remote-method-defn | resource-method-defn
+
+

+The resulting of evaluating an object-constructor-expr is an +object. The object-constructor-expr must specify +client if any method-defn includes a +remote-qual. +

+

+The annotations applying to the object-constructor-expr and its +members are evaluated when the object-constructor-expr is +evaluated. This means that every object resulting from the evaluation of an +object-constructor-expr has its own type descriptor. +

+

+If there is a type-reference, then the referenced type is included +in the object's type in the same was as an object-type-inclusion, +and the type-ids of the constructed object are type-ids of the referenced type. +If there is no type-reference, then the applicable contextually +expected type T, if any, must be definite, and the type-ids of the constructed +object are the type-ids, if any, induced by T. +

+

+The object-constructor-expr is implicitly read-only if the +applicable contextually expected type is a subtype of readonly or if the +type-reference is present and references a type that is a subtype +of readonly. If the object-constructor-expr is implicitly +read-only, then the object will be constructed with its read-only bit on; +furthermore, in this case an object-type-inclusion is allowed to +directly or indirectly reference a readonly class. +

+

+The object-constructor-expr is explicitly isolated if +object-type-quals includes isolated or if the +type-reference is present and references an isolated object type. An +object-constructor-expr that is explicitly isolated will construct +an object with its isolated bit set. +

+ +
object-visibility-qual := public|private
+
+ +

+A visibility qualifier of private can be used within an +object-constructor-expr expression; this means that the visibility +region consists of every method-defn-body in the object-constructor-expr. +

+ +
+
Fields
+
object-field :=
+   metadata [object-visibility-qual] [final]
+   type-descriptor field-name [= field-initializer] ;
+field-initializer := expression
+
+

+An object-field declares and initializes a field of the object. +

+

+If a field does not specify a field-initializer, then there must be an +init method and the init method must initialize the +field. The field-initializer must meet the requirements for an isolated function +unless the init method is present and not declared as +isolated. +If the init method is not present, +it is a compile-time error if the expression in an +individual-field-descriptor contains a checking-expr with a checking-keyword of +check, i.e. if evaluation of the expression could complete abruptly +with a check-fail. +If the object-constructor-expr is implicitly +read-only, then the contextually expected type for a field-initializer will be +the intersection of readonly and the type specified in the type-descriptor of +the object-field. +

+

+If final is present, then the field must be assigned to exactly +once, either by its initializer or in the init method. +

+

+An object-constructor-expr will construct an object with its +read-only bit set if every object-field is declared as final and +has a type-descriptor that is a subtype of readonly. In this case, +the static type of the object-constructor-expr will be intersected +with readonly. +

+

+An object field is isolated if it is declared as final and +has a type-descriptor that is a subtype of readonly or +isolated object {}, or if the object-constructor-expr +is implicitly read-only. An object-constructor-expr is +implicitly isolated if it is implicitly readonly or if every object +field is isolated. An object-constructor-expr that is implicitly +isolated will construct an object with its isolated bit set. In this case, the +static type of the object-constructor-expr will be intersected with +isolated object {}. If the object-constructor-expr is +explicitly isolated, then every field-initializer must be an +isolated expression and any field that is not isolated must be declared as +private. +

+
+ +
+
Methods
+ +
method-defn :=
+   metadata object-visibility-qual method-quals
+   function method-name function-signature method-defn-body
+
+ +

+A method-defn defines a method of an object. +

+ +
method-defn-body := function-defn-body
+
+

+Within a method-defn-body, the fields and methods of the object are +not implicitly in-scope; instead the variable self is bound to the +object and can be used to access fields and methods of the object. The +self variable is implicitly final and cannot be modified. If the +object-constructor-expr is explicitly isolated, then the +self variable must be accessed only within the scope of a lock +statement, except when self is part of a +field-access-expr of the form self.f, where +f is the name of an isolated field. +

+

+If isolated-qual is present, then the method has its isolated bit +set and its method-defn-body must satisfy the requirements for an +isolated function. +

+ +
+ +
+
Remote methods
+ +
remote-method-defn :=
+   metadata remote-method-quals
+   function remote-method-name function-signature method-defn-body
+
+

+A remote-method-defn defines a remote method. This is allowed only +when an object-network-qual is present in the +object-constructor-expr. +

+ +
+ +
+
Resources
+ +
resource-method-defn :=
+   metadata resource-method-quals
+   function resource-method-name resource-path function-signature method-defn-body
+
+ +

+A resource-method-defn defines a resource method for one or more +resources. This is allowed only when an object-network-qual is +present in the object-constructor-expr. The semantics of +resource-method-defn extends the semantics of a +resource-method-decl by associating a function with each declared +resource method. +

+

+A network interaction object uses resource-method-defns to provide +a resource access operation. The inputs to the resource access operation are a +string giving the resource method name, a list of values for the resource path, +and a list of values for the argument list. The operation looks up the function +associated with the resource method name and resource path, and then invokes the +function with the supplied argument list. +

+

+The list of values supplied for the resource path are used to bind parameters +specified in the resource-path before the function is invoked. +These parameters are in scope in the method-defn-body. A parameter +in a resource-path-segment-param will be bound to the value at the +corresponding position in the list; a parameter in a +resource-path-rest-param will be bound to a list of all the values +from the corresponding position onwards. +

+

+The resource access operation of a service object is responsible for +implementing the delegation semantics of a resource method that returns a +service object. A resource-path is delegated if it occurs +in a resource-method-defn with a resource-method-name +of get and a return value that includes a service object type that +has one or more resources. If a resource access operation has a resource path +r, which has a prefix p (which may be the entire path) +that is delegated, then the get method that provides the delegation +is first called with no arguments but with resource parameters bound as usual +resulting in a value v; if v is an error, then the result +of the resource access operation is v; otherwise a resource access +operation is performed on the v with the resource path being +r with p removed. +

+ +
+ +
+
Initialization
+

+A method-defn with a method-name of init +is used to initialize the object and is treated specially. The return type of +the init method must be a subtype of the union of error and nil, +and must contain nil; if init returns an error, it means that +initialization of the object failed. +If the evaluation of a field-initializer completes abruptly with a check-fail +with associated value v, then the init method +returns v before its method-defn-body is executed; +the return type of the init method must be consistent with this. +

+

+The parameter list of an init method within an +object-constructor-expr must be empty. +

+

+At any point in the body of a init method, the compiler +determines which fields are potentially uninitialized. A field is potentially +uninitialized at some point if that field does not have an initializer and it +is not definitely assigned at that point. It is a compile error if a +init method: +

+
    +
  • accesses a field at a point where it is potentially initialized, or
  • +
  • at a point where there is any potentially uninitialized field +
      +
    • returns nil, or
    • +
    • uses the self variable other than to access or modify the value of a field.
    • +
    +
  • +
+

+If the object-constructor-expr is explicitly isolated, then a field +can only be assigned to by an assignment-stmt with a right hand +side that is an isolated expression. The requirement to access self +within a lock statement does not apply to the init method at any +point where there is any potentially uninitialized field. +

+

+The visibility of the init method cannot be private. +

+

+Any init method is not part of the shape of an object, and so does +not affect when an object value belongs to a type. The init method +can be called in a method-call-expr only when the expression +preceding the . is self. +

+

+A missing init method is equivalent to an isolated +init method with no parameters and an empty body (which will always +return nil). +

+
+ +
+
+

New expression

+ +
new-expr := explicit-new-expr | implicit-new-expr
+explicit-new-expr := new class-descriptor ( arg-list )
+class-descriptor := identifier | qualified-identifier | stream-type-descriptor
+
+

+A new-expr constructs a new object or stream. The class-descriptor in an +explicit-new-expr must refer to a class or a stream type. +

+

+When the class-descriptor refers to a class, the explicit-new-expr allocates +storage for an object of the type defined by the class and initializes it by +passing the supplied arg-list to the init method defined by the +class. It is a compile error if the type-descriptor if the arg-list does not +match the signature of the class's init method. If the result of +calling the init method is an error value e, then the result of +evaluating the explicit-new-expr is e; otherwise the result is the newly +initialized object. The explicit-new-expr is isolated if the type of the +init is isolated and the expression for every argument in the +arg-list is isolated. +

+

+When the class-reference refers to a stream type stream<T,E>, +the arg-list must either be empty or be a single argument belonging to object +type StreamImplementor<T,E?>. When the arg-list is empty, the result will +be an empty stream (i.e. a stream whose next method returns nil). When the +arg-list evaluates to a StreamImplementor object, the result will be a stream +that wraps that object. The explicit-new-expr is isolated if the the arg-list is +empty or if the expression for the single argument is isolated. +

+

+An explicit-type-expr specifying a class-descriptor T has static type T, except +that if T is an class type and the type of the init method is +E?, where E is a subtype of error, then it has static type T|E. +

+
implicit-new-expr := new [( arg-list )]
+
+

+An implicit-new-expr is equivalent to an explicit-new-expr that specifies the +applicable contextually expected type as the class-descriptor. An +implicit-new-expr consisting of just new is equivalent to +new(). It is an error if the applicable contextually expected type +is not a class or stream type. +

+
+
+
+

Variable reference expression

+ +
variable-reference-expr := variable-reference
+variable-reference := identifier | qualified-identifier | xml-qualified-name
+xml-qualified-name := xml-namespace-prefix NoSpaceColon identifier
+
+

+A variable-reference can refer to a variable, a parameter, a constant (defined +with a module constant declaration), a function, a type (defined with a module +type definition) or a class (defined with a module class definition). +

+

+When the variable reference has a prefix and the prefix has been declared using +an xmlns-decl rather than an import-decl, then the result of evaluating the +variable-reference-expr is a string of the form: +

+
+   {namespace-uri}local-name
+
+

+where the namespace-uri comes from xml-namespace-uri specified in the +xmlns-decl, and the local-name comes from the identifier following the colon. +

+

+If the variable-reference references a type defined with a module type +definition or a class defined with a module class definition, then the result of +evaluating the variable-reference-expr is a typedesc value for that type or +class. +

+

+A variable-reference-expr is isolated if it refers to an identifier bound by a +let-expr to an expression that is isolated. +

+

+A variable-reference-expr that refers to a variable declared by a +module-var-decl that includes isolated is only allowed within a +lock-stmt. +

+

+A variable-reference-expr cannot refer to an aggregated variable; an aggregated variable can +be referenced only by an aggregated-variable-reference. +

+
+
+

Field access expression

+ +
field-access-expr := expression . field-name
+
+

+A field-access-expr is typically used to access a field of an object or a field +of a record. More generally, it can be used to access a member of an object or a +member of a mapping. The semantics depends on the static type T of expression. A +field-access-expr where T is a subtype of xml is interpreted as an +xml-required-attribute-access-expr. +

+

+If T is a subtype of the object basic type, then T must have a member with name +field-name. The field-access-expr is evaluated by first evaluating the +expression to get a value obj. If the member is a field, then the +result of the expression if the value of that field of obj and the +static type of the field-access-expr is the type of that field of T. If that +member is a method, then the result of the expression is a new function value +that when called will call the method with self bound to +obj; the isolated bit of the new function value is set if and only if +the isolated bits of both obj and the method are set; the type +descriptor of the new function value will have the same annotations as the type +descriptor of the method. +

+

+Let T' be the intersection of T and basic type mapping, let K be the singleton type +containing just the string field-name, and let M be the member type for K in T'. +

+

+If the following all apply: +

+
    +
  • the type descriptor for T is not lax;
  • +
  • T is a subtype of the mapping basic type (i.e. T' is the same as T);
  • +
  • K is not a required key type for T;
  • +
  • the type descriptor for T includes field-name as an +individual-field-descriptor (or, if the type descriptor is a union, at least one +member of the union does so);
  • +
  • M does not include nil;
  • +
+

+then the field-access-expr is treated as an optional-field-access-expr. +Otherwise, the rest of this section applies. +

+

+The compile-time requirements on the field-access-expr depend on whether the +type descriptor describing T is lax: +

+
    +
  • if it is lax, then the only compile-time requirement is M is non-empty;
  • +
  • if it is not lax, then T must be a subtype of the mapping basic type and K +must be a required key type for T.
  • +
+

+The static type of field-access-expr is M|E, where E is empty if K is a required +key type and T' is a subtype of T, and error otherwise (E can only be error in +the lax case.) In the lax case, if M is lax, then the static type of the +field-access-expr is lax even if E is an error. +

+

+A field-access-expr is evaluated as follows: +

+
    +
  1. expression is evaluated resulting in a value v
  2. +
  3. if v has basic type error, the result is v (this can +only happen in the lax case)
  4. +
  5. otherwise, if v does not have basic type mapping, the result is a +new error value (this can only happen in the lax case)
  6. +
  7. otherwise, if v does not have a member whose key is field-name, +the result is a new error value (this can only happen in the lax case)
  8. +
  9. otherwise, the result is the member of v whose key is +field-name.
  10. +
+ +
+
+

Optional field access expression

+ +
optional-field-access-expr := expression ?. field-name
+
+

+An optional-field-access-expr accesses a possibly undefined mapping member, +returning () if the member does not exist. +

+

+An optional-field-access-expr where the static type of expression is +a subtype of xml is interpreted as an xml-optional-attribute-access-expr. +

+

+Let T be the static type of expression, let T' be the intersection of T and +basic type mapping, let K be the singleton type containing just the string +field-name and let M be the member type of K in T'. The compile-time +requirements on the optional-field-access-expr depend on whether the type +descriptor describing T is lax: +

+
    +
  • if it is lax, then the only compile-time requirement is that M is +non-empty;
  • +
  • if it is not lax, then, in addition, T must be a subtype of the union of +() and the mapping basic type, and the type descriptor for T must +include field-name as an individual-field-descriptor (if the type +descriptor is a union, then this requirement must be satisfied by at least one +member of the union).
  • +
+

+The static type of the optional-field-access-expr is M|N|E where +

+
    +
  • N is () if () is a subtype of T or K is not a +required key type for T', and empty otherwise;
  • +
  • E is error if T' is not a subtype of T?, and empty otherwise (E +can only be error in the lax case).
  • +
+ +

+An optional-field-access-expr is evaluated as follows: +

+
    +
  1. expression is evaluated resulting in a value v
  2. +
  3. if v is (), the result is ()
  4. +
  5. otherwise, if v has basic type error, the result is v +(this can only happen in the lax case)
  6. +
  7. otherwise, if v does not have basic type mapping, the result is a +new error value (this can only happen in the lax case)
  8. +
  9. otherwise, if v does not have a member whose key is field-name, +the result is ()
  10. +
  11. otherwise, the result is the member of v whose key is +field-name.
  12. +
+ +
+ +
+

XML attribute access expression

+ +
xml-attribute-access-expr := xml-required-attribute-access-expr | xml-optional-attribute-access-expr
+xml-required-attribute-access-expr := expression . xml-attribute-name
+xml-optional-attribute-access-expr := expression ?. xml-attribute-name
+xml-attribute-name := xml-qualified-name | qualified-identifier | identifier
+
+ +

+An XML attribute access expression provides convenient access to an attribute of +an XML element. It is a compile-time requirement that the static type of the +expression is a subtype of xml. +

+

+A string representing the name of the attribute is computed at compile-time from +the xml-attribute-name. When the xml-attribute-name is an identifier without a +prefix, the attribute name string is the identifier. When the xml-attribute-name +has a prefix, normally the xml-attribute-name is an xml-qualified-name, in which +the prefix is an xml-namespace-prefix declared using an xmlns-decl. In this +case, the xml-qualified-name is expanded at compile-time into an attribute name +string of the form +

+
+   {namespace-uri}local-name
+
+

+where the namespace-uri comes from xml-namespace-uri specified in the +xmlns-decl, and the local-name comes from the identifier following the colon. +

+

+It is also allowed for the xml-attribute-name to be specified as a +qualified-identifier, in which the prefix is a module-prefix declared using an +import-decl. In this case the qualified-identifier must refer to a +module-const-decl of type string, and the attribute name string is the value of +the referenced constant. This allows e.g. xml:lang to work. +

+

+An xml-optional-attribute-access-expr is evaluated as follows. The expression is +evaluated resulting in an xml value v. If v is an empty +xml value, the result is (). Otherwise, if v is not a +singleton element, the result is an error. Otherwise, let m be that +element's attribute map and let k be the attribute name string +computed at compile-time from the xml-attribute-name. If m has a +member s with key k, the the result is s. +Otherwise, the result is (). +

+

+An xml-required-attribute-access-expr is evaluated the same as an +xml-optional-attribute-expr, except that for cases where the result of the +xml-optional-attribute-expr would be (), the result of the +xml-required-attribute-access-expr is an error. +

+

+The static type of an xml-required-attribute-access-expr is +string|error The static type of an +xml-optional-attribute-access-expr is string|error|(). +

+ +
+
+

Annotation access expression

+ +
annot-access-expr := expression .@ annot-tag-reference
+
+

+The annot-tag-reference must refer to an annotation tag declared with an +annotation declaration. The static type of expression must be a subtype of +typedesc. +

+

+An annot-access-expr is evaluated by first evaluating +expression resulting in a typedesc value t. If t +has an annotation with the tag referenced by annot-tag-reference, +then the result of the annot-access-expr is the value of that +annotation; otherwise, the result is nil. +

+

+The static type of the annot-access-expr is T? where T is the type +of the annotation tag. +

+
+
+

Member access expression

+ +
member-access-expr := container-expression [ (key-expression | multi-key-expression) ]
+container-expression := expression
+key-expression := expression
+multi-key-expression := expression (, expression)+
+
+

+A member-access-expr accesses a member of a structured value using its key, +or a constituent of a sequence value using its index. +

+

+The requirements on the static type of container-expression and key-expression are as +follows: +

+
    +
  • if the static type of container-expression is a subtype of string or of xml +or of basic type list, then the contextually expected type for key-expression is +int and the static type of key-expression must be a subtype of int;
  • +
  • if the static type of container-expression is a subtype of table, then the +contextually expected type for key-expression is K and +the static type of key-expression must be a subtype of +K, where the static type of container-expression is +table<R> key<K>;
  • +
  • otherwise the static type of container-expression must be a subtype of the +union of nil and basic type map; in this case the contextually expected type for +key-expression is string and the static type of key-expression must be a subtype +of string.
  • +
+

+A multi-key-expression is allowed only when the static type of a +container-expression is a subtype of table. A multi-key-expression +E1, E2,..., En is equivalent to a +list-constructor-expr [E1, E2,..., +En]. +

+ +

+A member-access-expr is evaluated as follows: +

+
    +
  1. the container-expression is evaluated to get a value c;
  2. +
  3. the key-expression is evaluated to get a value k;
  4. +
  5. depending on the basic type of c +
      +
    • if it is string, and k is < 0 or ≥ the length of +c, then the evaluation completes abruptly with a panic; otherwise, +the result is a string of length 1 containing the character with index +k in c;
    • +
    • if it is xml, and k is < 0, then the evaluation completes +abruptly with a panic; if k is ≥ the length of c, then +the result is an empty xml value; otherwise, the result is a singleton xml +value containing the item with index k in c;
    • +
    • if it is list, and k is < 0 or ≥ the length of +c, then the evaluation completes abruptly with a panic; otherwise, +the result is the member of c with index k;
    • +
    • if it is table, then if c does not contain a member with key +k, the result is (); otherwise, the result is the member +of c with key k.
    • +
    • if it is mapping, then if c is () or c +does not contain a member with key k, the result is (); +otherwise, the result is the member of c with key k.
    • +
    +
  6. +
+

+Let T the static type of container-expression. If T is a subtype of string, then +the static type of the member-access-expr is string:Char, that is the subtype of +strings containing strings of length 1. If T is a subtype of xml<M>, then +the static type of the member-access-expr is M|E, where E is the type of the +empty xml value. If T is a subtype of table<R>, then the static type of +member-access-expr is R?. Otherwise, let K be the static type of key-expression +and let M be the member type of K in T; if T contains nil, or T is a subtype of +mapping and K is an optional key type for T, then the static type of the +member-access-expr is M?, otherwise the static type is M. +

+ +
+
+

Function call expression

+ +
function-call-expr := function-reference ( arg-list )
+function-reference := variable-reference
+arg-list :=
+   positional-args [, other-args]
+   | [other-args]
+other-args := named-args | rest-arg
+
+

+A function-call-expr is evaluated by constructing an argument list and passing +the argument list to the function referred to by the variable-name. The argument +list will be used to bind the parameters of the function before the body of the +function is executed. If the function terminates normally, then the result of +the function-call-expr is the return value of the function; otherwise the +function-call-expr completes abruptly with a panic. The static type of the +function-call-expr is the return type of the function type; this type is +permitted to be never. +

+

+The function-reference must refer to a variable with function type. The type +descriptor of that function type is used to construct an argument list from the +specified arg-list. Note that it is the type descriptor of the declared type of +the variable that is used for this purpose, rather than the runtime type +descriptor of the referenced function value. The expressions occurring in the +arg-list are evaluated in the order in which they occur in the arg-list; the +contextually expected type for the expression comes from the static type +required for the expression as specified below. +

+

+If the function-reference is an unqualified identifier +f, the arg-list has a rest-arg and no positional-args, +and the rest-arg is an aggregated-variable-reference of type T, then the +function-reference is treated as referring to a function +f in a module lang.M of the lang library, where M is +selected as follows. +

+
    +
  • If T is a subtype of B[], where B is a basic type with with corresponding +langlib module lang.B and the module lang.B contains a function +f, then M is B. The module corresponding to each basic +type is listed in the Lang library modules +section.
  • +
  • Otherwise, M is value.
  • +
+

+In this case, if the langlib function requires at least one argument, but T +allows the empty list, then the evaluation of the function-call-expr will first +check whether the aggregated-variable-reference refers to an empty list, and, if +so, the result of the function-call-expr will be nil; the return type of the +langlib function will accordingly be unioned with nil. +

+
positional-args := positional-arg (, positional-arg)*
+positional-arg := expression
+
+

+The result of evaluating the i-th positional-arg becomes the +i-th member of the argument list. The static type of the expression +for the i-th positional-arg must be a subtype of the type declared +for the i-th parameter that is not a rest-param, if there is such a +parameter; otherwise, there must be a rest-param and the static type must be a +subtype of the type declared for the rest-param. +

+
named-args := named-arg (, named-arg)*
+named-arg := arg-name = expression
+arg-name := identifier
+
+

+The arg-name of every named-arg must be distinct. Each named-arg must correspond +to either a parameter that is not a rest-param or to a field of an +included-record-param. In the latter case, there are two possibilities. +

+
    +
  • The field is described by an individual-field-descriptor with a type that is not +never.
  • +
  • The field is described by a record-rest-descriptor, either explicitly as +part of an exclusive-record-type-descriptor or implicitly as part of an +inclusive-record-type-descriptor. In this case: +
      +
    • for every parameter name and every individual-field-descriptor of an +included-record-param with a type that is not never, the +record-type-descriptor must include an individual-field-descriptor that has type +never and is optional, and so disallows a field with that +name;
    • +
    • the record-type-descriptor must not include any other +individual-field-descriptor; and
    • +
    • there must be no other included-record-param with a +record-rest-descriptor.
    • +
    +
  • +
+

+It is an error if there is a named-arg and a positional-arg that correspond to +the same parameter. If there is a named-arg or positional-arg corresponding to +an included-record-param, it is an error for a named-arg to specify a field of +that included-record-param. The static type of the expression of the named-arg +must be a subtype of the type declared for the corresponding parameter or +field-descriptor. +

+
rest-arg := spread | aggregated-variable-reference
+
+

+The static type of the expression in a spread in a rest-arg must be either a +list type or a mapping type. If it is a list type, then the rest-arg is +equivalent to specifying each member of the list as a positional-arg. If it is a +mapping type, then the rest-arg is equivalent to specifying each field of the +mapping as a named-arg, with the name and value of the named-arg coming from the +name and value of the field. In either case, the static type of the expression +must be such as to ensure that the equivalent named-args or positional-args +would be valid. An aggregated-variable-reference is handled like the equivalent spread. +

+

+If there is neither a named-arg nor a positional-arg for a parameter that is not +a rest-param, then a default value is computed for the parameter, if possible; +otherwise, it is an error. Default values are computed in parameter declaration +order. +

+
    +
  • If the parameter is a required-param, it is an error.
  • +
  • If the parameter is a defaultable-param, then the value for the parameter is +computed from the default value in the function's type descriptor. +
      +
    • If the default value for a defaultable-param was specifed +using an expression, then it is computed by calling the closure stored in the +type descriptor, passing it the previous arguments in the argument list.
    • +
    • If the default value for a defaultable-param was specified as +<>, then the value for the parameter will be a typedesc value +determined at compile-time from the contextually expected type of the +function-call-expr as follows. Let the name of the parameter for which a default +of <> was specified be t. Let the type of +t be typedesc<T>. Let the return type descriptor for +the function be R, which will have references to t. Let +the contextually expected type for the function-call-expr be C. Then +the default value is found by unifying C and R: the +default value is a typedesc value that describes the maximal type S, +such that S is a subtype of T, and R with +S substituted for t is a subtype of C.
    • +
    +
  • +
  • If the parameter is an included-record-param, then a new mapping value is +constructed for it using its record-type-descriptor. The mapping value will have +a field for each named-arg that corresponds to a field of this +included-record-param, with the name and value of the field coming from the name +and value of the named-arg. The mapping value will also have a field for each +individual-field-descriptor with a default-expr for which there was no +corresponding named-arg. It is an error if the record-type-descriptor has an +individual-field-descriptor that is not optional and has no default and there is +not corresponding named-arg.
  • +
+

+A function-call-expr is isolated if the type of the function being called is +isolated and the expression for every argument is isolated. In addition, a call +to the clone or cloneReadOnly functions defined by the +lang.value module of the lang library is always isolated. +

+

+When there is a need to call a function value resulting from the evaluation of +an expression, the result of the expression evaluation can be assigned to a +variable and then the function called by using a reference to the variable. +

+
+
+

Method call expression

+ +
method-call-expr := expression . method-name ( arg-list )
+
+

+A method-call-expr either calls an object's method, calls an +object's field where the type of the field is a function or calls a function in +the lang library. The static type of the method-call-expr is the return type of +the function type of the function that is called; this type is permitted to be +never. The evaluation of the method-call-expr starts by evaluating +expression resulting in some value v. There is no +contextually expected type for expression. +

+

+If the static type of expression is a subtype of object, and the +object type includes a method named method-name, then the +method-call-expr is executed by calling that method on +v. The arg-list is used to construct an argument list +that is passed to the method in the same way as with a +function-call-expr. A method-call-expr cannot be used +to call a remote method. A remote method of a client object can be called by a +client-remote-method-call-action. In this case, a method-call-expr +is isolated if the expression preceding . is isolated, the +expression for each argument in the arg-list is isolated and the type of the +method being called is isolated. +

+

+Otherwise, if the static type of expression is a subtype of object, +and the object type includes a field named method-name with a +function type, then the method-call-expr is executed by calling the +value of that field. The arg-list is used to construct an argument +list that is passed to the method in the same way as with a +function-call-expr. In this case, a method-call-expr is isolated if +the type of the function is isolated and the expression for each argument in the +arg-list is isolated. +

+

+Otherwise, the method-call-expr will be turned into a call to a +function in the lang library m:method-name(expression, arg-list), +where m is an automatically created module prefix for a module lang.M of the lang +library, where M is selected as follows. +

+
    +
  • If the static type of expression is a subtype of basic type +with corresponding langlib module lang.B and the module lang.B contains a +function method-name, then M is B. The module corresponding to each +basic type is listed in the Lang library +modules section.
  • +
  • Otherwise, M is value.
  • +
+

+It is a compile-time error if the resulting function call does not satisfy all +the constraints that would apply if it has been written explicitly as a +function-call-expr. The method-call-expr expression is +isolated under the same conditions that the corresponding +function-call-expr would be isolated. +

+
+
+

Error constructor

+ +
error-constructor-expr := error [error-type-reference] ( error-arg-list )
+error-arg-list := positional-arg [, positional-arg] (, named-arg)*
+
+

+An error constructor constructs a new error value. If an error-type-reference is +specified, it must denote a type that is a subtype of error; the effect is the +same as making the contextually expected type be that specified by the +error-type-reference. If there is no applicable contextually expected type, then +it is the same as if there were a contextually expected type of +error. +

+

+The applicable contextually expected type E must be definite. The type-ids of +the constructed error value are those induced by E. Note that it is allowed for +E to refer to an intersection-type-descriptor. +

+

+The first positional-arg is of type string and specifies the error message; the +second positional-arg, if present, is of type error?, with a +default of nil, and specifies the cause. +

+

+Evaluating the error-constructor-expr constructs a new detail mapping. Each +named-arg specifies a field of the error detail mapping; the static type of each +named-arg must be a subtype of value:Cloneable. The type descriptor +E implies a type descriptor D for the detail mapping. The arg-name of every +named-arg must be specified as the field-name of an individual-field-descriptor +occurring in D, unless there are no such field names. Fields with default +values will also be added to the detail record based on D in the same way as the +mapping-constructor-expr adds fields with default values based on the +contextually expected type. The contextually expected type for each named-arg is +determined from D in the same way as for a mapping-constructor-expr. The detail +mapping is constructed as immutable, with its members being the result of +applying the ImmutableClone abstract operation to the result of evaluating each +named-arg and every defaultable arg. +

+

+The stack trace in the constructed error value describes the execution stack at +the point where the error constructor was evaluated. +

+ +
+
+

Anonymous function expression

+ +
anonymous-function-expr := explicit-anonymous-function-expr | infer-anonymous-function-expr
+explicit-anonymous-function-expr := [annots] function-quals function function-signature (block-function-body|expr-function-body)
+
+

+Evaluating an anonymous-function-expr creates a closure, whose basic type is +function. With an explicit-anonymous-function-expr, the type of the function is +specified explicitly as usual with a function-signature. With an +infer-anonymous-function-expr, the type of the function is inferred. +

+

+If a variable-reference-expr within an anonymous-function-expr refers to a local +variable defined outside of the anonymous-function-expr, the closure will +capture a reference to that variable; the captured reference will refer to the +same storage as the original reference rather than to a copy. +

+ +
infer-anonymous-function-expr := infer-param-list expr-function-body
+infer-param-list :=
+   identifier
+   | ([identifier (, identifier)*])
+
+

+An infer-anonymous-function-expr can only be used in a context where a function +type is expected. Both the types of the parameters and whether the function type +is isolated are inferred from the expected function type. The +function type will be inferred to be transactional if the +expr-function-body calls any functions with a transactional type. +The scope of the parameters is expr-function-body. +The static type of the infer-anonymous-function-expr will be a function type +whose return type is the static type of the expression in +expr-function-body. If the contextually expected type for the +anonymous-function-expr is a function type with return type T, then +the contextually expected type for expression in +expr-function-body is T. +

+
+ +
+

Let expression

+ +
let-expr := let let-var-decl [, let-var-decl]* in expression
+let-var-decl := [annots] typed-binding-pattern = expression
+
+ +

+A let-expr binds variables and then evaluates an expression with those variables in scope. +

+

+A let-expr let T B = E1 in E2 is evaluated as +follows. E1 is evaluated resulting in a value v. The typed binding +pattern T B is matched to v, causing assignments to the variables occuring in B. +Then E2 is evaluated with those variables in scope; the resulting +value is the result of the let-expr. +

+

+A let-expr let D1, D2,...,Dn in E +is transformed into let D1 in let D2 in ... let +Dn in E. +

+

+The typed-binding-pattern is used unconditionally, meaning that it is a compile +error if the static types do not guarantee the success of the match. If the +typed-binding-pattern uses var, then the type of the variable is +inferred from the precise static type of the expression following +=. +

+

+Since expressions cannot modify variables, the variables bound in a let-var-decl +are implicitly final. A let-expr is isolated if the expression following +in is isolated; a reference in that expression to a variable bound +by a let-var-decl will be treated as isolated if the expression initializing the +variable in the let-var-decl is isolated. +

+ +
+ +
+

Type cast expression

+ +
type-cast-expr := < type-cast-param > expression
+type-cast-param := [annots] type-descriptor | annots
+
+

+A type-cast-expr casts the value resulting from evaluating +expression to the type described by the type-descriptor, performing +a numeric conversion if required. +

+

+Normally, the parameter for a type-cast-expr includes a type-descriptor. +However, it is also allowed for the parameter to consist only of annotations; in +this case, the only effect of the type cast is for the contextually expected +type for expression to be augmented with the specified annotations. The rest of +this subsection describes the normal case, where the type-cast-expr includes a +type-descriptor. +

+

+A type-cast-expr is evaluated by first evaluating expression +resulting in a value v. Let T be the type described by +type-descriptor. If v belongs T, then the result of the +type-cast-expr is v. Otherwise, if T includes shapes from exactly one basic +numeric type N and v belongs to another basic numeric type, then let n be +NumericConvert(N, v); if n is not an error and n belongs to T, then the result +of the type-cast-expr is n. Otherwise, the evaluation of the type-cast-expr +completes abruptly with a panic. +

+

+Let T be the static type described by type-descriptor, and let TE +be the static type of expression. Then the static type of the +type-cast-expr is the intersection of T and TE', where TE' is TE +with its numeric shapes transformed to take account of the possibility of the +numeric conversion specified in the previous paragraph. +It is a compile-time error to attempt to use a type cast to +cast away an error: if the intersection of TE and error is +non-empty, then the intersection of T and error must also be +non-empty. A checkpanic expression can be used instead to assert +that the result of an expression will never be an error. +

+

+The contextually expected type for expression is the intersection +of the contextually expected type of the type-cast-expr and the +type described by the type-descriptor. +

+

+Note that a type-cast-expr of <readonly> can be +used both to cause constructors withing the expression to construct +values with the read-only bit on and to verify that the value resulting from +the evaluation of expression has its read-only bit on. +

+ +
+
+

Typeof expression

+ +
typeof-expr := typeof expression
+
+

+The result of a typeof-expr is a typedesc value for the runtime +type of v, where v is the result of evaluating expression. +

+

+The runtime type of v is the narrowest type to which v belongs. +

+
    +
  • When v is a simple value, the resulting typedesc will describe a type +consisting of a single shape, which is the shape of the value. The typedesc will +not have any annotations. Each evaluation of typeof with a simple +value produces a new typedesc value.
  • +
  • When v is a reference value, each evaluation of typeof with an +identical reference value produces an identical typedesc value. The type +descriptor resulting from typeof will be the same as the type +descriptor used to construct the value. For containers, this is the same as the +inherent type; when the container is immutable, it will be a singleton type. For +an object, this is the same as the type descriptor used with new. For an error, +this is the same as the type descriptor used in the functional-constructor-expr. +Any annotations that were attached to the type descriptor used to construct the +value will this be available on the constructed value.
  • +
+

+The static type of typeof-expr is typedesc<T>, where T is the +static type of expression. +

+
+
+

Unary expression

+ +
+

Unary numeric expression

+
unary-numeric-expr :=
+   + expression
+   | - expression
+   | ~ expression
+
+

+The operators occurring in a unary-numeric-expr have both lifted +form, which is specified in the Nil lifting section, +and an underlying form, which is specified in this section. +

+

+The unary - operator performs negation. The static type of the +operand must be a number; the static type of the result is the basic type of the +static type of the operand, modified by the usual singleton typing rules. The semantics for each +basic type are as follows: +

+
    +
  • int: negation for int is the same as subtraction from zero; a panic will +occur on overflow, which happens when the operand is -263)
  • +
  • float, decimal: negation for floating point types corresponds to the negate +operation as defined by IEEE 754-2008 (this is not the same as subtraction from +zero);
  • +
+

+If the contextually expected type for a - expression is T, then the +contextually expected type for the operand expressions is T', where a value v is +in T' if it belongs to int, decimal or float, and T contains a value with the +same basic type as v. +

+

+The unary + operator returns the value of its operand expression. The static +type of the operand must be a number, and the static type of the result is the +same as the static type of the operand expression, modified by the usual singleton typing rules. +

+

+The ~ operator inverts the bits of its operand expression. The +static type of the operand must be int, and the static type of the result is +int, modified by the usual singleton typing +rules. +

+
+ +
+

Unary logical expression

+
unary-logical-expr := ! expression
+
+

+The ! operator performs logical negation. The static type of the +operand expression must be boolean. The ! operator returns true if +its operand is false and false if its operand is true. The static type of the +result is boolean, modified by the usual singleton +typing rules. +

+
+
+ +
+

Multiplicative expression

+ +
multiplicative-expr :=
+   expression * expression
+   | expression / expression
+   | expression % expression
+
+

+The * operator performs multiplication; the / operator +performs division; the % operator performs remainder. These +operators have both lifted form, which is specified in the Nil lifting section, and an underlying form, which is +specified in this section. +

+

+The static type of each operand must be a subtype of int, +float or decimal. If the static type of both operands +is not a subtype of the same basic type, then either the second operand must be +a subtype of int, or the operator must be * and the +first operand must be a subtype of int; in either case, the +int operand is first converted to the type of the other operand. +

+

+The operation performed depends on the basic type of the operands as follows: +

+
    +
  • int +
      +
    • * performs integer multiplication; a panic will occur on overflow
    • +
    • / performs integer division, with any fractional part discarded +ie with truncation towards zero; a panic will occur on division by zero or +overflow, which happens if the first operand is -263 and the second +operand is -1
    • +
    • % performs integer remainder consistent with integer division, +so that if x/y does not result in a panic, +then (x/y)*y + +(x%y) is equal to x; a +panic will occur if the second operand is zero; if the first operand is +-263 and the second operand is -1, then the result is 0
    • +
    +
  • +
  • float, decimal +
      +
    • * performs the multiplication operation with the destination +format being the same as the source format, as defined by IEEE 754-2008; this +never causes a panic to occur
    • +
    • / performs the division operation with the destination format +being the same as the source format, as defined by IEEE 754-2008; this never +causes a panic to occur
    • +
    • % performs a remainder operation; the remainder is not the +IEEE-defined remainder operation but is instead a remainder operation analogous +to integer remainder; more precisely, +
        +
      • if x is NaN or y is NaN or +x is an infinity or y is a zero, +then x % y is NaN
      • +
      • for finite x, and infinite y, x % +y is x
      • +
      • for finite x and finite non-zero +y, x % y is equal to +the result of rounding x - (y × n) +to the nearest representable value using the roundTiesToEven rounding mode, +where n is the integer that is nearest to the +mathematical quotient of x and y +without exceeding it in magnitude; if the result is zero, then its sign is that +of x
      • +
      • no exceptions are thrown
      • +
      +
    • +
    +
  • +
+

+The static type of the result of a multiplicative-expr is the basic type of its +subexpressions, after conversion, modified by the usual singleton +typing rules, except that the result type is always float in +the case where the operator is / and the right-hand operand is +singleton float 0.0. (This is a consequence of the fact that +0.0 == -0.0, but 1.0/0.0 != 1.0/-0.0.) +

+

+If the contextually expected type for a multiplicative-expr is T, then the +contextually expected type for both operand expressions is T', where a value v is +in T' if it belongs to int, decimal or float, and T contains a value with the +same basic type as v. +

+
+
+

Additive expression

+ +
additive-expr :=
+   expression + expression
+   | expression - expression
+
+

+The + operator is used for both addition and concatenation; the +- operator is used for subtraction. These operators have both +lifted form, which is specified in the Nil lifting +section, and an underlying form, which is specified in this section. +

+

+It is required that either: +

+
    +
  • the static type of both operand expressions is a subtype of the same basic +type, in which case the static type of the result will be this basic type, +modified by the usual singleton typing rules; +or
  • +
  • the static type of one operand expression must be a subtype of xml and of +the other operand expression must be a subtype of string, in which case the +static type of the result is xml.
  • +
+

+The semantics for each basic type is as follows: +

+
    +
  • int +
      +
    • + performs integer addition; a panic will occur on +overflow
    • +
    • - performs integer subtraction; a panic will occur on +overflow
    • +
    +
  • +
  • float, decimal +
      +
    • + performs the addition operation with the destination format +being the same as the source format, as defined by IEEE 754-2008; this never +causes a panic to occur
    • +
    • - performs the subtraction operation with the destination +format being the same as the source format, as defined by IEEE 754-2008; this +never causes a panic to occur
    • +
    +
  • +
  • string, xml +
      +
    • if both operands are a string, then the result is a string that is the +concatenation of the operands
    • +
    • if both operands are xml, then the result is a new xml value that is the +concatenation of the operands; this does not perform a copy on +the constituents of the operand values
    • +
    • if one operand is an empty string and one is xml, then +the result is the xml value operand
    • +
    • if one operand is a non-empty string and one is xml, then the string is +treated as if it were an xml singleton text value whose characters are the same +as the characters of the string;
    • +
    +
  • +
+

+If the contextually expected type for an additive-expr is T, then the +contextually expected type for both operand expressions is T', where a value v is +in T' if it belongs to int, decimal, float, string or xml and T contains a value +with the same basic type as v. +

+ +
+
+

Shift expression

+ +
shift-expr :=
+   expression << expression
+   expression >> expression
+   expression >>> expression
+
+

+A shift-expr performs a bitwise shift. The shift operators have both lifted +form, which is specified in the Nil lifting section, +and an underlying form, which is specified in this section. +

+

+Both operand expressions must have static type that is a subtype of int. The +left hand operand is the value to be shifted; the right hand value is the shift +amount; all except the bottom 6 bits of the shift amount are masked out (as if +by x & 0x3F). Then a bitwise shift is performed depending on the operator: +

+
    +
  • << performs a left shift, the bits shifted in on the +right are zero
  • +
  • >> performs a signed right shift; the bits shifted in on the +left are the same as the most significant bit
  • +
  • >>> performs a unsigned right shift, the bits shifted in on the +left are zero
  • +
+

+If the operator is >> or >>> and the left hand operand is a +subtype of int:UnsignedK when K +is 8, 16 or 32, then the static type of the result is +int:UnsignedN where N is the +smallest such K; otherwise, the static type of the +result is int. In all cases the static type of the result is +modified by the usual singleton typing rules. +

+
+
+

Range expression

+ +
range-expr :=
+   expression ... expression
+   | expression ..< expression
+
+

+The result of a range-expr is a new object belonging to the object type +Iterable<int,()> that will iterate over a sequence of integers in increasing +order, where the sequence includes all integers n such that +

+
    +
  • the value of the first expression is less than or equal to n, and
  • +
  • n is +
      +
    • if the operator is ..., less than or equal to the value of the +second expression
    • +
    • if the operator is ..<, less than the value of the second +expression
    • +
    +
  • +
+

+It is a compile error if the static type of either expression is not a subtype +of int. +

+

+A range-expr is designed to be used in a foreach statement, but it can be used +elsewhere. +

+

+A range-expr is always isolated. +

+
+
+

Relational expression

+ +
relational-expr :=
+   expression < expression
+   | expression > expression
+   | expression <= expression
+   | expression >= expression
+
+

+A relational-expr tests the relative order of two values. There must be an ordered type to which the static type of both operands +belong. The static type of the result is boolean, modified by the usual singleton typing rules. +

+

+A relational-expr is evaluated by first evaluating the two expressions, +resulting in values x and y. The result of relational-expr is true if and only +if the result of the Compare(x,y) operation is +

+
    +
  • LT, if the operator is <
  • +
  • GT, if the operator is >
  • +
  • LT or EQ, if the operator is <=
  • +
  • GT or EQ, if the operator is >=
  • +
+

+and otherwise false. +

+
+
+

Type test expression

+ +
is-expr :=
+   expression is type-descriptor
+   | expression ! is type-descriptor   
+
+

+An is-expr tests whether a value belongs to a type. +

+

+An is-expr is evaluated by evaluating the expression yielding a result v. +If the operator is is, then the result of the expression is true if +v belongs to the type denoted by the type-descriptor, and otherwise false. If +the operator is !is, then the result of the expression is false if +v belongs to the type denoted by the type-descriptor, and otherwise true. +

+
+
+

Equality expression

+ +
equality-expr :=
+   expression == expression
+   | expression != expression
+   | expression === expression
+   | expression !== expression
+
+

+An equality-expr tests whether two values are equal. For all four operators, it +is a compile time error if the intersection of the static types of the operands +is empty. +

+

+The === operator tests for exact equality. The !== operator results in the +negation of the result of the === operator. Two values v1 and +v2 are exactly equal if they have the same basic type T and +

+
    +
  • T is simple type, and v1 and v2 are identical values +within the possible of values allowed for T;
  • +
  • T is a sequence type, and the length of v1 is the same as the length of v2 and +
      +
    • the length is 1, and either +
        +
      • v1 and v2 both have storage identity and that storage +identity is the same, or
      • +
      • v1 and v2 both do not have storage identity and the +shape of v1 is the same as the shape of v2
      • +
      +
    • +
    • the length is not 1, and every constituent of v1 is exactly equal +as the corresponding constituent of v2;
    • +
    +
  • +
  • T is a structural or behavioural type, and the storage identity of +v1 is the same as the storage identity of v2.
  • +
+

+The == operator tests for deep equality. The != operator results in the negation +of the result of the == operator. For both == and !=, at least one of the operands must have a +static type that is a subtype of anydata. Two values v1, v2 are deeply equal if +DeepEquals(v1, v2) is true. +

+

+The static type of the result of expression is boolean; in the case of the == +and != operators, the static type is modified by the usual singleton typing rules; in the case of the === and +!== operators, the static type is not so modified. +

+

+Note that === and == are the same for simple values except for floating point types. +

+

+For the float type, the operators differ as regards floating point zero: == +treats positive and negative zero from the same basic type as equal whereas === +treats them as unequal. Both == and === treat two NaN values from the same basic +type as equal. This means that neither of these operators correspond to +operations defined by IEEE 754-2008, because they do not treat NaN in the +special way defined for those operations. +

+

+For the decimal type, the operators differ in whether they consider the +precision of the value. For example, 1.0 == 1.00 is true but +1.0 === 1.00 is false. +

+ +
+
+

Binary bitwise expression

+ +
binary-bitwise-expr :=
+   bitwise-and-expr
+   | bitwise-xor-expr
+   | bitwise-or-expr
+bitwise-and-expr := expression & expression
+bitwise-xor-expr := expression ^ expression
+bitwise-or-expr := expression | expression
+
+

+A binary-bitwise-expr does a bitwise AND, XOR, or OR operation on its operands. +These operators have both lifted form, which is specified in the Nil lifting section, and an underlying form, which is +specified in this section. +

+

+The static type of both operands must be a subtype of int. The static type of +the result is as follows: +

+
    +
  • for AND, if the type of either operand is a subtype of +int:UnsignedK when K is 8, 16 or +32, then the static type of the result is int:UnsignedN +where N is the smallest such K; +otherwise, the static type of the result is int;
  • +
  • for XOR or OR, if the type of both operands is a +subtype of int:UnsignedK when K +is 8, 16 or 32, then the static type of the result is +int:UnsignedN where N is the +smallest such K; otherwise, the static type of the result +is int.
  • +
+

+In all cases, the static type of the result is modified by the usual singleton typing rules. +

+
+ +
+

Logical expression

+ +
logical-expr := logical-and-expr | logical-or-expr
+logical-and-expr := expression && expression
+logical-or-expr := expression || expression
+
+ +

+The static type of each expression in a logical-expr must be a subtype of +boolean. +

+

+A logical-and-expr is evaluated as follows: +

+
    +
  1. the left-hand expression is evaluated, resulting in a value x;
  2. +
  3. if x is false, then the result of the +logical-and-expr is x, and the right-hand expression is not +evaluated;
  4. +
  5. otherwise, the result of the logical-and-expr is the result of evaluating +the right-hand expression.
  6. +
+

+A logical-or-expr is evaluated as follows: +

+
    +
  1. the left-hand expression is evaluated, resulting in a value x;
  2. +
  3. if x is true, then the result of the +logical-or-expr is x, and the right-hand expression is not +evaluated;
  4. +
  5. otherwise, the result of the logical-or-expr is the result of evaluating +the right-hand expression.
  6. +
+ +

+The static type of the result of a logical-expr is boolean, modified by the +usual singleton typing rules. Furthermore: +

+
    +
  • if the expression is a logical-and-expr and the static type of left-hand +expression is singleton false, then the static type of the result is singleton +false, regardless of the static type of the right-hand-expression;
  • +
  • if the expression is a logical-or-expr and the static type of left-hand +expression is singleton true, then the static type of the result is singleton +true, regardless of the static type of the right-hand-expression.
  • +
+ +
+ +
+

Conditional expression

+ +
conditional-expr :=
+  ternary-conditional-expr
+  | nil-conditional-expr
+ternary-conditional-expr := expression ? expression : expression
+nil-conditional-expr := expression ?: expression
+
+

+A ternary-conditional-expr C ? T : F is evaluated as +follows: +

+
    +
  1. evaluate C to get a value boolean value v;
  2. +
  3. if v is true, then the result is the result of evaluating T.
  4. +
  5. Otherwise, the result is the result of evaluating F.
  6. +
+

+In a ternary-conditional-expr C ? T : F, the static +type of C must be a subtype of boolean, and the static type of the result is +determined from ther static types of C, T and F as follows: +

+
    +
  1. if the static type of C is singleton true, then the static +type of the result is the static type of T;
  2. +
  3. if the static type of C is singleton false, then the static +type of the result is the static type of F;
  4. +
  5. otherwise, the static type of the result is the union of the static types of +T and F.
  6. +
+

+A nil-conditional-expr L ?: R is evaluated as follows: +

+
    +
  1. evaluate L to get a value v;
  2. +
  3. if v is not nil, then the result is v;
  4. +
  5. otherwise, the result is the result of evaluating R.
  6. +
+

+The static type of the result of L ?: R is determined from the +static types of L and R as follows: +

+
    +
  1. if the static type of L is nil, then the static type of +the result is the static type of R;
  2. +
  3. if the static type of L does not include nil, then the static type of +the result is the static type of L;
  4. +
  5. otherwise, the static type of the result is the union of the difference of +the static type of L and (), and the static type of R.
  6. +
+
+ +
+

Checking expression

+ +
checking-expr := checking-keyword expression
+checking-keyword := check | checkpanic
+
+

+Evaluates expression resulting in value v. If v has basic type error, then +

+
    +
  • if the checking-keyword is check, then the checking-expr +completes abruptly with a check-fail with associated value v;
  • +
  • if the checking-keyword is checkpanic, then the checking-expr +completes abruptly with a panic with associated value v.
  • +
+

+If the static type of expression Expr is T|E, where E is +a subtype of error, then the static type of check Expr +or checkpanic Expr is T. However, if: +

+
    +
  • the checking-keyword is check,
  • +
  • the above rules would result in a compile-time error,
  • +
  • the static type of Expr is lax,
  • +
  • T is a subtype of json, and
  • +
  • there is a contextually expected type S, where S is a subtype of +()|boolean|int|float|decimal|string,
  • +
+

+then instead check Expr is treated as check +val:ensureType(Expr, s), where +s is a typedesc value representing S and +val refers to the value module in langlib. +

+
+
+

Trap expression

+

+The trap expression stops a panic and gives access to the error value associated +with the panic. +

+
trap-expr := trap expression
+
+

+Semantics are: +

+
    +
  • Evaluate expression resulting in value v +
      +
    • If evaluation completes abruptly with panic with associated value e, then +result of trap-exp is e
    • +
    • Otherwise result of trap-expr is v
    • +
    +
  • +
  • If type of expr is T, then type of trap expr is +T|error. It is permitted for T to be never.
  • +
+
+ +
+

Query expression

+

+Query expressions provide a language-integrated query feature using SQL-like +syntax. +

+
query-expr := query-select-expr | query-collect-expr
+query-select-expr := [query-construct-type] query-pipeline select-clause [on-conflict-clause]
+query-collect-expr := query-pipeline collect-clause
+query-pipeline := from-clause intermediate-clause*
+intermediate-clause :=
+   from-clause
+   | where-clause
+   | let-clause
+   | join-clause
+   | limit-clause
+   | order-by-clause
+   | group-by-clause
+
+

+A query expression consists of a sequence of clauses. The semantics of clauses +is specified in terms of transforming a sequence of frames, where a frame is a +binding of variables to values. The input to each clause is a sequence of +frames. +

+

+The initial part of a query expression is a pipeline, where each clause outputs +a sequence of frames; the sequence of frames output by one clause become the +input to the next clause. As each clause in the pipeline is executed, it +iterates over its input frames and emits output frames. The pipeline is executed +lazily, with each clause pulling input from its preceding clause. The input to +the first clause is a single empty frame. The output of the pipeline is the +output of its last clause. +

+

+The remainder of the query expression says how to compute the result of the +query expression using the sequence of frames output by the query pipeline. +There are two kinds of query expression: query-select expressions and +query-collect expressions. In a query-select expression the pipeline is followed +by a select clause; in a query-collect expression, the pipeline is +followed by a collect clause. +

+

+The execution of certain intermediate clauses can result in the pipeline being +terminated prematurely. Specifically, when a from or +join clause is executed, it makes calls to the next +method of an Iterator object; if any of these calls return an error value +e, then the clause is said to complete early with error +value e. A query-select or query-collect expression will handle this +early completion by terminating the execution of the pipeline, as described +below. +

+

+Variables bound by the clauses of a query-pipeline are implicitly final, and +cannot be modified. +

+ +
+

From clause

+
from-clause := from typed-binding-pattern in expression
+
+

+A from clause is executed as follows: +

+
    +
  • for each input frame f +
      +
    • evaluate the in expression with f in scope resulting +in an iterable value c;
    • +
    • create an Iterator object i from c
    • +
    • do the following in a loop L +
        +
      • call i.next() resulting in a value r;
      • +
      • if r is an error, then complete execution of the from-clause +early with error r;
      • +
      • if r is (), stop loop L;
      • +
      • let v be r.value;
      • +
      • emit a frame consisting of f augmented with the variables +resulting from binding typed-binding-pattern to v.
      • +
      +
    • +
    +
  • +
+
+ +
+

Where clause

+
where-clause := whereNR expression
+
+

+A where clause is executed as follows: +

+
    +
  • for each input frame f +
      +
    • execute the expression with f in scope resulting in +value b;
    • +
    • if b is true, emit f.
    • +
    +
  • +
+
+ +
+

Let clause

+
let-clause := let let-var-decl [, let-var-decl]* 
+
+

+A let clause consisting of a single let-var-decl is executed as follows: +

+
    +
  • for each input frame f +
      +
    • evaluate the expression with f in scope resulting in a value v;
    • +
    • emit a frame consisting of f augmented with the result of binding +type-binding-pattern to v.
    • +
    +
  • +
+

+A let clause with more than one let-var-decl is +transformed into multiple let clauses: let x1 = +E1, x2 = E2 is transformed into +let x1 = E1 let x2 = +E2. +

+
+ +
+

Join clause

+
join-clause := [outerNR] joinNR typed-binding-pattern in expression join-on-condition
+join-on-condition := on expression equals expression
+
+

+A join clause performs an inner or left outer equijoin. +

+

+A join clause is executed as follows: +

+
    +
  • compute a mapping for the right side of the join; during this computation +variable bindings from input frames are not in scope: +
      +
    • create an empty mapping m that maps from keys to lists of frames +(using DeepEquals to compare keys);
    • +
    • evaluate the expression following in resulting in an iterable +value c;
    • +
    • create an Iterator object i from c;
    • +
    • do the following in a loop L +
        +
      • call i.next() resulting in a value r;
      • +
      • if r is an error, then complete execution of the join-clause +early with error r;
      • +
      • if r is (), stop loop L;
      • +
      • let v be r.value;
      • +
      • let f be a frame with the result of binding the +typed-binding-pattern to v;
      • +
      • evaluate the expression to right of equals with f +in scope resulting in a value k;
      • +
      • add an entry to m with key k and and frame f;
      • +
      +
    • +
    +
  • +
  • for each input frame f +
      +
    • evaluate the expression to the left of equals with frame f +in scope resulting in a value k;
    • +
    • let fs be the list of frames for key k in m;
    • +
    • for each frame f' in fs +
        +
      • emit a frame consisting of f augmented with f';
      • +
      +
    • +
    • if outer was specified and fs is empty, then emit a +single frame consisting of f augmented with a frame that binds every +variable occurring in typed-binding-pattern to (). +
    • +
    +
  • +
+

+In the above, if c evaluates to a table, and the result of evaluating +the expression to the right of equals for a member of the table +will always be the key value for that member of the table, then the above can be +optimized by using the table instead of creating a new mapping. +

+

+Variables bound by previous clauses are not in scope for the expression +following in, nor for the expression on the right of +equals. Variables bound by the typed-binding-pattern are not in +scope for the expression following in, nor for the expression on +the left of equals. +

+

+When outer is specified, the typed-binding-pattern is treated +specially: the inferable-type-descriptor in the typed-binding-pattern must be +var, and for each variable occurring in the typed-binding-pattern, +if the type that would be inferred usually for the variable would be +T, then the type inferred in this case will be +T?. +

+ +
+ +
+

Limit clause

+
+limit-clause := limitNR expression
+
+

+A limit clause limits the number of frames emitted by a query pipeline. +

+

+A limit clause is executed as follows: +

+
    +
  • evaluate expression resulting in a value n; variable bindings +from input frames are not in scope for this evaluation;
  • +
  • if n is less than zero, then panic;
  • +
  • for each input frame f, while n is greater than 0 +
      +
    • decrement n;
    • +
    • emit f.
    • +
    +
  • +
+ +

+The static type of expression must be a subtype of int. +

+ +
+ +
+

Order by clause

+
+order-by-clause := orderNR byNR order-key [, order-key]*
+order-key := expression [order-direction]
+order-direction := ascending | descending
+
+

+The static type of the expression in an order-key must be an ordered type. The order-direction is ascending +if not explicitly specified. +

+

+An order-by clause is executed by constructing a list +of entries, where each entry consists of: +

+
    +
  • a frame
  • +
  • a list of keys, one for each order-key in the order-by-clause, and
  • +
  • an integer index
  • +
+

+In order to define the correct ordering of the list, we first define a CompareK +operation that compares two keys with a specified direction: CompareK(x,y,d) is +CompareA(x,y) if d is ascending and otherwise (d is descending) is +Reverse(CompareD(x,y)), where Reverse applied to LT, EQ, GT is GT, EQ, LT +respectively. Now define an operation CompareKL(x,y,d) applying to two lists of +keys and a list of directions as follows. Let x be +[x1,x2,...,xn], y be +[y1,y2,...,yn], and d be [d1, +d2,...,dn]. Then let r be +CompareK(x1,y1,d1). Then the result of +CompareKL(x,y,d) is: +

+
    +
  • r, if r is not EQ
  • +
  • otherwise, EQ, if n is 1
  • +
  • otherwise, +CompareKL([x2,...,xn],[y2,...,yn],[d2,...,dn]).
  • +
+

+Then in a correct ordering of the list of entries when the list of directions is +d, an entry with keys with keys x and index i is before an entry with keys y and +index j if CompareKL(x,y,d) is LT or if CompareKL(x,y,d) is EQ and i is less +than j. +

+

+An order-by clause is executed as follows: +

+
    +
  • create an empty list E of entries
  • +
  • for each input frame f add an entry to E in which +
      +
    • the frame is f
    • +
    • the list of keys is a list of the results of evaluating each order-key's +expression with f in scope
    • +
    • the index is the length of E
    • +
    +
  • +
  • sort E so that it is ordered correctly as described above
  • +
  • for each entry in E, emit the entry's frame
  • +
+ +
+ +
+

Aggregated variable bindings

+ +

+Frames constructed by collect and group-by clauses can contain +aggregated variable bindings. The type of an aggregated variable +binding is always a list type; as usual, the +value bound to the variable belongs to this type. An aggregrated variable is +special in that it is only allowed to be referenced by an +aggregated-variable-reference; the semantics of such a reference are different +from the semantics of a variable-reference-expr. +

+

+An aggregated variable binding for a variable x is aggregated +from a sequence of frames S, by binding x to a list +with the same length as S, where the i-th member of the +list is the value bound to x in the i-th frame in +S. The type of the aggregated variable binding is derived from the +type T of x in S and the kind of clause +C that is constructing the binding. When C is a collect +clause, S can be empty and the type is T[]. +When C is a group-by clause, S cannot be empty and so the +type is [T,T...]. +

+ +
aggregated-variable-reference := identifier
+
+

+A reference to an aggregated variable binding is implicitly spread: an +identifier x that refers to an aggregated variable +binding is treated like a spread ...y, where the +variable y has the same type and value as +x but is not aggregated. +

+

+The grammar shows this by using the aggregated-variable-reference production. A +reference to an aggregated variable is allowed only in a syntactic context where +the grammar allows an aggregated-variable-reference. In each such syntactic +context, the grammar also allows both a variable-reference-expr and a spread. +When a reference to an aggregated variable occurs in an allowed context, it +should be parsed as a aggregated-variable-reference rather than as a +variable-reference-expr, and should be transformed into the equivalent spread. +Any other reference to an aggregated variable should be parsed as a +variable-reference-expr, and then rejected as semantically incorrect. +

+
+ +
+

Group by clause

+
group-by-clause := groupNR byNR grouping-key (, grouping-key)*
+grouping-key :=
+   variable-name
+   | inferable-type-descriptor variable-name = expression
+
+

+A group-by-clause that uses an inferable-type-descriptor is transformed into a a +let-clause followed by a group-by-clause where every grouping-key is a +variable-name. For example: +

+
group by var x1 = E1, var x2 = E2
+
+

+is transformed to +

+
let x1 = E1, x2 = E2 group by x1, x2
+
+

+A group-by clause where every grouping-key is a variable-name is executed by +first partitioning the sequence of input frames S into a set +P of non-empty sequences of frames, such that: +

+
    +
  • every member P is a subsequence (not necessarily consecutive) of S;
  • +
  • every constituent of S is a constituent of exactly one member of P;
  • +
  • two constituents f1 and f2 of +S are constituents of the same member of P if and only if +for every variable x that is a grouping-key, +DeepEquals(x1,x2) is true, where +x1 is the value bound to x in +f1, and x2 is the value bound to +x in f2.
  • +
+

+Next, for each sequence G in P, ordered by the order in +which the first constituent of G occurs in S, an output +frame is constructed from G and emitted. An output frame g +is constructed from a sequence of input frames G as follows. The same +variables are bound by g as are bound by G. For each +variable that is a grouping-key, the value and type in g will be the +same as the value and type in the first constituent of G. The binding +for every other variable is aggregated from +G. +

+ +
+ +
+

Collect clause

+
collect-clause := collectNR expression
+
+ +

+A query-collect expression is used to perform aggregation. It is evaluated as +follows. +

+ +
    +
  1. The query-pipeline is executed to produce a sequence of frames S. +If during this any clause completes early with error value e, then +the result of evaluating the query-collect-expr is e. In addition, +the normal rules apply if the execution of any clause results in the evaluation +of an expression completing abruptly.
  2. +
  3. A frame f is constructed. For each variable x that is +bound by S, f has a variable binding for x that +is aggregated from S.
  4. +
  5. The expression in the collect-clause is evaluated with f in scope +resulting in a value v.
  6. +
  7. The result of the query-collect expression is v.
  8. +
+ +

+The contextually expected type for the expression in the collect-clause is the +contextually expected type for the query-collect-expr. +

+
+ +
+

Select clause

+ +
+select-clause := selectNR expression
+
+

+When a query-select expression is evaluated, the select clause is +executed as follows, so as to emit a sequence of values: +

+
    +
  • for each frame f output by the query pipeline +
      +
    • evaluate the expression that follows select with f +in scope resulting in value v
    • +
    • emit v
    • +
    +
  • +
+

+The sequence of values emitted by the execution of the select +clause is used to construct a value, which becomes the result of the +query-select-expr. The constructed result value must be one of the following +basic types: +

+
    +
  • list - the constructed list has a member for each emitted value; every +emitted value must belong to type T, where T[] is the type of the constructed +value;
  • +
  • mapping - the constructed mapping has a member for each emitted value; every +emitted value must belong to type [string, T], where map<T> is the type +of the constructed value; an emitted value [k, +v] results in adding a field with key +k and value v;
  • +
  • table - the constructed table has a member for each emitted value; every +emitted value must belong to type T, where table<T> is the type of the +constructed value;
  • +
  • string - the constructed string is the concatenation of the emitted values; +every emitted value must be of type string;
  • +
  • xml - the constructed xml value is the concatenation of the emitted values; +every emitted value must be of type xml;
  • +
  • stream - the stream generates the emitted values.
  • +
+

+The clauses in a query-select-expr are executed either eagerly or lazily. If a +query-select-expr is constructing a stream, they are executed lazily; otherwise, +they are executed eagerly. When the clauses in a query-select-expr are being +executed eagerly, the execution happens during the evaluation of the +query-select-expr. When the clauses are being executed lazily, the evaluation of +the query-select-expr constructs a stream object without executing any of the +clauses; the clauses becomes closures, which are called later as a result of +next operations being performed on the stream. +

+

+With eager execution, if any clause completes early with error value +e, then the result of evaluating the query-select-expr is +e. In addition, the normal rules apply if the execution of any clause +results in the evaluation of an expression completing abruptly. +

+

+With lazy execution, when a next operation on the stream results in the +execution of a clause that completes early with error value e, then +that next operation returns e. Similarly, if the next operation +results in the evaluation of an expression within the query-select-expr +completing abruptly with a check-fail, the associated error value will be +returned as the result of the next operation; if the next operation results in +the evaluation of an expression within the query-select-expr completely abruptly +with a panic, then the next operation will complete abruptly with a panic. +

+ +
query-construct-type :=
+  map
+  | table key-specifier
+  | stream
+
+

+If a query-construct-type is specified, then it determines the basic type of the +result. A query-select-expr that constructs a mapping must specify a +query-construct-type of map. +When constructing a table, the key-specifier specifies the key +sequence of the constructed table in the same way as with a +table-constructor-expr. +

+

+If no query-construct-type is specified, the applicable contextually expected +type determines the basic type of the value constructed. If there is no +contextually expected type, then the basic type of the value constructed is the +basic type of expression following in; it is a compile-time error +if the static type of this expression is not a subtype of one of the basic types +list, table, string, stream or xml. +

+

+When the query-select-expr is constructing a value of basic type list, mapping, table +or xml, and the applicable contextually expected type is a subtype of readonly, +then the query-select-expr will construct a value with its read-only bit set and the +static type of the query-select-expr will be a subtype of readonly. Furthermore, the +contextually expected type for the expression in the select-clause will also be +a subtype of readonly. +

+
+ +
+

On conflict clause

+
+on-conflict-clause := on conflictNR expression
+
+

+During the execution of the select clause of query-select-expr that is +constructing a map or table, when value emitted by the select clause is added as +a new member of the map or table being constructed, it replaces any existing +member with the same key value; when a new member replaces an existing member, +it will have the same position in the order of members as the existing member. +This behavior may be controlled by an on conflict clause. +

+

+An on conflict clause is allowed only for a query-select-expr that +constructs a table with a key sequence or a map. The expression is evaluated +when the select clause emits a value that conflicts with a previous +value, in the sense that both values have the same key value in the map or +table. The expression is evaluated with the same frame in scope as the select +clause that emitted the value that conflicts with the previous value. The static +type of the expression must be a subtype of error?. If the result +of evaluating the expression is an error e, then the result of +evaluating the query-select-expr is e. Otherwise, the result must be +nil, and the earlier new value replaces the earlier conflicting value, in the +same way as if there not been an on conflict clause. +

+

+Note that the expression in an on-conflict-clause may have side-effects; for +example, it may call a function that logs an error. +

+
+ +
+
+

XML navigation expression

+

+XML navigation expressions allow for convenient navigation of XML element structure, +in a similar way to XPath. +

+ +
xml-navigate-expr := xml-filter-expr | xml-step-expr
+
+
+

XML name pattern

+
xml-name-pattern := xml-atomic-name-pattern [| xml-atomic-name-pattern]*
+
+xml-atomic-name-pattern :=
+  *
+  | identifier
+  | xml-namespace-prefix NoSpaceColon identifier
+  | xml-namespace-prefix NoSpaceColon *
+
+ +

+An XML name pattern matches a string specifying the name of an XML element. +

+

+An xml-atomic-name-pattern that is * matches any name. +

+

+An xml-namespace-prefix in an xml-atomic-name-pattern must be declared by an +xmlns-decl. If there is an in-scope default namespace (declared by an +xmlns-decl), an xml-atomic-pattern that is just an identifier specifies a +name in that default namespace. +

+
+
+

XML filter expression

+
xml-filter-expr := expression .< xml-name-pattern >
+
+

+An xml-filter-expr selects constituents of a sequence that are elements with a +name matching a specified name pattern. The static type of the expression must +be a subtype of xml. The static type of the xml-filter-expr is +xml<xml:Element>. +

+
+
+

XML step expression

+

+An xml-step-expr provides access to the children or descendants of an element, +similar to a location path in XPath. +

+
xml-step-expr := expression xml-step-start xml-step-extend*
+
+xml-step-start :=
+   xml-all-children-step
+   | xml-element-children-step
+   | xml-element-descendants-step
+xml-all-children-step := /*
+xml-element-children-step := /< xml-name-pattern >
+xml-element-descendants-step := /**/< xml-name-pattern >
+
+xml-step-extend :=
+   .< xml-name-pattern >
+   | [ expression ]
+   | . method-name ( arg-list )
+
+

+The production for xml-step-expr is ambiguous with the productions for +member-access-expr and method-call-expr: this must be resolved by preferring the +parse that includes as much as possible in the xml-step-expr. +

+

+The static type of the expression must be a subtype of xml. +

+

+An xml-step-expr that starts with an xml-all-children-step +

+
+   E /* X
+
+

+is equivalent to +

+
+   xml:map(xml:elements(E), v => xml:getChildren(v) X)
+
+

+where v is a variable name not used in X. +

+

+An xml-step-expr that starts with an xml-element-children-step +

+
+   E /< NP > X
+
+

+is equivalent to +

+
+   xml:map(xml:elements(E), v => xml:getChildren(v) .<NP> X)
+
+

+where v is a variable name not used in X. +

+

+An xml-step-expr that starts with an xml-element-descendants-step +

+
+   E /**/< NP > X
+
+

+is equivalent to +

+
+   xml:map(xml:elements(E), v => xml:getDescendants(v) .<NP> X)
+
+

+where v is a variable name not used in X. +

+
+
+
+

Transactional expression

+ +
transactional-expr := transactional
+
+

+A transactional-expr evaluates to true if the expression is being +evaluated in transaction mode and false otherwise. +

+ +
+ +
+
+

7. Actions and statements

+
+

Actions

+ +
action :=
+   start-action
+   | wait-action
+   | send-action
+   | receive-action 
+   | flush-action
+   | client-remote-method-call-action
+   | client-resource-access-action
+   | query-action
+   | commit-action
+
+action-or-expr :=
+   expr-only
+   | action
+   | type-cast-action-or-expr
+   | checking-action-or-expr
+   | trap-action-or-expr
+   | query-action-or-expr
+   | ( action-or-expr )
+
+type-cast-action-or-expr := < type-cast-param > action-or-expr
+checking-action-or-expr := checking-keyword action-or-expr
+trap-action-or-expr := trap action-or-expr
+
+

+Actions are an intermediate syntactic category between expressions and +statements. Actions are similar to expressions, in that they yield a value. +However, an action cannot be nested inside an expression; it can only occur as +part of a statement or nested inside other actions. This is because actions are +shown in the sequence diagram in the graphical syntax. +

+

+As with the grammar for expression, the grammar for action-or-expr is ambiguous. +The precedence for action-or-expr is the same as for expression, with the +addition that the -> operator used in a +client-remote-method-call-action has the same precedence as the . +operator used in a method-call-expr. +

+

+An action is evaluated in the same way as an expression. Static typing for +actions is the same as for expressions. +

+

+A type-cast-action-or-expr, checking-action-or-expr or +trap-action-or-expr is evaluated in the same way as a +type-cast-expr, checking-expr or +trap-expr respectively. +

+ +
query-action-or-expr := query-select-action-or-expr | query-collect-action-or-expr
+query-select-action-or-expr := [query-construct-type] query-action-pipeline select-action-clause [on-conflict-clause]
+query-collect-action-or-expr := query-action-pipeline collect-action-clause
+query-action-pipeline := from-action-clause intermediate-action-clause*
+intermediate-action-clause :=
+   from-action-clause
+   | let-action-clause
+   | join-action-clause
+   | where-clause
+   | limit-clause
+   | order-by-clause
+   | group-by-clause
+
+from-action-clause := from typed-binding-pattern in action-or-expr
+let-action-clause := let let-action-var-decl [, let-action-var-decl]*
+let-action-var-decl := [annots] typed-binding-pattern = action-or-expr
+join-action-clause := [outerNR] joinNR typed-binding-pattern in action-or-expr join-on-condition
+select-action-clause := selectNR action-or-expr
+collect-action-clause := collectNR action-or-expr
+
+

+A query-action-or-expr is a query-expr in which +certain subexpressions are allowed to be an action-or-expr. It is +evaluated in the same way as a query-expr. +

+ +
+
+

Threads and strands

+ +

+Ballerina's concurrency model supports both threads and coroutines. A Ballerina +program is executed on one or more threads. A thread may run on a separate core +simultaneously with other threads, or may be pre-emptively multitasked with +other threads onto a single core. +

+

+Each thread is divided into one or more strands. No two strands +belonging to the same thread can run simultaneously. Instead, all the strands +belonging to a particular thread are cooperatively multitasked. Strands within +the same thread thus behave as coroutines relative to each other. A strand +enables cooperative multitasking by yielding. When a strand yields, +the runtime scheduler may suspend execution of the strand, and switch its thread +to executing another strand. The following actions cause a strand to yield: +

+
    +
  • worker-receive-action
  • +
  • wait-action
  • +
  • flush-action
  • +
  • sync-send-action
  • +
+

+In addition, any function with an external-function-body can potentially yield; +it should only do so if it performs a system call that would block or calls a +Ballerina function that itself yields. The sleep function in +lang.runtime will make the strand yield. Other functions in the +lang library do not themselves yield, although if they call a function passed as +an argument, that function may result in yielding. +

+

+There are two language constructs whose execution causes the creation of new +strands: named-worker-decl and start-action. Except in the cases explicitly +allowed by this specification, the new strand must be part of the same thread as +the current strand. An implementation may also allow annotations to be used to +indicate that the newly created strand should be in a separate thread from the +current strand. +

+ +
+
+

Function bodies

+ +
+

Function parameters

+

+Before the block-function-body of a function-defn is executed, the parameters +declared in the function-signature of the function-defn are initialized from the +argument list that was constructed by the function-call-expr. The non-rest +parameters are initialized from the arguments in the argument list in order. The +conformance of the argument list to the param-list declared for the function +ensures that each parameter will be initialized to a value that belongs to the +declared type of the parameter. If there is a rest-param, then that is a +initialized to a newly created list containing the remaining arguments in the +argument-list; the inherent type of this list will be T[] where T is the type of +the rest-param. The conformance of the argument list ensures that the members of +this list will belong to type T. +

+

+The parameters are in scope for the block-function-body. They are implicitly +final: they can be read but not modified. +

+
+ +
+

Workers

+ +
block-function-body :=
+   { [default-worker-init named-worker-decl+] default-worker }
+default-worker-init := statement*
+default-worker := statement*
+named-worker-decl :=
+   [annots] [transactional-qual] worker worker-name return-type-descriptor statement-block [on-fail-clause]
+worker-name := identifier
+
+

+A worker represents a single strand of a function invocation. A statement +is always executed in the context of a current worker. A worker is in one of +three states: active, inactive or terminated. When a worker is in the +terminated state, it has a termination value. A worker terminates either +normally or abnormally. An abnormal termination results from a panic, and in +this case the termination value is always an error. If the termination value of +a normal termination is an error, then the worker is said to have terminated +with failure; otherwise the worker is said to have terminated with success. Note +that an error termination value resulting from a normal termination is +distinguished from an error termination value resulting from an abnormal +termination. +

+

+A function always has a single default worker, which is unnamed. The strand for +a function's default worker is the same as the strand of the worker on which +function was called. When a function is called, the current worker becomes +inactive, and a default worker for the called function is started. When the +default worker terminates, the function returns to its caller, and the caller's +worker is reactivated. Thus only one worker in each strand is active at any +given time. If a function's default worker terminates normally, then its +termination value provides the return value of the function. If a function's +default worker terminates abnormally, then the evaluation of the function call +expression completes abruptly with a panic and the worker's termination value +provides the associated value for the abrupt completion of the function call. +The function's return type is the same as the return type of the function's +default worker. +

+

+A function also has zero or more named workers. Each named worker runs on its +own new strand. The strand can run on a separate thread from the default worker if the +function is isolated. The termination of a function is independent of the termination +of its named workers. The termination of a named worker does not automatically +result in the termination of its function. When a function's default worker +terminates, causing the function to terminate, the function does not +automatically wait for the termination of its named workers. +

+

+A named worker has a return type. If the worker terminates normally, the +termination value will belong to the return type. If the return type of a worker +is not specified, it defaults to nil as for functions. +

+

+A named-worker is a transactional scope only if it is declared as +transactional. This is allowed only if the block-function-body is a +transactional scope, i.e. if it is the body of a function declared as +transactional. +

+

+When a function has named workers, the function's default worker executes in +three stages, as follows: +

+
    +
  1. The statements in default-worker-init are executed.
  2. +
  3. All the named workers are started. Each named worker executes its +statement-block on its strand.
  4. +
  5. The statements in default-worker are executed. This happens without waiting +for the termination of the named workers started in stage 2.
  6. +
+

+Parameters and variables declared in default-worker-init are in scope within +named workers, whereas variables declared in default-worker are not. +

+

+The execution of a worker's statements may result in the execution of a +statement that causes the worker to terminate. For example, a return statement +causes the worker to terminate. If this does not happen, then the worker +terminates as soon as it has finished executing its statements. In this case, +the worker terminates normally, and the termination value is nil. In other +words, falling off the end of a worker is equivalent to return;, +which is in turn equivalent to return ();. +

+

+The scope of a worker-name in a named-worker-decl that is part of a +block-function-body is the entire block-function-body with the exception of the +default-worker-init. When a worker-name is in scope, it can be used in a +variable-reference-expr. The result of evaluating such a variable reference is a +future value that refers to the value to be returned by that named worker. The +static type of the result is future<T>, where T is the return type of the +worker. +

+

+A strand can initiate a wait on another strand by using a wait-action with a +value of type future. Only one wait on a strand can succeed; this wait receives +the value returned by the strand. Any other waits on that strand fail. It is a +compile-time error if for any named worker it is possible for the name of that +worker to be evaluated as a variable-reference more than once for any execution +of that worker. This ensures that wait operations that use just a worker-name to +identify the strand to wait on cannot fail at runtime. +

+

+In the above, function includes method, and function call includes method call. +

+
+ +
+

Expression-bodied functions

+ +
expr-function-body := => expression
+
+ +

+An expr-function-body is used for an expression-bodied function, that is a +function whose body is specified by an expression. An expr-function-body of the +form => E is short for a block-function-body { +return E}. +

+ +
+ +
+

Functions with external bodies

+ +
external-function-body := = [annots] external 
+
+ +

+An external-function-body means that the implementation of the +function is not provided in the Ballerina source module. A function-defn-body +with a function-signature that is dependently-typed must be an +external-function-body. +

+ +
+
+

Isolated functions

+

+The body of a function or method declared as isolated must meet the +following requirements. +

+
    +
  • Only isolated functions can be called: +
      +
    • in a function-call-expr, the function-reference must refer to a function +whose static type is isolated;
    • +
    • in a method-call-expr, the method-name must refer to a method or +function whose static type is isolated;
    • +
    • in a new-expr or object-constructor-expr, the init method that is called +must be declared as isolated (a missing init method is equivalent is implicitly +isolated).
    • +
    +
  • +
  • Non-isolated module-level state can only be read in two cases, specifically +a variable-reference can refer to an an identifier declared by a +module-var-decl or listener-decl only if: +
      +
    • the identifier is declared by a module-var-decl that includes +final or configurable but does not include +isolated, or is declared by a listener-decl or a service-decl, +and
    • +
    • the static type of the variable is a subtype of isolated object +{} or of readonly (which will always be the case if the +identifier is declared as configurable).
    • +
    +
  • +
  • Non-isolated module-level state cannot be mutated: an identifier in a +variable-reference-lvexpr or in a capture-binding-pattern in a +destructuring-assignment-stmt must not refer to a variable defined by a +module-var-decl that does not include isolated.
  • +
  • A variable reference to a captured variable must refer to variables that are +both final (either explicitly or implicitly) and have a static type that is a +subtype of readonly|isolated object {}, where a variable reference +is captured if it occurs within an anonymous-function-expr or named-worker-decl +and refers to a variable declared within the function but outside of that +anonymous-function-expr or named-worker-decl.
  • +
  • A start-action is allowed only if its call-action-or-expression is isolated.
  • +
+

+If an isolated function has an external-function-body, then the +above requirements also apply to the external implementation as regards its +access to the mutable state of the Ballerina program, in the sense that it must +only access the mutable state that is reachable from the parameters passed to +the function. In addition, the function should have well-defined behaviour if it +is called concurrently on multiple strands. +

+
+
+
+

Statements

+ +
statement := 
+   action-stmt
+   | local-var-decl-stmt
+   | xmlns-decl-stmt
+   | assignment-stmt
+   | compound-assignment-stmt
+   | destructuring-assignment-stmt
+   | call-stmt
+   | checking-stmt
+   | if-else-stmt
+   | regular-compound-stmt
+   | continue-stmt
+   | break-stmt
+   | stmt-with-on-fail
+   | fail-stmt
+   | rollback-stmt
+   | panic-stmt
+   | return-stmt
+   | fork-stmt
+
+ +
+regular-compound-stmt :=
+   do-stmt
+   | match-stmt
+   | foreach-stmt
+   | while-stmt
+   | lock-stmt
+   | retry-stmt
+   | transaction-stmt
+   | retry-transaction-stmt
+
+

+A regular-compound-stmt can be combined with an +on-fail-clause to make a stmt-with-on-fail. +

+ +
+

Statement execution

+

+The execution of a statement completes in one of three ways: +

+
    +
  • it may complete normally;
  • +
  • it may complete by terminating the current worker; or
  • +
  • it may complete by transferring control within the same worker.
  • +
+

+When the execution of a statement involves the evaluation of an action or an +expression, and that evaluation completes abruptly, then, except where +explicitly stated to the contrary, the execution of the statement completes as +follows. +

+
    +
  • If the abrupt completion is a check-fail with associated value e, then +control flow is transferred as if by a fail-stmt with an expression +that evaluates to e.
  • +
  • If the abrupt completion is a panic with associated value e, then the +current worker is terminated as if by a panic-stmt with an +expression that evaluates to e.
  • +
+

+The following sections describe for each kind of statement any other cases in +which the execution of that kind of statement does not completely normally. +

+
+ +
+

Statement blocks

+
+statement-block := { statement* }
+
+

+A statement-block is executed by executing its +statements sequentially. This means that when the execution of one +statement completes normally, the immediately following +statement is executed. However, when the executon +statement does not complete normally, then none of the following +statements in the statement-block are executed. The +execution of the statement-block completes normally if and only if +the execution of all of its statements completes normally. +

+
+ +
+

Unreachability

+

+A statement is reachable if the analysis described in this section +determines that there is a possibility that the statement will be executed. It +is a compile error if a statement other than a +panic-stmt is not reachable. +

+

+The analysis proceeds by determining recursively for each statement whether it +is possible for the statement to complete normally, assuming that the statement +is reachable. Each statement in a statement-block +after the first statement is reachable only if it is possible for +all of the preceding statements to complete normally. +

+

+When the execution of a statement or a transfer of control is conditional on the +result of evaluating an expression, then the analysis assumes that it is +possible for the statement to be executed or control to be transferred, unless +the static type of the expression makes it impossible. Similarly, when the +evaluation of a subexpression is conditional on the result of previously +evaluating another subexpression, then the analysis assumes that the second +evaluation is possible unles the static type of the first subexpression makes it +impossible. +

+
+ +
+ + +
+

Fork statement

+ +
fork-stmt := fork { named-worker-decl+ }
+
+

+The fork statement starts one or more named workers, which run in parallel with +each other, each in its own new strand. The strand can run on a separate thread +from the current worker if the fork-stmt occurs in an isolated function. +

+

+Variables and parameters in scope for the fork-stmt remain in scope within the +workers (similar to the situation with parameters and workers in a function +body). +

+

+The scope of the worker-name in a named-worker-decl that is part of a fork-stmt +consists of both other workers in the same fork-stmt and the block containing +the fork-stmt starting from the point immediately after the fork-stmt. Within +its scope, the worker-name can be used in a variable-reference-expr in the same +way as the worker-name of a named-worker-decl that is part of a +block-function-body. +

+
+
+

Start action

+ +
start-action := [annots] start call-action-or-expr
+call-action-or-expr :=
+   function-call-expr
+   | method-call-expr
+   | client-remote-method-call-action
+   | client-resource-access-action
+
+ +

+The keyword start causes the following function or method +invocation to be executed on a new strand. The arguments for the function or +method call are evaluation on the current strand. A start-action returns a value +of basic type future immediately. If the static type of the call expression or +action C is T, then the static type of start +C is future<T>; it is permitted for T to be +never. +

+

+A call-action-or-expr is isolated if the function or method it calls +has a type that is isolated and the expression for every argument is an isolated expression; for this purpose, the +object whose method is called by the method-call-expr or +client-remote-method-call-action is treated as an argument. When a start-action +has a call-action-or-expr that is isolated then +

+
    +
  • the start-action is allowed in an isolated function, and
  • +
  • the strand created by the start-action may run in a separate thread from the +current thread.
  • +
+ +
+
+

Wait action

+

+A wait-action waits for one or more strands to terminate, and gives access to +their termination values. +

+ +
wait-action :=
+   single-wait-action
+   | multiple-wait-action
+   | alternate-wait-action
+
+wait-future-expr := expression but not mapping-constructor-expr
+
+

+A wait-future-expr is used by a wait-action to refer to the worker to be waited +for. Its static type must be future<T> for some T. As elsewhere, a +wait-future-expr can use an in-scope worker-name in a variable-reference-expr to +refer to named worker. +

+

+Evaluation of a wait-action performs a wait operation on the future value that +results from evaluating a wait-future-expr. This wait operation may complete +normally or abruptly. The wait operation initiates a wait for the strand that +the future refers to. If the wait fails, then the wait operation completes +normally and the result is an error. If the wait succeeds, and the strand +completed normally, then the wait operation completes normally, and the result +is the termination value of the strand. If the wait succeeds, but the strand +completed abnormally, then the wait operation completes abruptly with a panic +and the associated value is the termination value of the strand. +

+

+In addition to a static type, a wait-future-expr has a compile-time eventual +type. If a wait-future-expr is a variable-reference-expr referring to the +worker-name of a named worker with return type T, then the eventual type of the +wait-future-expr is T. Otherwise, the eventual of a wait-future-expr with static +type future<T> is T|error. The result of a wait operation that completes +normally will belong to the eventual type of the wait-future-expr, since the +compiler ensures that a wait for a wait-future-expr that is a variable reference +to a named worker cannot fail. +

+

+Note that it is only possible to wait for a named worker, which will start its +own strand. It is not possible to wait for a function's default worker, which +runs on an existing strand. +

+

+A mapping-constructor-expr is not recognized as a wait-future-expr (it would not +type-check in any case). +

+
+

Single wait action

+ +
single-wait-action := wait wait-future-expr
+
+

+A single-wait-action waits for a single future. +

+

+A single-wait-action is evaluated by first evaluating wait-future-expr resulting +in a value f of basic type future; the single-wait-action then performs a wait +operation on f. +

+

+The static type of the single-wait-action is the eventual type of the +wait-future-expr. +

+
+
+

Multiple wait action

+ +
multiple-wait-action := wait { wait-field (, wait-field)* }
+wait-field :=
+  variable-name
+  | field-name : wait-future-expr
+
+

+A multiple-wait-action waits for multiple futures, returning the result as a +record. +

+

+A wait-field that is a variable-name v is equivalent to a +wait-field v: v, where v must be the name of an +in-scope named worker. +

+

+A multiple-wait-action is evaluated by evaluating each wait-future-expr +resulting in a value of type future for each wait-field. The +multiple-wait-action then performs a wait operation on all of these futures. If +all the wait operations complete normally, then it constructs a record with a +field for each wait-field, whose name is the field-name and whose value is the +result of the wait operation. If any of the wait operations complete abruptly, +then the multiple-wait-action completes abruptly. +

+

+The static type of the multiple-wait-action is a record where the static type of +each field is the eventual type of the corresponding wait-future-expr. +

+
+
+

Alternate wait action

+ +
alternate-wait-action := wait wait-future-expr (| wait-future-expr)+
+
+

+An alternate-wait-action waits for one of multiple futures to terminate. +

+

+An alternate-wait-action is evaluated by first evaluating each wait-future-expr, +resulting in a set of future values. The alternate-wait-action then performs a +wait operation on all of these members of this set. As soon as one of the wait +operations completes normally with a non-error value v, the +alternate-wait-action completes normally with result v. If all of the wait +operations complete normally with an error, then it completes normally with +result e, where e is the result of the last wait operation to complete. If any +of the wait operations completely abruptly before the alternate-wait-action +completes, then the alternate-wait-action completes abruptly. +

+

+The static type of the alternate-wait-action is the union of the eventual type +of all of its wait-future-exprs. +

+
+
+
+

Worker message passing

+

+Messages can be sent between workers. A message is a value, which must belong to +value:Cloneable. +

+

+Messages can only be sent between workers that are peers of each other. A +function's default worker and its named workers are peers of each other. The +workers created in a fork-stmt are also peers of each other. The workers created +in a fork-stmt are not peers of a function's default worker nor of its named +workers. +

+ +
peer-worker := worker-name | function
+
+

+A worker-name refers to a worker named in a named-worker-decl, which must be in +scope; function refers to the function's default worker. The +referenced worker must be a peer worker. +

+

+Each worker maintains a separate queue for each peer worker to which it sends +messages; thus for each queue a sending worker and a receiving worker, which +must be distinct. A queue has an array of slots together with two integers +w and r that index into the array. Each slot is either +empty or contains a message. The length of each queue's array is determined at +compile-time. When a message is sent, the sending worker writes it to a slot in +the queue. The receiving worker receives the message by reading it from a slot. +Each slot is written to at most once and is read from at most once. +The slots in a queue's array are written to in increasing order, +and are read from in increasing order. +The w and r indices are used to coordinate the sending and +receiving worker: w is incremented by the sending worker as it writes +messages to successive slots in the array; r is incremented by the +receiving worker as it reads messages from successive slots in the array. +The minimum value w and r is 0, and the maximum +is the length of the array of slots. +

+

+A message is sent by a send-action and received by a receive-action. The index +of the slot used by each send-action and receive-action is determined at compile +time. This allows the connection between the send-action and the receive-action +to be shown in the sequence diagram. +There is a one-to-one correspondence between slots and send-actions; there is +a many-to-one correspondence between slots and receive-actions. +It is a compile-time error if a send-action or receive-action occurs in a +syntactic context, such as within the body of a foreach statement, where it +could be executed more than once. +

+

+There are four types determined at compile-time for each slot: +

+
    +
  • a message type: if a message v is written to the slot, then v belongs to the +slot's message type
  • +
  • a no message type: if it is possible for the index w of the queue +to be > i while the slot with index i is empty, then +the no message type of the slot with index i is +error:NoMessage, otherwise it is empty;
  • +
  • a send failure type: this is the type of termination failure in the sending +worker that caused the corresponding message not to be sent; more precisely, for +any slot index i, if it is possible for i to be ≥ +the index w of the queue at the time when the sending worker +completes normally with termination value e, then e +belongs to the send failure type of the slot with index i; it is a +compile-time error if the send failure type is not a (possibly empty) subtype of +error;
  • +
  • a receive failure type: this is the type of termination failure in the +receiving worker that caused the corresponding message not to be received; more +precisely, for any slot index i, if it is possible for i +to be ≥ the index r of the queue at the time when the +receiving worker completes normally with termination value e, then +e belongs to the receive failure type of the slot with index +i; it is a compile-time error if the receive failure type is not a +(possibly empty) subtype of error
  • +
+

+The sections below on Sending messages and +Receiving messages describe +how the sending worker and receiving worker respectively increment the w +and r indices of a queue. +Note that the w index of a queue is updated to the length of the queue's +slot array upon successful termination of the sending worker, but the r +index is not similarly updated by the receiving worker. +The overall effect of this in conjunction with the typing rules is that +a send-action may occur in a conditional context where it may never be executed +but a receive-action may not. +

+ +
+

Sending messages

+ +
send-action := async-send-action | sync-send-action
+
+ +

+A send-action sends a message to the worker that is identified by peer-worker. A +send-action with peer-worker R occurring within worker W is associated with the +queue with sending worker W and receiving worker R. There is a one-to-one +correspondence between the slots in a queue and the send-actions associated with +that queue. The order of the slots in the queue is the same as the syntactic +order of the send-actions. +

+

+An async-send-action sends a message without waiting for it to be received by +the receiving worker. A flush-action on a queue waits until the receiving worker +has received all messages that have been send to the queue. A sync-send-action +is equivalent to an async-send-action followed by a flush-action. +

+

+It is possible that a send-action is not evaluated. This can happen when the +worker containing the send-action terminates with an error or abnormally. It can +also happen when the send-action occurs within a conditional or match statement; +in this case, when there is no longer a possibility that the send-action will be +evaluated, the w index in queue needs to be incremented past the +index of the corresponding slot so as to ensure that a corresponding +receive-action does not wait any longer than necessary. This is achieved by +performing a queue update for every queue for whenever execution of the +sending worker reaches specific points. A queue update is performed for a worker +at a particular execution point by setting the w index to the least +k such that k is > i for every i +where the send-action corresponding to the slot with index i is +syntactically before the execution point. There is a queue update execution +point immediately before every statement that might result in the worker's +strand yielding. A final queue update is also performed if the worker terminates +successfully, by setting w to the length of the queue's array. +

+

+If a worker W is about to terminate normally, and any final queue updates have +been performed, then for each queue for which W is the sending worker, W waits +until either the receiving worker has terminated or the r index is +≥ the w index. If after waiting, the r index is +still < the w index in some queue with receiving worker R, R must +have terminated abnormally, because the rule in the preceding paragraph. In this +case, W terminates abnormally and W will use R's termination value as its +termination value. +

+ + +
+
Async send action
+
async-send-action := expression -> peer-worker ;
+
+ +

+The evaluation of a async-send-action starts by evaluating the expression, resulting +in a value v; the Clone abstract operation is then +applied to v resulting in value +c. This value c is then written +to the slot in the associated queue corresponding to the send-action. The index +w in the queue is set to 1 greater than the index of that slot in the +queue. The result of an async-send-action is always (). +

+

+The static type of the expression must be a subtype of +value:Cloneable. The contextually expected type used to interpret +expression is the contextually expected type from the corresponding +receive-action. +

+

+If the slot corresponding to an async-send-action has a non-empty receive +failure type, then it is a compile-time error unless it can be determined that a +sync-send-action or a flush-action will be executed before the sending worker +terminates with success. +

+
+
+
Flush action
+ +
flush-action := flush [peer-worker]
+
+

+A flush-action with peer-worker R occurring within worker W is associated with the +queue with sending worker W and receiving worker R. Evaluating +the flush-action flushes the queue up to index +i where i is the number of send-actions in W that syntactically +precede the flush-action. More precisely, the evaluation of a flush-action waits +until either the index r of the queue is ≥ +i or the receiving worker has terminated. It then completes as +follows: +

+
    +
  • if index r of the queue is ≥ i, then normally with +result ()
  • +
  • otherwise +
      +
    • if the receiving worker terminated with failure, then normally with the +result being the the termination value of the receiving worker, which will be an +error;
    • +
    • if the receiving worker terminated abnormally, then abruptly with a panic, +with the associated value being the termination value of the receiving worker.
    • +
    +
  • +
+

+If the flush-action has a preceding async-send-action without any intervening +sync-send-action or other flush-action, then the static type of the flush-action +is F|(), where F is the receive failure type of the slot corresponding to that +async-send-action. Otherwise, the static type of the flush-action is nil. +

+

+If a peer-worker is not specified in the flush-action, then the flush-action +flushes the queues to all other workers. In this case, the static type will be +the union of the static type of flush on each worker separately. +

+
+
+
Sync send action
+
sync-send-action := expression ->> peer-worker
+
+

+A sync-send-action E -> R is equivalent to an +async-send-action E ->> R followed by a +flush-action flush R. The static type of the +sync-send-action is the static type of the flush-action. +

+
+
+ +
+

Receiving messages

+ +
receive-action := single-receive-action | multiple-receive-action | alternate-receive-action
+
+

+Each receive-action has one or more references to peer workers. A reference to a +peer-worker W occurring in receive-action within worker R is associated with the +queue with sending worker W and receiving worker R. There is a one-to-one +correspondence between the slots in a queue and the references to +receive-actions associated with that queue. The order of the slots in the queue +is the same as the syntactic order of the references to peer workers. +

+

+A slot with index i in its queue becomes ready when the +index w of the queue is > i. A value can be +received from a slot with index i in a queue as follows. If +the slot is empty, then the receive operation fails; otherwise, the value +received is the value contained in the slot; in either case, the +r index in the queue is set to i + 1. +

+ +
+
Single receive action
+ +
single-receive-action := <- peer-worker
+
+

+A single-receive-action receives a message from a single worker, +and accordingly has a reference to single peer worker. +

+

+A single-receive-action associated with a slot is evaluated by waiting until the +slot is ready or the sending worker has terminated. Then +

+
    +
  • if the slot is ready, a value is received from the slot and the evaluation +completes normally, with the result being +
      +
    • if the receive operation fails, a new value of type error:NoMessage;
    • +
    • otherwise, the value received from the slot;
    • +
    +
  • +
  • otherwise, the evaluation completes as follows: +
      +
    • if the sending worker terminated with failure, then normally with the result +being the the termination value of the sending worker, which will be an error;
    • +
    • if the sending worker terminated abnormally, then abruptly with a panic, +with the associated value being the termination value of the sending worker.
    • +
    +
  • +
+

+The static type of the single-receive-action is T|N|F where T is message type of +the associated slot, N is its no message type, and F is its send failure type. +

+
+
+
Multiple receive action
+ +
multiple-receive-action :=
+   <-  { receive-field (, receive-field)* }
+receive-field :=
+   peer-worker
+   | field-name : peer-worker
+
+

+A multiple-receive-action receives a message from multiple workers. +

+

+A peer-worker can occur at most once in a multiple-receive-action. +

+

+A receive-field consisting of a peer-worker W is equivalent to a +field W:W. +

+

+A multiple-receive-action is evaluated by waiting until the slot associated +with every peer worker is ready. If, while waiting for a slot, the sending worker +for the queue of that slot terminates, then the evaluation of the +multiple-receive-action completes as follows +

+
    +
  • if the sending worker terminated with failure, then normally with the result +being the the termination value of the sending worker, which will be an error;
  • +
  • if the sending worker terminated abnormally, then abruptly with a panic, +with the associated value being the termination value of the sending worker.
  • +
+

+Otherwise, a value is received from every slot. If any of these receive +operations fail, then the evaluation of the multiple-receive action completes +normally with the result being a new value of type error:NoMessage, +Otherwise, the evaluation completes normally with the result being a new record +value, with one field for each receive-field, where the value of the field is +the value received from the slot. +

+

+The contextually expected typed for the multiple-receive-action determines a +contextually expected type for each receive-field, in the same way as for a +mapping constructor. The contextually expected type for each receive-field +provides the contextually expected type for the expression in the corresponding +send-action. +

+

+The static type of multiple-receive-action is R|N|F where +

+
    +
  • R is a record type, where R is determined in the same way as for a mapping +constructor, where the static type of each field comes from the message type of +the slot and the contextually expected type is the contextually expected type of +the multiple-receive-action
  • +
  • N is the union of the no message types of the slots
  • +
  • F is the union of the send failure types of the slots
  • +
+
+
+
Alternate receive action
+ +
alternate-receive-action := <- peer-worker (| peer-worker)+
+
+ +

+An alternate-receive-action receives a message from one of multiple peer-workers. +

+

+As with other receive actions, each reference to a peer worker is associated with a slot in +a queue. An alternate-receive-action is evaluated by repeatedly waiting until either +

+
    +
  • a sending worker terminates abnormally with a panic; in this, case the +evaluation completes abruptly with a panic, with the associated value being the +termination value of the sending worker;
  • +
  • a slot k is ready, and is not empty, and the value in the slot is +not an error; in this case, a value is received from every slot; +the result or failure of these receive operations +is ignored except for slot k; the evaluation completes normally, with +the result being the value received from slot k; or
  • +
  • all sending workers have terminated normally; in this case also, a value is +received from every slot and the evaluation completes normally with the result +of the alternative-receive-action being as follows +
      +
    • if the receive operation of every slot fails, then a new value of type +error:NoMessage;
    • +
    • otherwise, the result of the first receive operation that did not fail, +(in this case, that result will be an error value).
    • +
    +
  • +
+

+The static type of the alternative-receive-action is T|N|F, where T is union of +message type of the associated slots, N is the intersection of the no message +types of the slots and F is the union the send failure type of the slots. +

+ +
+
+
+ +
+

Outbound network interaction

+ +

+A client object is a stub that allows a worker to send network messages to a +remote system according to some protocol. A local variable declared with client +object type will be depicted as a lifeline in the function's sequence diagram. +

+ +
+

Remote methods

+

+The remote methods of the client object correspond to distinct network messages +defined by the protocol for the role played by the client object. The return +value of a remote method represents the protocol's response. A +client-remote-method-call-action is depicted as a horizontal arrow from the +worker lifeline to the client object lifeline. +

+ +
client-remote-method-call-action := expression -> remote-method-name ( arg-list )
+
+

+Calls a remote method of a client object. This works the same as a method call +expression, except that it is used for a client object method with the +remote qualifier. +

+ +
+ +
+

Resources

+ +
client-resource-access-action :=
+   expression -> / [resource-access-path] [. resource-method-name] [( arg-list )]
+
+resource-access-path :=
+   resource-access-path-segments [/ resource-access-rest-segment]
+   | resource-access-rest-segment
+
+resource-access-path-segments :=
+   resource-access-path-segment (/ resource-access-path-segment )* 
+
+resource-access-path-segment :=
+   resource-path-segment-name
+   | computed-resource-access-path-segment
+
+computed-resource-access-path-segment := [ expression ]
+
+resource-access-rest-segment := [ spread ]
+
+

+A client-resource-access-action performs a resource access operation on a client object. An +omitted resource-method-name defaults to get; if the +parentheses and the arg-list are omitted, then they default to +(), with arguments being defaulted as usual. +

+

+A client-resouce-access-action is evaluated by: +

+
    +
  • evaluating the code expression preceding the -> resulting in +a client object c;
  • +
  • evaluating the resource-access-path to get a list of values +p +
      +
    • a resource-access-path that is just makes p be +an empty list
    • +
    • a resource-path-segment-name appends a string to p
    • +
    • a computed-resource-access-path-segment is evaluated and the +result is appended to p;
    • +
    • a resource-access-rest-segment is evaluated and every member +of the result, which must be a list, is appended to p;
    • +
    +
  • +
  • evaluating the arg-list to get an argument list +a;
  • +
  • invoking the resource access operation on the c using the +resource-method-name, p and a, resulting in a value +v.
  • +
+

+The result of the client-resource-access-action is v. +

+

+The static type of the client object must contain a resource with specified +method name for every list value that may be constructed by the evaluation of +the resource-access-path. The argument list and result value are +typed using the intersection of the function types allowed for the method name +with any of the resource paths. +

+ +
+
+
+

Query action

+
query-action := query-action-pipeline do-clause
+do-clause := do statement-block
+
+

+The clauses in the query-pipeline of query-action are executed in the same way +as the clauses in the query-pipeline of a query-expr. +

+

+The query-action is executed as follows. For each input frame f +emitted by the query-pipeline, execute the statement-block with f in +scope. If a clause in the query-pipeline completes early with error +e, the result of the query-action is e. Otherwise, the +result of the query-action is nil. +

+ +
+ +
+

Local variable declaration statements

+ +
local-var-decl-stmt :=
+   local-init-var-decl-stmt
+   | local-no-init-var-decl-stmt
+local-init-var-decl-stmt :=
+   [annots] [final] typed-binding-pattern = action-or-expr ;
+
+

+A local-var-decl-stmt is used to declare variables with a scope +that is local to the block in which they occur. +

+

+The scope of variables declared in a local-var-decl-stmt starts +immediately after the statement and continues to the end of the statement block +in which it occurs. +

+

+A local-init-var-decl-stmt is executed by evaluating the action-or-expr +resulting in a value, and then matching the typed-binding-pattern to the value, +causing assignments to the variables occurring in the typed-binding-pattern. The +typed-binding-pattern is used unconditionally, meaning that it is a compile +error if the static types do not guarantee the success of the match. If the +typed-binding-pattern uses var, then the type of the variables is +inferred from the static type of the action-or-expr; if the +local-init-var-decl-stmt includes final, the precise type is used, and otherwise +the broad type is used. If the typed-binding-pattern specifies a +type-descriptor, then that type-descriptor provides the contextually expected +type for action-or-expr. +

+

+If final is specified, then the variables declared must not be +assigned to outside the local-init-var-decl-stmt. +

+ +
local-no-init-var-decl-stmt :=
+   [annots] [final] type-descriptor variable-name ;
+
+

+A local variable declared local-no-init-var-decl-stmt must be +definitely assigned at each point that the variable is referenced. This means +that the compiler must be able to verify that the local variable will have been +assigned before that point. If final is specified, then the +variable must not be assigned more than once. The type-descriptor +must not be never. +

+
+
+

Conditional variable type narrowing

+

+Usually the type of a reference to a variable is determined by the variable's +declaration, either explicitly specified by a type descriptor or inferred from +the static type of the initializer. However, the language also recognizes two +kinds of case where the way a local variable or parameter is used means that is +known at compile-time that within a particular region of code the value of the +variable will belong to a type that is narrower than the declared type. In these +cases, references to the variable within particular regions of code will have a +static type that is narrower that the variable type. One kind of case, which is +described in this section, is when a variable is used in a boolean expression in +a conditional context. This is sometimes called occurrence typing. The +other kind of case is when a variable is used in a match statement; this is +described in the Match statement section. +

+

+Type narrowing makes use of the read-only difference between two types, +which is defined as follows. We use the notation T +−ro S for the read-only difference of T and S. T +−ro S is computed separately for each uniform type. +Let TU be the subset of T belonging to uniform type U, i.e. the +intersection of T and U. For a uniform type U that is immutable, TU +−ro SU is the same as TU - +SU (set difference); for a uniform type U that is mutable, +TUro SU is empty if +TU is a subset of SU, and TU otherwise. T +−ro S is the union for every uniform type U of +TUro SU. This definition of +read-only difference ensures that if a value x belongs to T but not does not +belong to S, then x belongs to T −ro S. +

+

+Given an expression E with static type boolean, and a variable x with static +type Tx, we define how to determine +

+
    +
  • a narrowed type for x implied by truth of E, and
  • +
  • a narrowed type for x implied by falsity of E.
  • +
+

+based on the syntactic form of E as follows. +

+
    +
  • If E has the form x is T, then +
      +
    • the narrowed type for x implied by truth of E is the intersection of Tx and +T
    • +
    • the narrowed type for x implied by falsity of E is Tx +−ro T
    • +
    +
  • +
  • If E has the form x == E1 or E1 +== x where the static type of E1 is an expression whose +static type is a singleton simple type T1, then +
      +
    • the narrowed type for x implied by truth of E is the intersection of Tx and +T1
    • +
    • the narrowed type for x implied by falsity of E is Tx +−ro T1
    • +
    +
  • +
  • If E has the form x != E1 or E1 +!= x where the static type of E1 is an expression whose +static type is a singleton simple type T1, then +
      +
    • the narrowed type for x implied by truth of E is Tx +−ro T1
    • +
    • the narrowed type for x implied by falsity of E is the intersection of Tx +and T1
    • +
    +
  • +
  • If E has the form !E1, then +
      +
    • the narrowed type for x implied by truth of E is the narrowed type for x +implied by falsity of E1
    • +
    • the narrowed type for x implied by falsity of E is the narrowed type for x +implied by truth of E1
    • +
    +
  • +
  • If E has the form E1 && E2 +
      +
    • the narrowed type for x implied by truth of E is the intersection of +T1 and T2, where T1 is the narrowed type for x +implied by the truth of T1 and T2 is the narrowed type for +x implied by the truth of T2
    • +
    • the narrowed type for x implied by falsity of E is +T1|T2, where T1 is the narrowed type for x +implied by the falsity of E1, and T2 is the intersection +of T3 and T4, where T3 is the narrowed type for +x implied by the truth of E1 and T4 is the narrowed type +for x implied by the falsity of E2
    • +
    +
  • +
  • If E has the form E1 || E2, then +
      +
    • the narrowed type for x implied by truth of E is +T1|T2, where T1 is the narrowed type for x +implied by the truth of E1, and T2 is the intersection of +T3 and T4, where T3 is the narrowed type for x +implied by the falsity of E1 and T4 is the narrowed type +for x implied by the truth of E2
    • +
    • the narrowed type for x implied by falsity of E is the intersection of +T1 and T2, where T1 is narrowed type for x +implied by the falsity of E1 and T2 is the narrowed type +for x implied by the falsity of E2
    • +
    +
  • +
  • If E has any other form, then +
      +
    • the narrowed type for x implied by the truth of E is Tx
    • +
    • the narrowed type for x implied by the falsity of E is Tx
    • +
    +
  • +
+

+Narrowed types implied by the truth or falsity of an expression apply to regions +of code as follows: +

+
    +
  • in an expression E1 || E2, the narrowed +types implied by the falsity of E1 apply within E2
  • +
  • in an expression E1 && E2, the +narrowed types implied by the truth of E1 apply within +E2
  • +
  • in an expression E1 ? E2 : +E3, the narrowed types implied by the truth of E1 apply +within E2 and the narrowed types implied by the falsity of +E1 apply within E3
  • +
  • in a statement if E1 B1 else +B2, the narrowed types implied by the truth of E1 apply +within B1 and the narrowed types implied by the falsity of +E1 apply within B2
  • +
  • in a statement while E B, the narrowed types implied by the truth of E +apply with B
  • +
  • in a match-clause P if E => B, the narrowed types +implied by the truth of E apply within B
  • +
  • in a query-expr or query-action, the narrowed types implied by the truth of +the expression in a where-clause apply within all following clauses in that +query-expr or query-action
  • +
+

+Given a statement or statement-block S, and a variable x that is in-scope for S +and has static type Tx, we define how to determine a narrowed type for x implied +by the normal completion of S as follows. +

+
    +
  • When it is not possible for S to complete normally, then the narrowed type for x implied by the normal completion of S is never (the empty type).
  • +
  • If S has the form { S1 S2 ... +Sn }, then the narrowed type for x implied by the normal +completion of S is the narrowed type for x implied by the normal completion of +Sn.
  • +
  • If S has the form do B, the narrowed type for x implied by the +normal completion of S is the narrowed type for x implied by the normal +completion of B.
  • +
  • If S has the form if E B1 else +B2, the narrowed type for x implied by the normal completion of S is +the union of T1 and T2, where T1 is the +narrowed type for x implied by the normal completion of B1 and +T2 is the narrowed type for x implied by the normal completion of +B2. (The truth or falsity of E may imply a narrowed type for x that +applies in B1 or B2, which may affect the narrowed type +for x implied by the normal completion of B1 or B2.)
  • +
  • Otherwise, the narrowed type for x implied by the completion of S is Tx.
  • +
+

+The narrowed types implied by the normal completion of a statement are applied +within a statement-block as follows: in a statement-block { +S1 S2 ... Sn }, for each i in 2,..., n, the +narrowed types implied by the normal completion of Si - 1 apply to +Si. +

+

+In the above rules, a if-else-stmt without an else clause is +treated as if it had an else followed by an empty statement-block, +and else if clause is treated like a nested if-else-stmt. +

+

+A narrowed type for a variable x implied by an expression in which x occurs +ceases to apply in a region of code where there is a possibility at runtime that +x has been assigned to since the evaluation of the expression. It is an error if +this results in the type of a variable reference being affected by assignments +that lexically follow the variable reference. Specifically, when a variable x is +narrowed outside a while-stmt, foreach-stmt or query-action S, an assignment to +x within S must not result in the possibility of x having being assigned to when +the statement-block of S completes normally or when a continue-stmt is executed. +

+ +
+
+

XML namespace declaration statement

+ +
xmlns-decl-stmt := xmlns-decl
+xmlns-decl := xmlns xml-namespace-uri [ as xml-namespace-prefix ] ;
+xml-namespace-uri := simple-const-expr
+xml-namespace-prefix := identifier
+
+

+An xmlns-decl is used to declare a XML namespace. If there is +an xml-namespace-prefix, then the in-scope namespaces that are used +to perform namespace processing on an xml-template-expr will include a +binding of that prefix to the specified xml-namespace-uri; +otherwise the in-scope namespaces will include a default namespace with the +specified xml-namespace-uri. +

+

+An xml-namespace-prefix declared by an xmlns-decl +is in the same symbol space as a module-prefix declared by an +import-decl. This symbol space is distinct from a module's main +symbol space used by other declarations. An xmlns-decl in a +xmlns-decl-stmt declares the prefix within the scope of the current +block. +

+

+The prefix xmlns is predeclared as +http://www.w3.org/2000/xmlns/ and cannot be redeclared. +

+

+The static type of the simple-const-expr must be a subtype of +string. +

+
+
+

Assignment

+ +

+There are three kinds of assignment statement: +

+
    +
  • an ordinary assignment statement, which is usually called simply an +assignment statement,
  • +
  • a compound assignment statement, and
  • +
  • a destructuring assignment statement.
  • +
+

+The first two of these build on the concept of an lvalue, whereas the +last one builds on the concept of a binding pattern. +

+ +
+

Lvalues

+ +

+An lvalue is what the left hand side of an assignment evaluates to. An lvalue +refers to a storage location which is one of the following: +

+
    +
  • a variable;
  • +
  • a specific named field of an object;
  • +
  • the member of a structured value having a specific out-of-line key, which +will be either an integer or a string according as the structured value is a +list or a mapping.
  • +
+

+Note that an lvalue cannot refer to a member of a table. +

+ +

+An lvalue that is both defined and initialized refers to a storage location that +holds a value: +

+
    +
  • an lvalue referring to a variable is always defined but may be +uninitialized;
  • +
  • an lvalue referring to a specific named field of an object is always defined +but may not be initialized until the init method returns
  • +
  • an lvalue referring to member of a structured value having a specific key is +undefined if the structured value does not have a member with that key; if such an +lvalue is defined, it is also initialized; note that an lvalue always refers to +a structured value that is already constructed.
  • +
+ +
lvexpr :=
+   variable-reference-lvexpr
+   | field-access-lvexpr
+   | member-access-lvexpr
+
+ +

+The left hand side of an assignment is syntactically a restricted type of +expression, called an lvexpr. When the evaluation of an lvexpr completes +normally, its result is an lvalue. The evaluation of an lvexpr can also complete +abruptly, with a panic or check-fail, just as with the evaluation of an +expression. +

+

+The compiler determines a static type for each lvexpr just as it does for +expressions, but the meaning is slightly different. For an lvexpr L to have +static type T means that if the runtime evaluation of L completes normally +resulting in an lvalue x, then if x is defined and initialized, it refers to a +storage location that holds a value belonging to type T. In addition to a type, +the compiler determines for each lvexpr whether it is potentially undefined and +whether it is potentially uninitialized. +

+

+An lvalue supports four operations: store, remove, read and filling-read. +

+

+The fundamental operation on an lvalue is to store a value in the storage +location it refers to. This operation does not required the lvalue to be defined +or initialized; a successful store operation on an undefined lvalue will result +in the addition of a member to the structured value; a store on an uninitialized lvalue +will initialize it. When an lvalue refers to a variable, it is possible to +determine at compile-time whether the store of a value is permissible based on +the declaration of the variable and the static type of the value to be stored. +However, when the lvalue refers to a member of a structured value, this is not in +general possible for three reasons. +

+
    +
  1. The guarantee provided by an lvalue having a static type T is not that the +referenced storage location can hold every value that belongs to type T; rather +the guarantee is that every value that the referenced storage location can hold +belongs to type T. This is because structured types are covariant in their +member types. The values that the storage location can actually hold are +determined by the inherent type of the structured value.
  2. +
  3. The member may not be defined and the inherent type of the structured value may not +allow a member with that specific key. The permissible keys of a structured value can +be constrained by closed record types, fixed-length array types, and tuple types +(with any rest descriptor).
  4. +
  5. The structured value may be immutable. The static type of an lvalue referring to a +member of a structured value makes no guaranteees that the structured value is not immutable.
  6. +
+

+The first of these reasons also applies to lvalues that refer to fields of +objects. Accordingly, stores to lvalues other than lvalues that refer to +variables must be verified at runtime to ensure that they are not impermissible +for any of the above three reasons. An attempt to perform an impermissible store +results in a panic at runtime. +

+

+List values maintain the invariant that there is a unique integer n, the length +of the list, such that a member k of the list is defined if and only if k is a +non-negative integer less than n. When a store is performed on an lvalue +referring to a member k of a list value and the length of the list is n and k is +> n, then each member with index i for each ≤ i < k is filled in, by +using the FillMember abstract operation. The FillMember abstract operation may +fail; in particular it will fail if the list is a fixed-length array. If the +FillMember operation fails, then the attempt to store will panic. +

+

+An lvalue that refers to a member of a mapping value supports a remove +operation, which removes any member with the specific key referred to by the +lvalue. The removal may be impermissible because it the inherent type of the +mapping value requires a member with this key or because the mapping value is +immutable. As with a store operation, a remove operation must be verified at +runtime to ensure that it is not impermissible; an attempt to perform an +impermissible remove operation will result in a panic at runtime. Performing the +remove operation on a member that is not present has no effect, but is not an +error. +

+

+An lvalue also allows a read operation, which is used by the compound assignment +statement. Unlike a store operation, a read operation cannot result in a runtime +panic. A read operation cannot be performed on an lvalue that is undefined or +uninitialized. +

+

+Finally, a lvalue supports a filling-read operation, which is used to support +chained assignment. A filling-read is performed only an lvalue with a static +type that is a structured type. It differs from a read operation only when it is +performed on a potentially undefined lvalue. If the lvalue is undefined at +runtime, then the filling-read will use the FillMember abstract operation on the +member that the lvalue refers to. If the FillMember operation fails, then the +filling-read panics. Unlike the read operation, the filling-read operation can +be performed on an undefined lvalue; it cannot, however, be performed on an +uninitialized lvalue. +

+

+The evaluation of an lvexpr is specified in terms of the evaluation of its +subexpressions, the evaluation of its sub-lvexprs, and store and +filling-read operations on lvalues. If any of these result in a panic, then +the evaluation of the lvexpr completes abruptly with a panic. +

+ +
variable-reference-lvexpr := variable-reference
+
+

+The result of evaluating variable-reference-lvexpr is an lvalue referring to a +variable. Its static type is the declared or inferred type of the variable. The +lvexpr is potentially uninitialized if it is possible for execution to have +reached this point without initializing the referenced variable. +

+

+A variable-reference-lvexpr that refers to a variable declared by a +module-var-decl that includes isolated is only allowed within a +lock-stmt. +

+ +
field-access-lvexpr := lvexpr . field-name
+
+ +

+The static type of lvexpr must be either a subtype of the mapping basic type +or a subtype of the object basic type. +

+

+In the case where the static type of lvexpr is a subtype of the object basic +type, the object type must have a field with the specified name, and the +resulting lvalue refers to that object field. +

+

+In the case where the static type of lvexpr is a subtype of the mapping basic +type, the semantics are as follows. +

+
    +
  • The following requirements apply at compile time: the type of lvexpr must +include mapping shapes that have the specified field-name; type descriptor for +lvexpr must include field-name as an individual-field-descriptor (if +lvexpr is a union, then this requirement applies to every member of the union); +lvexpr must not be potentially uninitialized, but may be potentially +undefined.
  • +
  • +It is evaluated as follows: +
      +
    1. evaluate lvexpr to get lvalue lv;
    2. +
    3. perform a filling-read operation on lv to get mapping value +m;
    4. +
    5. the result is an lvalue referring to the member of m with the +specified field-name.
    6. +
    +
  • +
  • The static type of the field-access-expr is the member type for the key type +K in T, where T is the static type of the lvexpr and K is the singleton string +type containing the field-name; the field-access-expr is potentially undefined +if K is an optional key type for T.
  • +
+ +
member-access-lvexpr := lvexpr [ expression ]
+
+

+The static type of lvexpr must be either a subtype of the mapping basic type or +a subtype of the list basic type. In the former case, the contextually expected +type of expression must be string and it is an error if the static type of +expression is not string; in the latter case, the contextually expected type of +expression must be int and it is an error if the static type of expression is +not int. +

+

+It is evaluated as follows: +

+
    +
  1. evaluate expression to get a string or int k;
  2. +
  3. evaluate lvexpr to get lvalue lv;
  4. +
  5. perform a filling-read operation on lv to get a list or mapping value +v;
  6. +
  7. the result is an lvalue referring to the member of c with key +k.
  8. +
+

+The static type of the member-access-lvexpr is the member type for the key type K +in T, where T is the static type of the lvexpr and K is the static type type of +expression; the member-access-lvexpr is potentially undefined if K is an optional +key type for T. +

+ +
+
+

Assignment statement

+ +
assignment-stmt := lvexpr = action-or-expr ;
+
+

+An assignment-stmt stores the value that results from evaluating action-or-expr +in the storage location referred to by lvexpr. When lvexpr is potentially +undefined and has a static type that does not include nil, then a value of nil +means to remove the member referred to by the lvexpr. +

+

+The static type of action-or-expr must be a subtype of the union of nil and the +static type of lvexpr. If the static type of action-or-expr allows nil, but the +static type of lvexpr does not allow nil, then lvexpr must refer to a member of +a mapping value and must be be potentially undefined. The static type of lvexpr +provides the contextually expected type for action-or-expr. It is not an error +for lvexpr to be potentially undefined or potentially uninitialized. +

+

+An assignment-stmt is executed at as follows: +

+
    +
  1. execute action-or-expr to get a value v;
  2. +
  3. evaluate lvexpr to get an lvalue lv;
  4. +
  5. if v is nil but the static type of lvexpr does not allow nil, +then perform the remove operation on lv; otherwise, perform the store +operation on lv with value v.
  6. +
+ +
+
+

Compound assignment statement

+ +
compound-assignment-stmt := lvexpr CompoundAssignmentOperator action-or-expr ;
+CompoundAssignmentOperator := BinaryOperator =
+BinaryOperator := + | - | * | / | & | | | ^ | << | >> | >>>
+
+

+It is a compile error if lvexpr is potentially undefined unless the static type +of lvexpr is a subtype of the list basic type. It is a compile error if lvexpr +is potentially uninitialized. +

+

+Let T1 be the static type of lvexpr, and let T2 be the static type of +action-expr. Let E be an expression E1 BinaryOperator E2, where E1 has type T1 +and E2 has type T2. E must be valid according to the static typing rules +applicable to the underlying form of the BinaryOperator (not the lifted form +described in the Nil lifting section). Let T be the +static type of E according to those rules. It is a compile error if T is not a +subtype of T1. +

+

+A compound-assignment-stmt is executed as follows: +

+
    +
  1. execute action-or-expr to get a value v2;
  2. +
  3. evaluate lvexpr to get an lvalue lv;
  4. +
  5. if lv is undefined, panic (lv must refer to an +undefined member of a list)
  6. +
  7. perform the read operation on lv to get a value +v1
  8. +
  9. perform the operation specified by BinaryOperator on operands v1 +and v2, resulting in a value v3
  10. +
  11. perform the store operation on lv with value v3.
  12. +
+ +
+
+

Destructuring assignment statement

+ +
destructuring-assignment-stmt :=
+   binding-pattern-not-variable-reference = action-or-expr ;
+binding-pattern-not-variable-reference :=
+   wildcard-binding-pattern
+   | list-binding-pattern
+   | mapping-binding-pattern
+   | error-binding-pattern
+
+

+A destructuring assignment is executed by evaluating the action-or-expr +resulting in a value v, and then matching the binding pattern to v, causing +assignments to the variables occurring in the binding pattern. +

+

+The binding-pattern has a static type implied by the static type of the +variables occurring in it. The static type of action-or-expr must be a subtype +of this type. +

+

+A binding pattern within a destructuring assignment must not refer to a variable +declared by a module-var-decl that includes isolated. +

+

+Note that a destucturing-assignment-stmt with a wildcard-binding-pattern can +be used to ensure that a a variable has been narrowed as expected. +

+
+type T X|Y|Z;
+function foo(T v) {
+   if v is X {
+       handleX(v);
+   }
+   else if v is Y {
+       handleY(v);
+   }
+   else {
+     Z _ = v;
+     handleOther(v);
+   }
+}
+
+

+If T is subsequently modified to add another possibility in +addition to X, Y and Z, then +foo will get a compile error. +

+
+
+
+

Action statement

+ +
action-stmt := action ;
+
+

+An action-stmt is a statement that is executed by evaluating an action and +discarding the resulting value, which must be nil. It is a compile-time error if +the static type of an action in an action-stmt is not nil. +

+
+
+

Call statement

+ +
call-stmt := call-expr ;
+call-expr := function-call-expr | method-call-expr
+
+

+A call-stmt is executed by evaluating call-expr as an expression and discarding +the resulting value, which must be nil. The static type of the call-expr in a +call-stmt must be either () or never. If it is +never, then it is possible for the call-stmt to complete normally. +

+
+
+

Checking statement

+ +
checking-stmt := checking-action-or-expr ;
+
+

+A checking-stmt is executed by evaluating checking-action-or-expr as an +expression and discarding the resulting value, which must be nil. The static +type of the checking-action-or-expr in a checking-stmt must be (). +

+
+
+

Conditional statement

+ +
if-else-stmt :=
+   if expression statement-block 
+   [ else if expression statement-block ]* 
+   [ else statement-block ]
+
+

+The if-else statement is used for conditional execution. +

+

+The static type of the expression following if must be boolean. +When an expression is true then the corresponding statement block is executed +and the if statement completes. If no expression is true then, if the else block +is present, the corresponding statement block is executed. +

+
+
+

Do statement

+
do-stmt := do statement-block
+
+

+A do-stmt is executed by executing its +statement-block. +

+
+
+

Match statement

+ +
match-stmt := match match-target { match-clause+ }
+match-target := action-or-expr
+match-clause :=
+  match-pattern-list [match-guard] => statement-block
+match-guard := if match-guard-expr
+
+

+A match statement selects a statement block to execute based on which patterns a +value matches. +

+

+A match-stmt is executed as follows: +

+
    +
  1. the match-target is evaluated resulting in some value v, called the +target value;
  2. +
  3. for each match-clause in order: +
      +
    1. a match of match-pattern-list against v is attempted
    2. +
    3. if the attempted match fails, the execution of the match-stmt continues to +the next match-clause
    4. +
    5. if the attempted match succeeds, then the variables in match-pattern are +created
    6. +
    7. if there is a match-guard, then the expression in match-guard is executed +resulting in a value b
    8. +
    9. if b is false, then the execution of the match-stmt continues to the next +match-clause
    10. +
    11. otherwise, the statement-block in the match-clause is executed
    12. +
    13. execution of the match-stmt completes
    14. +
    +
  4. +
+

+The scope of any variables created in a match-pattern-list of a match-clause is +both the match-guard, if any, and the statement-block in that match-clause. The +static type of the expression in match-guard must be a subtype of boolean. +

+ +
match-guard-expr := expression
+
+

+A match-guard-expr must not include a function-call-expr or +method-call-expr unless either +

+
    +
  • the static type of the action-or-expr following +match is a subtype of readonly; or
  • +
  • the function or method being called is isolated and the static +type of every argument to the function or method is a subtype of +readonly; in the case of a method-call-expr, the static type of the +object whose method is being called must also be a subtype of +readonly.
  • +
+ +
+

Match patterns

+
match-pattern-list := 
+  match-pattern (| match-pattern)*
+
+

+A match-pattern-list can be matched against a value. An attempted match can +succeed or fail. A match-pattern-list is matched against a value by attempting +to match each match-pattern until a match succeeds. +

+

+All the match-patterns in a given match-pattern-list must bind the same set of +variables. +

+ +
match-pattern :=
+  var binding-pattern
+   | wildcard-match-pattern
+   | const-pattern
+   | list-match-pattern
+   | mapping-match-pattern
+   | error-match-pattern
+
+

+A match-pattern combines the destructuring done by a binding-pattern with the +ability to match a constant value. +

+

+Note that an identifier can be interpreted in two different ways within a +match-pattern: +

+
    +
  • in the scope of a var, an identifier names a variable which is +to be bound to a part of the matched value when a pattern match succeeds;
  • +
  • outside the scope of a var, an identifier references a constant that a value +must match for the pattern match to succeed.
  • +
+

+A match-pattern must be linear: a variable that is to be bound cannot occur more +than once in a match-pattern. +

+ +
const-pattern := simple-const-expr
+
+

+A const-pattern denotes a single value. Matching a const-pattern denoting a +value p against a value v succeeds if DeepEquals(p,v) is true. The static type +of the simple-const-expr in a const-pattern must be a subtype of anydata. +Successfully matching a const-pattern does not cause any variables to be +created. +

+

+Matching a wildcard-match-pattern against a value succeeds if the value belongs to +type any, in other words if the basic type of the value is not error. +

+ +
wildcard-match-pattern := _
+list-match-pattern := [ list-member-match-patterns ]
+list-member-match-patterns :=
+   match-pattern (, match-pattern)* [, rest-match-pattern]
+   | [ rest-match-pattern ]
+mapping-match-pattern := { field-match-patterns }
+field-match-patterns :=
+   field-match-pattern (, field-match-pattern)* [, rest-match-pattern]
+   | [ rest-match-pattern ] 
+field-match-pattern := field-name : match-pattern
+rest-match-pattern := ... var variable-name
+error-match-pattern := error [error-type-reference] ( error-arg-list-match-pattern )
+error-arg-list-match-pattern :=
+   error-message-match-pattern [, error-cause-match-pattern] [, error-field-match-patterns]
+   | [error-field-match-patterns]
+error-message-match-pattern := simple-match-pattern
+error-cause-match-pattern := simple-match-pattern | error-match-pattern
+simple-match-pattern :=
+   wildcard-match-pattern
+   | const-pattern
+   | var variable-name
+error-field-match-patterns :=
+   named-arg-match-pattern (, named-arg-match-pattern)* [, rest-match-pattern]
+   | rest-match-pattern
+named-arg-match-pattern := arg-name = match-pattern
+
+ +

+Matching a mapping-match-pattern against a mapping value succeeds +if and only every field-match-pattern matches against a field of +the value. The variable in the rest-match-pattern, if specified, is +bound to a new mapping that contains just the fields for which that did not +match a field-match-pattern. +

+

+For every match pattern, there is a set of shapes that the pattern matches. The +type corresponding to the match pattern is the type containing these shapes. The +value matches the pattern if and only if it looks like the type. A mutable value +thus can match the pattern without belonging to the corresponding type. However, +an immutable value that matches the pattern will always belong to the type. +In particular, for the match of an error-match-pattern with an +error-type-reference against an error value to succeed, the +error value must belong to the referenced error type. +

+
+ +
+

Match clause reachability and narrowing

+

+This section uses the read-only intersection between two types, which +is defined analogously to the read-only difference used for conditional variable +type narrowing as follows. We use the notation T &ro S for the +read-only intersection of T and S. T &ro S is computed separately +for each uniform type. Let TU be the subset of T belonging to uniform +type U, i.e. the intersection of T and U. For a uniform type U that is +immutable, TU &ro SU is the same as +TU & SU; for a uniform type U that is mutable, +TU &ro SU is empty if TU & +SU is empty, and TU otherwise. T &ro S is +the union for every uniform type U of TU &ro +SU. Note that the read-only intersection operation is not +commutative. +

+

+A match-clause is defined to be unguarded if it does not +have a match-guard or if the static type of the expression in the +match-guard is singleton true. +

+

+For each match-clause C, we can compute a type L that the target +value must look like if the statement-block of C is +executed. L is computed as the difference of a positive type P and negative type +N, where +

+
    +
  • P is the union of the types corresponding to the match patterns in the +match-pattern-list of C, and
  • +
  • N is the union of the types corresponding to the match patterns in the +match-pattern-list of every unguarded match-clause +that precedes C.
  • +
+

+Let T be the static type of the match-target. If the intersection +of T and L is empty, then it is not possible for the +match-pattern-list of C to match, and accordingly the statements in +the statement-block of C are not reachable. If the match-target is +a variable-reference, then the type of the referenced variable is +narrowed to T &ro L within the match-guard, if any, +and the statement-block of C. If there is a +match-guard, then the type narrowing described in Conditional variable type +narrowing is in addition applied to the statement-block +

+

+A match-stmt is exhaustive if and only if the static type +of the match-target is a subtype of union of the type corresponding +to the match patterns of the match-pattern-list of every unguarded +match clause. A match-stmt that is exhaustive can complete normally +only if at least one of its statement-blocks can complete normally. +

+
+
+
+

Loops

+
+

Foreach statement

+ +
foreach-stmt :=
+   foreach typed-binding-pattern in action-or-expr statement-block
+
+

+A foreach statement iterates over an iterable value, executing a statement block +once for each value in the iterable value's iteration sequence. The static type +of action-or-expr must be an iterable type with an iteration completion type of +nil. +

+

+The scope of any variables created in typed-binding-pattern is statement-block. These +variables are implicitly final. +

+

+In more detail, a foreach statement executes as follows: +

+
    +
  1. evaluate the action-or-expr resulting in a value c
  2. +
  3. create an iterator object i from c as follows +
      +
    1. if c is a basic type that is iterable, then i is the result of calling +c.iterator()
    2. +
    3. if c is an object and c belongs to Iterable<T,()> for some T, then i is the +result of calling c.iterator()
    4. +
    +
  4. +
  5. call i.next() resulting in a value n
  6. +
  7. if n is nil, then the execution of the foreach statement completes normally
  8. +
  9. match typed-binding-pattern to n.value causing assignments to any variables +that were created in typed-binding-pattern
  10. +
  11. execute statement-block with the variable bindings from step 5 in scope; in the +course of so doing +
      +
    1. the execution of a break-stmt causes execution of the foreach statement to +complete normally
    2. +
    3. the execution of a continue-stmt causes a transfer of control to step 3
    4. +
    +
  12. +
  13. go back to step 3
  14. +
+

+In step 2, the compiler will give an error if the static type of expression is +not suitable for 2a or 2b. +

+

+In step 5, the typed-binding-pattern is used unconditionally, and the compiler +will check that the static types guarantee that the match will succeed. If the +typed-binding-pattern uses var, then the type will be inferred from the type of +action-or-expr. +

+
+
+

While statement

+ +
while-stmt := while expression statement-block
+
+

+A while statement repeatedly executes a statement block so long as a +boolean-valued expression evaluates to true. +

+

+In more detail, a while statement executes as follows: +

+
    +
  1. evaluate expression;
  2. +
  3. if expression evaluates to false, terminate execution of the while +statement;
  4. +
  5. execute statement-block; in the course of so doing +
      +
    1. the execution of a break-stmt results in the execution of the +while statement completing normally
    2. +
    3. the execution of a continue-stmt causes a transfer of control to +step 1
    4. +
    +
  6. +
  7. go back to step 1.
  8. +
+

+The static type of expression must be a subtype of boolean. +

+
+
+

Continue statement

+ +
continue-stmt := continue ;
+
+

+A continue statement is only allowed if it is lexically within a while-stmt or a +foreach-stmt. Execution a continue statement results in a transfer of control +that causes the execution of the outermost statement-block in the nearest +enclosing while-stmt or foreach-stmt to complete normally. +

+
+
+

Break statement

+ +
break-stmt := break ;
+
+

+A break statement is only allowed if it is lexically within a while-stmt or a +foreach-stmt. Execution of a break statement results in a transfer of control +that causes the execution of nearest enclosing while-stmt or foreach-stmt to +complete normally. +

+
+
+ +
+

Lock statement

+
lock-stmt := lock statement-block
+
+ +

+A lock-stmt executing in the context of some strand must execute its statement-block +in such a way that the effect on the state of the program is consistent with the +execution of the statement-block not being interleaved with the execution of a +lock-stmt on any other strand. +

+

+A naive implementation can simply acquire a single, program-wide, recursive mutex +before executing a lock statement, and release the mutex after completing the +execution of the lock statement. A more sophisticated implementation can perform +compile-time analysis to infer a more fine-grained locking strategy that will +have the same effects as the naive implementation. +

+

+It is not allowed to start a new strand within a lock. More precisely, when a +strand has started but not yet completed the execution of a lock-stmt, the +execution of a named-worker-decl or a start-action on that strand will result in +a panic. It is a compile-time error for a named-worker-decl or start-action to +occur lexically within a lock-stmt. The compiler may also give a compile-time +error if a function definition contains a named-worker-decl or start-action, and +there is a function call lexically within the lock-stmt that might result +directly or indirectly in a call to that defined function. +

+

+It is a compile-time error if a lock-stmt contains a sync-send-action or a receive-action. +

+

+There are two cases where a variable is restricted to be used only within a +lock statement: +

+
    +
  • when the variable is an isolated module-level variable; since isolated +module-level variables are not allowed to be public, this restriction applies to +all functions in the module;
  • +
  • when the variable is self within an isolated object and +self occurs in a field-access-expr self.x, +unless the field x is isolated; since non-isolated +fields are required to be private, this restriction applies only to the object's +methods.
  • +
+

+When a lock statement contains one of the above two cases of restricted variable +usage, the lock statement is subject to the following additional requirements, +which maintain the invariant that the restricted variable is an isolated root. +

+
    +
  • Only one such variable can occur in the lock statement.
  • +
  • A function or method can be called in the lock statement only if the type of +the function is isolated.
  • +
  • Transferring values out of the lock statement is constrained: the expression +following a return statement must be an isolated expression; an assignment to a +variable defined outside the lock statement is allowed only if left-hand side is +just a variable name and the right hand side is an isolated expression. An +assignment to the restricted variable is not subject to this constraint. +
  • +
  • Transferring values into the lock statement is constrained: a +variable-reference-expr within the lock statement that refers to a variable or +parameter defined outside the lock statement is allowed only if the +variable-reference-expr occurs within an expression that is isolated. A +variable-reference-expr that refers to the restricted variable is not subject to +this constraint. Within a non-isolated object, self behaves like a +parameter. +
  • +
+ +
+ +
+

Fail and retry

+

+The execution of a statement can fail either as the result of check +expression or action, or from an explicit fail statement. When +execution of a statement fails, control flow transfers to the nearest lexically +enclosing failure-handling statement. The failure handling statements are +stmt-with-on-fail, retry-stmt, transaction-stmt and retry-transaction-stmt. If +there is no such statement, it terminates the current worker normally. Note that +failure is completely distinct from panic. +

+

+When execution fails there is an associated error value, which is passed to the +failure-handling statement if there is one. If there is no failure-handling +statement, then the error value becomes the return value of the worker. The +possible failure control flows are known at compile-time, as are the types of +the associated error values. For every statement, the type of the error value +associated with a failure causing control to transfer out of the block is +determined at compile-time. This is in contrast with panics, for which the type +of associated error value is not known at compile-time. +

+ +
+

Fail statement

+
fail-stmt := fail expression ;
+
+

+Executing a fail-stmt will cause control flow to transfer to the nearest +lexically enclosing failure handling statement. +

+

+The static type of the expression must be a subtype of error. Execution of the +fail-stmt evaluates the expression; the resulting error value is passed to the +failure handling statement or becomes the termination value of the current +worker. +

+ +
+
+

On fail clause

+
stmt-with-on-fail := regular-compound-stmt on-fail-clause
+on-fail-clause := on fail [typed-binding-pattern] statement-block
+
+

+A stmt-with-on-fail is executed by executing the +regular-compound-stmt. A check expression or action, +or a fail statement may cause control to transfer to the +on-fail-cause. If so, the statement-block is executed; +otherwise the statement-block is not executed. +When the regular-compound-stmt is itself a failure handling statement, +then only failure of that regular-compound-stmt itself causes control to +transfer to the on-fail-clause; a failure within that +regular-compound-stmt will be handled by that regular-compound-statement. +

+

+An on-fail-clause attached to a named-worker-decl is a +shorthand for a named-worker-decl with a statement block that is a +do-stmt with that on-fail-clause: worker +X { Y } on fail Z is equivalent to +worker X { do { Y } on fail Z }. +

+

+If there is a typed-binding-pattern, then it is matched to the +associated error value, binding the variables occurring within the +typed-binding-pattern; the statement-block is executed +with these bindings in scope. The static type of the associated error value is +determined from the static type of the relevant check expressions +and actions, and fail statements. It is a compile error unless the +match of the typed-binding-pattern with the associated error value +is guaranteed to succeed by the static type of the associated error value. +

+
+ +
+

Retry statement

+
retry-stmt := retry retry-spec statement-block
+retry-spec := [type-parameter] [ ( arg-list ) ]
+
+

+The type-parameter in a retry-spec specifies a class, which must be a subtype of +RetryManager<F>, where F is the failure type of the statement-block; this +implies that the parameter type of the class's shouldRetry method must be a +supertype of F. The arg-list in a retry-spec specifies parameters to be passed +to the class's init method; as with new, the arg-list +can be omitted if the class's init method has no required +arguments. +

+

+A retry-stmt is executed as follows: +

+
    +
  1. Create an object r of type RetryManager by calling new T(A), +where T and A are the type-descriptor in the type-parameter and the arg-list +respectively.
  2. +
  3. Execute the statement-block.
  4. +
  5. If the execution failed with associated error e, then call +r.shouldRetry(e). If the result is true, go back to the previous +step. If the result is false, then continue with the fail.
  6. +
+

+If the type-parameter is omitted, it defaults to +DefaultRetryManager defined in langlib error module. +

+ +
+ +
+ +
+

Transactions

+ +

+Ballerina provides language support for distributed transactions. A global +transaction consists of one or more transaction branches, where a branch +corresponds to work done by a single strand of a Ballerina program that is part +of the global transaction. Every transaction branch is uniquely identified by an +XID, which consists of an identifier of the global transaction and an identifier +of a branch with the global transaction. +

+

+At runtime, there is a mapping from each strand to a transaction stack, which is +a stack of transaction branches. A strand is in transaction mode, if +its transaction stack is non-empty; the top of a strand's transaction stack is +the current transaction branch for that strand. +

+

+Static checking is based on the idea of a transactional scope: this is a lexical +region of the program where it is known that at runtime the strand executing the +region will always be in transactional mode. A function with the +transactional qualifier can only be called in a transactional +scope; this includes function calls using start. +

+

+A running instance of a Ballerina program includes a transaction manager. This +may run in the same process as the Ballerina program or in a separate process. +It should not be connected over an unreliable network. The transaction manager +of a program is responsible for managing the transaction branches of all the +program's strands. +

+

+When a global transaction involves multiple Ballerina programs, there must be a +network protocol that allows that transaction managers for each Ballerina +program to communicate. The protocol must also allow a remote method or resource +method on a service object to be informed of the global transaction, if any, to +which it belongs. When a listener object determines that a remote method or +resource method of a service object is to be a part of a global transaction +manager, then it will create a new transaction branch, join it to the global +transaction and push that on the transaction stack for the strand on which the +method is called; if the method is declared as transactional, the +listener will not call the method unless it can do this. Similarly, the protocol +must allow a remote method on a client object that is called in transaction mode +to send information about the global transaction of which it is part; if the +method is declared as transactional, then as usual the method can +only be called in transaction mode; it also implies that the client object +implementation is transaction-aware, and that the recipient of the message sent +by the remote method must join the global transaction. A global transaction can +combine Ballerina programs with programs written in other programming languages +provided they agree on this network protocol. +

+

+A strand in transaction mode can register commit or rollback handlers with the +transaction manager; the handlers are functions which will be called by the +transaction manager when the decision has been made whether to commit or +rollback the global transaction to which the current transaction branch belongs. +

+

+Note that internal storage in Ballerina is not transactional. Rolling back a +transaction does not automatically restore the mutable values are +variables to their state when the transaction started. It is up to the +programmer to do this using commit or rollback handlers. +

+

+When a new strand is created by a named-worker-decl that includes a +transactional qualifier or by using start to call a +function with a transactional qualifier, a new transaction branch +will be created and joined to the global transaction; this transaction branch +will be pushed onto transaction stack for the newly created strand. +

+

+Ballerina also has the concept that a transaction may be part of a sequence of +retries, where the last transaction can complete with either a rollback or +commit, and the preceding transactions all completed with a rollback. +

+ +
+

Transaction manager

+ +

+The semantics of Ballerina's transactional language features are defined in +terms of the following abstract operations on the transaction manager. These +operations cover only the interface between the application and the transaction +manager, not the interface between the resource manager and the application. +These operations are all performed by a Ballerina program in the context of a +strand. The transaction manager supports additional operations, which are +defined in the langlib transaction module. +

+ +
+
Begin operation
+

+The Begin operation starts a global transaction and pushes a transaction branch +for the new global transaction onto the current strand's transaction stack. This +transaction branch is the initiating branch of the global transaction. The +current strand will be in transaction mode. +

+

+The Begin operation has an optional parameter that contains information about +the previous transactions in a sequence of retries. +

+
+ +
+
Commit operation
+

+The Commit operation is only called in transaction mode, and when the current +transaction branch is the initiating branch of a global transaction. The Commit +operation always removes the topmost transaction branch from the strand's transaction +stack. The Commit operation initiates a commit of the global transaction that +the current transaction branch belongs to. +

+

+When the commit is initiated, the transaction manager runs a two-phase commit +protocol if necessary. First, it requests each participant to prepare to commit +and waits for the participants to respond. There are two possibilities. If it +receives a response from each participant that it is prepared to commit, then +the transaction manager will make a decision to commit. If it receives a +response from any participant that it cannot commit or it gives up waiting for a +response from any participant, then the transaction manager will make a decision +to rollback; in this case, it will create an error value for the cause of the +rollback. +

+

+Once the transaction manager has made a decision whether to commit, it calls the +handlers that were registered with it for for the branches of the global +transaction that it is managing; the commit handlers are called if the decision +was to commit and the rollback handlers are called if the decision was to +rollback. The error value for the cause of the rollback will be passed as an +argument to the call of each rollback handler. At this point, the Commit +operation can return. The transaction manager will also communicate its decision +to the transaction's participants, which will result in them running commit or +rollback handlers for their branches. +

+

+The Commit operation has an optional parameter which is a RetryManager object or +nil, which defaults to nil. If this parameter is non-nil and the decision is to +rollback, then the transaction manager will call the RetryManager object's +shouldRetry method, record the result and then pass it as the willRetry +parameter to any rollback handlers. +

+

+If the transaction manager decided to rollback, then the Commit operation +returns the error value for the reason for the rollback. Otherwise, it returns +nil. +

+ +
+ +
+
Rollback operation
+

+The Rollback operation is only called in transaction mode, and when the current +transaction branch is the initiating branch of a global transaction. The +Rollback operation always removes the topmost transaction from the strand's +transaction stack. The Rollback operations initiates a commit of the global +transaction that the current transaction branch belongs to. The transaction +manager calls the rollback handlers that were registered with it for the +branches of the global transaction that it is managing. The Rollback operation +has a parameter which is either an error value or nil; this is passed as an +argument to any rollback handlers. +

+

+The Rollback operation also has an optional parameter which is a RetryManager object +or nil, which defaults to nil. If this parameter is non-nil, then the +transaction manager will call the RetryManager object's shouldRetry method, +record the result and then pass it as the willRetry parameter to any rollback +handlers. +

+ +
+
+ +
+

Transaction statement

+ +

+A transaction is performed using a transaction statement. The semantics of the +transaction statement guarantees that every transaction manager Begin operation +will be paired with a Rollback or Commit operation. +

+
transaction-stmt := transaction statement-block
+
+

+The statement-block must contain at least one commit-action. In addition, the +compiler must be able to verify that any exit out of the statement-block that is +neither a panic nor a fail will have executed a commit-action or +rollback-stmt. +

+

+A transaction-stmt is executed as follows: +

+
    +
  • Perform the transaction Begin() operation.
  • +
  • Execute the statement-block. While executing the statement-block, any panic +does not immediately terminate the current worker; rather control is transferred +back to the transaction-stmt, so that the transaction-stmt can handle it as +described in the next step.
  • +
  • If the new transaction that was begun is still the current transaction, then +the statement-block must have failed or panicked. In this case, perform a +Rollback(e) operation, where e is the error associated with the fail or panic, +and then continue with the fail or panic.
  • +
+

+The statement-block of a transaction-stmt is a transactional scope, except for +any statements that could potentially be executed after the execution of a +commit-action or rollback-stmt. +

+

+It is an error for a transactional-stmt to appear in a transactional scope. +However, it is not an error if the current strand is in transaction mode when a +transaction-stmt is executed: in this case, the Begin() operation performed by +the transaction-stmt will, as usual, start a new transaction, which will be +completely independent of any existing transactions. +

+
+ + +
+

Retry transaction statement

+ +
retry-transaction-stmt := retry retry-spec transaction-stmt
+
+

+A retry-transaction-stmt is the same as a retry-stmt containing a +transaction-stmt, except as follows. +

+
    +
  • When a transaction is retried, information about the previous transaction is +passed as a parameter to the Begin() operation.
  • +
  • If the transaction committed successfully, but the statement-block of the +transaction-stmt failed, then the transaction-stmt will not be retried.
  • +
  • The RetryManager is passed as a parameter to the Commit() and Rollback() +operations and the shouldRetry method is then called by those operations, so +that the result is available to the rollback handlers. The transaction manager +records the result of calling shouldRetry, and this is used to determine whether +to retry.
  • +
+
+ +
+

Commit action

+ +
commit-action := commit
+
+

+A commit-action is only allowed if it is lexically within the +statement-block of a transaction-stmt. +

+

+Evaluating the commit-action performs the transaction manager +Commit() operation; the result of this operation is the result of the +commit-action. The type of the result is +transaction:Error?. Note that the commit action does not alter the +flow of control. +

+ +
+ +
+

Rollback statement

+ +
rollback-stmt := rollback [expression] ;
+
+

+A rollback-stmt is only allowed if it is lexically within the +statement-block of a transaction-stmt. +

+

+The rollback-stmt performs the transaction manager Rollback(e) +operation, where e is the result of executing the expression, if +present, and nil otherwise. Note that like the commit action, the rollback +statement does not alter the flow of control. +

+ +
+ +
+
+

Panic statement

+ +
panic-stmt := panic expression ;
+
+

+A panic statement terminates the current worker abnormally. The result of +evaluating expression provides the termination value of the worker. +

+

+The static type of expression must be a subtype of error. +

+
+ +
+

Return statement

+ +
return-stmt := return [ action-or-expr ] ;
+
+

+A return statement terminates the current worker normally.The result of +evaluating the action-or-expr provides the termination value of the worker. If +action-or-expr is omitted, then the termination value is nil. +

+
+ + +
+
+

8. Module-level declarations

+

+Each source part in a Ballerina module must match the production +module-part. +

+

+The import declarations must come before other declarations; apart from this, +the order of the definitions and declarations at the top-level of a module is +not constrained. +

+ +
module-part := import-decl* other-decl*
+other-decl :=
+   listener-decl
+   | service-decl
+   | function-defn
+   | module-type-defn
+   | module-class-defn
+   | module-var-decl
+   | module-const-decl
+   | module-enum-decl
+   | module-xmlns-decl
+   | annotation-decl
+
+
+

Import declaration

+ +
import-decl := import [org-name /] module-name [as import-prefix] ;
+import-prefix := module-prefix | _
+org-name := import-identifier
+module-name := import-identifier (. import-identifier)*
+import-identifier := RestrictedIdentifier
+
+

+If org-name is omitted, it is defaulted from the organization of the importing +module. +

+

+An import-prefix of _ causes the module to be imported without +making its symbols available via a module-prefix. In this case, the effect of +importing the module will be just to cause the module to be included in the +program and initialized. It is an error for a source-part to import a module +using a module-prefix and then not to use that module-prefix. +

+

+A module-prefix declared by an import-decl is in the +same symbol space as a xmlns-namespace-prefix declared by an +xmlns-decl. This symbol space is distinct from a module's main +symbol space used by other declarations. +

+

+It is an error for a module to directly or indirectly import itself. In other +words, the directed graph of module imports must be acyclic. +

+
predeclared-prefix :=
+   boolean
+   | decimal
+   | error
+   | float
+   | function
+   | future
+   | int
+   | map
+   | object
+   | stream
+   | string
+   | table
+   | transaction
+   | typedesc
+   | xml
+
+

+A reserved keyword t that is a predeclared-prefix is +predeclared as referring to the lang.t lang library +module, but this can be overridden by an import-decl that imports a module using +that prefix. A predeclared-prefix can be used as a module-prefix without using a +QuotedIdentifier. +

+ +
+ +
+

Module and program execution

+

+A Ballerina program consists of one or more modules; one of these modules is +distinguished as the root module. The source code for a module uses +import declarations to identify the modules on which it depends directly. At +compile-time, a root module is specified, and the modules comprising the program +are inferred to be those that the root module imports directly or indirectly. +The directed graph of module imports must be acyclic. +

+

+Program execution may terminate successfully or unsuccessfully. Unsuccessful +program termination returns an error value. Program execution consists of two +consecutive phases: an initialization phase and a listening phase. +

+

+Module initialization is performed by calling an initialization function, which +is synthesized by the compiler for each module. Module initialization can fail, +in which case the initialization function returns an error value. The +initialization phase of program execution consists of initializing each of the +program's modules. If the initialization of a module is unsuccessful, then +program execution immediately terminates unsuccessfully, returning the error +value returned by the initialization function. +

+

+The initialization of a program's modules is ordered so that a module will not +be initialized until all of the modules on which it depends have been +initialized. (Such an ordering will always be possible, since the graph of +module imports is required to be acyclic.) The order in which modules are +initialized follows the order in which modules are imported so far as is +consistent with the previous constraint. +

+

+A module's initialization function performs expression evaluation so as to +initialize the identifiers declared in the module's declarations; if evaluation +of an expression completes abruptly, then the module initialization function +immediately returns the error value associated with the abrupt completion. If a +module defines a function named init, then a module's +initialization function will end by calling this function; if it terminates +abruptly or returns an error, then the module's initialization function will +return an error value. Note that the init function of the root +module will be the last function called during a program's initialization phase. +

+

+This specification does not define any mechanism for processing the program +command-line arguments typically provided by an operating system. The Ballerina +standard library provides a function to retrieve these command-line arguments. +In addition, the Ballerina platform provides a convenient mechanism for +processing these arguments. This works by generating a new command-line +processing module from the specified root module. The init +function of the generated module retrieves the command-line arguments, parses +them, and calls a public function of the specified root module (typically the +main function). The parsing of the command-line arguments is +controlled by the declared parameter types, annotations and names of the public +functions. The generated module, which imports the specified root module, +becomes the new root module. +

+

+A configuration is supplied as input to program execution. A +configuration consists of mapping from names of configurable +module-level variables to values. The values in a configuration always belong to +the type anydata&readonly. The value for a variable in the +configuration is used during module initialization to initialize the variable +instead of the value specified in the module. A configurable module-level +variable may require that a configuration include a value for it. Except for +this requirement, a configuration may be empty. Before initializing any module, +the initialization phase must check that there is a value of the correct type +supplied for every configurable module-level variable that requires +configuration. If not, the module initialization phase terminates unsuccessfull. +

+

+If the initialization phase of program execution completes successfully, then +execution proceeds to the listening phase, which is described in the next +section. The termination of the listening phase, which may be successful or +unsuccessful, terminates the program execution. +

+
+ +
+

Listeners and services

+ +

+Service objects support network interaction using remote methods and resource +methods. Listeners provide the interface between the network and service +objects. A listener object receives network messages from a remote process +according to some protocol and translates the received messages into remote +methods calls or resource accesses of service objects that have been attached to +the listener object. It is up to the listener object to determine how this +translation happens. A resource path segment may correspond to something that at +the protocol level is not a string. For example, in HTTP a path segment is +natively a sequence of bytes. In this case, the listener should be able to +convert this native representation into a string, for example, by using UTF-8 +decoding. The type of the listener object constrains the type of a service that +can be attached to the listener. (This constraint cannot yet be fully expressed +by Ballerina's type system.) +

+

+A service object's remote or resource method uses its return value to indicate +to the listener what further handling of the network message is needed. An error +return value is used to indicate that the method encountered some sort of error +in handling the network message. When a service object is returned, it means +that the listener should use that service object to further handle the network +message. When no further handling is needed, the return value should be nil. +

+

+The return value can also be used to supply a response to the network message. +This has the limitation that the method cannot control what happens if there is +an error in sending a response. It also has the limitation that it cannot handle +complex message exchange patterns, although returning multiple responses to a +single request can be modelled by returning a stream. A listener object can +avoid these limitations by passing a client object as a parameter to the service +object's remote or resource method; the service object then makes calls on the +remote methods of the client object in order to send a response back to the +client. +

+

+The methods defined by the Listener object type allow for the +management of the lifecycle of a listener object and its attached services. A +listener declaration registers a listener object with a module, so that it can +be managed by the module. The runtime state of each module includes a list of +listener objects that have been registered with the module. A listener object +that has been registered with a module is called a module listener +

+

+If at the start of the listening phase of program execution there are no module +listeners, then program execution is terminated gracefully. +Otherwise, the start method of each module listener is called; if +any of these calls returns an error value, then the listening phase terminates +unsuccessfully with this error value as its return value. +

+

+The listening phase of program execution continues until either the program +explicitly exits, by calling a standard library function, or the user explicitly +requests the graceful or immediate termination of the program using an +implementation-dependent operating system facility (such as a signal on a POSIX +system). In the latter case, the gracefulStop or +immediateStop method of each registered listener will be called +before termination. In the case of graceful termination, functions registered +with runtime:onGracefulStop are also called. +

+ +
+

Listener declaration

+ +
listener-decl :=
+   metadata
+   [public] listener [type-descriptor] variable-name = expression ;
+
+

+A listener-decl declares a module listener. A module listener +declares a variable in a similar way to a final variable declaration, but the +type of the variable is always a subtype of the Listener object type, +and it has the additional semantic of registering the variable's value with the +module as a listener. As with a variable declared in a final variable +declaration, the variable can be referenced by a variable-reference, but cannot +be assigned to. A module may have multiple multiple listeners. +

+

+When a listener-decl is initialized as part of module initialization, its +expression is evaluated. If expression evaluation completes abruptly or the +result of the expression is an error, then module initialization fails. +Otherwise the variable is initialized with the result of the evaluation. +

+

+If the type-descriptor is present, it specifies the static type of the variable. +The static type of expression must be equivalent to a union L|E, +where L is a listener object type and E is subtype of error, which may be +never; if the type-descriptor is not present, then L is used as the +static type of the variable. +

+ +
+ +
+

Service declaration

+ +
service-decl :=
+   metadata [isolated-qual]
+   service [type-descriptor] [attach-point] on expression-list object-constructor-block [;]
+attach-point := absolute-resource-path | string-literal
+absolute-resource-path :=
+   root-resource-path
+   | (/ resource-path-segment-name)+
+root-resource-path := /
+
+expression-list := expression (, expression)*
+
+

+A service-decl creates a service object and attaches it to one or more +listeners. +

+

+The static type S for the constructed service object is specified by the +type-descriptor if present, and otherwise is the union of a type inferred from +each expression in the expression list as follows. Each expression in the +expression-list must have a type Listener<T,A>|E where T is a subtype of +service object {}, A is a subtype of +string[]|string|() and E is a subtype of error; the +inferred type is T. The object-constructor-block has the same semantics as in an +object-constructor-expr with a service qualifier and a +type-reference that refers to S. If the service-decl includes +isolated, then it is equivalent to an object-constructor-expr with +an isolated qualifier as well as a service qualifier. +

+

+The attach-point determines the second argument passed to the +attach method: if the attach-point is absent, then the +argument is nil; if it is a string-literal, then the argument is a +string; otherwise, it is an absolute-resource-path and the argument +is an array of strings, with one string for each +resource-path-segment-name. Attaching service objects +s1,...,sn with absolute +resource paths p1,...,pn +is equivalent to attaching a single service object with n +get resource methods to /, where the i-th +resource method has a path pi (an +absolute-resource-path is turned into a +relative-resource-path with the same +resource-path-segment-names) and returns +si. +

+

+A service-decl is initialized as part of module initialization as follows. The +object-constructor-block is evaluated as in an object-constructor-expr resulting +in a service object s. Then for each expression in +expression-list: +

+
    +
  1. the expression is evaluated resulting in a value which is either an error or +an object obj belonging to a listener object type;
  2. +
  3. if it is an error, module initialization fails;
  4. +
  5. otherwise, obj is registered as a module listener +(registering the same object multiple times is the same as registering it +once);
  6. +
  7. s is then attached to obj +using obj's attach method;
  8. +
  9. if the call to attach fails, then module initialization +fails.
  10. +
+
+ + +
+

Isolated inference

+ +

+A listener object can use the isolated bit of a service object and of a service +object's remote method to determine whether it is safe to make concurrent calls +to the remote object or the remote method. +

+

+The compiler may infer that a service object or a service object's remote method +is isolated even it is not explicitly declared as such. In doing so, it analyzes +a module to determine whether there is a set of declarations and definitions in +the module, where each of them is a service-decl, +object-constructor-expr, +module-var-decl, module-class-defn +function-defn or method-defn, and none of them +explicitly specifies an isolated qualifier, such that if all them +explicitly specified an isolated qualifier, then they all would +meet the requirements for isolated functions +and isolated objects. If so, then the isolated bit of values resulting from them +is set in the same way as if isolated qualifiers had been +explicitly specified. The analysis should not infer a function or method to be +isolated if that would be inconsistent with an annotion supported +by the implementation that provides control over which thread is used for a strand +created for named-worker-decl or start-action. +

+

+This inference is purely an optimization to improve service concurrency and is +subject to two constraints. First, any inferences do not affect the static types +visible to other modules. Second, anything explicitly declared as +isolated must satisfy the requirements of this specification +without without relying on inference. +

+ +
+
+ +
+

Function definition

+ +
function-defn := 
+   metadata
+   [public] function-quals
+   function identifier function-signature function-defn-body
+function-defn-body :=
+   block-function-body [;]
+   | expr-function-body ;
+   | external-function-body ;
+
+

+If a module has a function-defn with an identifier of init, it is +called called automatically by the system at the end of the initialization of +that module; if this call returns an error, then initialization of the module +fails. The following special requirements apply to the init +function of a module: it must not be declared public; its return +type must both be a subtype of error? and contain (); +it must have no parameters. +

+

+If the function-quals includes transactional, then +expr-function-body and the block-function-body are transactional scopes. +

+ +
+ +
+

Module type definition

+ +
module-type-defn :=
+   metadata
+   [public] type identifier type-descriptor ;
+
+ +

+A module-type-defn binds the identifier to the specified type descriptor. The +binding is in the main symbol space. The type-descriptor is resolved as part of +module initialization. +

+ +
+ +
+

Module class definition

+

+A class is a type descriptor that in addition to describing an object type also +defines a way to construct an object belonging to the type; in particular, it +provides the method definitions that are associated with the object when it is +constructed. +

+ +
module-class-defn :=
+   metadata
+   [public] class-type-quals class identifier {
+      class-member*
+  } [;]
+class-type-quals := (distinct | readonly | isolated-qual | object-network-qual)*
+class-member :=
+   object-field
+   | method-defn
+   | remote-method-defn
+   | resource-method-defn
+   | object-type-inclusion
+
+

+It is an error for a keyword to appear more than once in +class-type-quals. +

+

+As in an object constructor expression, a visibility qualifier of +private can be used within a class definition; this means that the +visibility region consists of all method definitions in the class definition. If +class has private fields or methods, then it is not possible to define another +object type descriptor that is a subtype of the class's type. +

+

+If class-type-quals contains readonly, then an object +constructed using the class will have its read-only bit set; the effective type +of each field is thus the intersection of the specified type and +readonly; furthermore, an object shape belongs to the class's type +only if its read-only bit is set. +

+

+If class-type-quals contains isolated, then the +defined object type is an isolated type, and an object constructed using the +type will have its isolated bit set. An object-field or +method-defn occurring as a class-member in an isolated +class is subject to same requirements as when it occurs as an +object-member in an object-constructor-expr that is +explicitly isolated. +

+

+If an object-type-inclusion references a type-descriptor that is a +class, then only the type of the class is included: the definitions of the +methods and any initializers for the fields are not included. If a class uses an +object-type-inclusion to include an object type T, then each method declared in +T must be defined in the class using a method-defn with the same +visibility. If T has a method or field with module-level visibility, then C must +be in the same module. If the class is readonly (i.e. +class-type-quals includes readonly), then an +object-type-inclusion in the class is allowed to directly or +indirectly reference a readonly class or readonly type +descriptor. +

+

+If class-type-quals contains distinct, then the +primary type-id of the class will the type-id of that occurrence of +distinct, and the secondary type-ids will be the union of the +type-ids of the included object types. If class-type-quals does not +contain distinct, then the type-ids of the class come from the +included object types in the same way as with an object type descriptor. +

+

+An object of a class is initialized by: +

+
    +
  1. allocating storage for the object
  2. +
  3. initializing each field with its initializer, if it has one
  4. +
  5. initializing the methods of the object using the class's method definitions
  6. +
  7. calling the class's init method, if there is one
  8. +
+

+The parameter list of an init method within an +module-class-defn is not required to be empty, unlike within an +object-constructor-expr. +

+ +
+ +
+

Module variable declaration

+ +
module-var-decl := module-init-var-decl | module-no-init-var-decl
+
+

+A module-var-decl declares a variable. The scope of variables declared in a +module-var-decl is the entire module. The variable may be initialized in the +declaration or within the module's init function. If +final is specified, then it is not allowed to assign to the +variable after it is initialized. +

+
+module-init-var-decl := metadata [public] module-init-var-quals typed-binding-pattern = module-var-init ;
+module-init-var-quals := (final | isolated-qual)* | configurable
+module-var-init := expression | ?
+
+

+A module-init-var-decl declares and initializes a variable. It is an error for a +keyword to appear more than once in module-init-var-quals. If the +typed-binding-pattern uses var, then the type of the variables is +inferred from the static type of expression; if the module-var-decl +includes final or configurable, the precise type is +used, and otherwise the broad type is used. If the typed-binding-pattern +specifies a type-descriptor, then that type-descriptor provides the contextually +expected type for action-or-expr. +

+

+If the module-init-var-decl includes public, then the +typed-binding-pattern must not use var. +

+

+If a module-init-var-decl includes an isolated-qual, then the variable declared +is isolated. In this case, public must not be specified, the +binding-pattern in the typed-binding-pattern must be just a variable-name, and +the expression must be an isolated expression. A variable declared as an +isolated variable can be accessed only within a lock-stmt. When an isolated-qual +occurs in a position where the grammar would allow it to be parsed as part of +module-init-var-quals or typed-binding-pattern, the former parse is used. +

+

+If configurable is specified, then the initializer specified in the +module-var-init may be overridden at the time of module initialization by a +value supplied when the program is run. If such a value is supplied, then the +expression in the module-var-init is not evaluated and the variable is +initialized with the supplied value instead. A module-var-init of ? +is allowed only when configurable is specified and means that a +configurable value must be supplied for this variable. If +configurable is specified, then the typed-binding-pattern must use +an explicit type-descriptor rather than var and the binding-pattern +must be just a variable-name. The type specified by the type-descriptor must be +a subtype of anydata. A variable declared as +configurable is implicitly final, and cannot be assigned to outside +the declaration. The static type of a variable declared as +configurable is implicitly readonly: the type +specified in the type-descriptor is intersected with readonly. A +configurable variable can thus always be referenced within an isolated function. +

+ +
module-no-init-var-decl := metadata [public] [final] type-descriptor variable-name ;
+
+

+A module variable declared with module-no-init-var-decl must be +initialized in the module's init function. It must be definitely +assigned at each point that the variable is referenced. If final is +specified, then the variable must not be assigned more than once. The +type-descriptor must not be never. +

+ +
+
+

Module constant declaration

+ +
module-const-decl :=
+   metadata
+   [public] const [type-descriptor] identifier = const-expr ;
+
+

+A module-const-decl declares a compile-time constant. A compile-time constant is +an named immutable value, known at compile-time. A compile-time constant can be +used like a variable, and can also be referenced in contexts that require a +value that is known at compile-time, such as in a type-descriptor or in a +match-pattern. +

+

+The type of the constant is the intersection of readonly and the +singleton type containing just the shape of the value named by the constant. The +type of the constant determines the static type of a variable-reference-expr +that references this constant. +

+

+If type-descriptor is present, then it provides the contextually expected type +for the interpretation of const-expr. It is a compile-time error if the static +type of const-expr is not a subtype of that type. The type-descriptor must +specify a type that is a subtype of anydata and must not be never. +Note that the type-descriptor does not specify the type of the constant, +although the type of the constant will all be a subtype of the type specified by +the type-descriptor. +

+
+ +
+

Module enumeration declaration

+ +
module-enum-decl :=
+   metadata
+   [public] enum identifier { enum-member (, enum-member)* } [;]
+enum-member := metadata identifier [= const-expr]
+
+

+A module-enum-decl provides a convenient syntax for declaring a union of string constants. +

+

+Each enum-member is defined as compile-time constant in the same way as if it +had been defined using a module-const-decl. The result of evaluating the +const-expr must be a string. If the const-expr is omitted, it defaults to be the +same as the identifier. +

+

+The identifier is defined as a type in the same was as if it had been defined by +a module-type-defn, with the type-descriptor being the union of the constants +defined by the members. +

+

+If the module-enum-decl is public, then both the type and the constants are public. +

+

+So for example: +

+
+public enum Color {
+  RED,
+  GREEN,
+  BLUE
+}
+
+

+is exactly equivalent to: +

+
+public const RED = "RED";
+public const GREEN = "GREEN";
+public const BLUE = "BLUE";
+public type Color RED|GREEN|BLUE;
+
+
+ +
+

Module XML namespace declaration

+
module-xmlns-decl := xmlns-decl
+
+ +

+A module-xmlns-decl declares an XML namespace prefix with module +scope. It applies only to the source part in which it occurs, as with an +import-decl. +

+

+The semantics of xmlns-decl are described in the XML namespace declaration +statement section. +

+ +
+ + +
+
+

9. Metadata

+

+Ballerina allows metadata to be attached to a construct by specifying the +metadata before the construct. +

+ +
metadata := [DocumentationString] [annots]
+
+

+There are two forms of metadata: documentation and annotations. +

+
+

Annotations

+ +
annots := annotation+
+annotation := @ annot-tag-reference annot-value
+
+

+Annotations provide structured metadata about a particular construct. Multiple +annotations can be applied to a single construct. An annotation consists of a +tag and a value. +

+ +
annotation-decl :=
+   metadata
+   [public] [const] annotation [type-descriptor] annot-tag 
+   [on annot-attach-points] ;
+annot-tag := identifier
+
+

+An annotation-decl declares an annotation tag. Annotations tags are in a +separate symbol space and cannot conflict with other module level declarations +and definitions. The annotation tag symbol space is also distinct from the +symbol space used by module prefixes and XML namespace prefixes. +

+

+The type-descriptor specifies the type of the annotation tag. The type must be a +subtype of one of the following three types: true, +map<value:Cloneable>, +map<value:Cloneable>[]. If the type-descriptor is omitted, +then the type is true. +

+ +
annot-tag-reference := qualified-identifier | identifier
+annot-value := [mapping-constructor-expr]
+
+

+An annot-tag-reference in an annotation must refer to an annot-tag declared in +an annotation declaration. When an annot-tag-reference is a +qualified-identifier, then the module-prefix of the qualified-identifier is +resolved using import declarations into a reference to a module, and that module +must contain an annotation-decl with the same identifier. An annot-tag-reference +that is an identifier rather than a qualified-identifier does not refer +to an annotation defined within the same module. Rather the compilation +environment determines which identifiers can occur as an +annotation-tag-reference, and for each such identifier which module defines that +annotation tag. +

+

+Each annotation has a value. For every construct that has an annotation with a +particular tag, there is also an effective value for that annotation +tag, which is constructed from the values of all annotations with that tag that +were attached to that construct. The effective value belongs to the type +declared for the annotation tag. The type of the annotation tag determines the +type of the annotation value and whether multiple annotations with the same tag +on a single construct are allowed. For an annotation tag declared with type T, +if T is M[] for some type mapping type M, then the type of the annotation value +is M, multiple annotations are allowed, and the effective value is an array of +the values for each annotation; otherwise the type of the annotation value is T, +multiple annotations are not allowed, the effective value is the value of the +single annotation. +

+

+If the type of the annotation value is true, then a +mapping-constructor-expr is not allowed, and the annotation value is +true. Otherwise the type of the annotation value must be a mapping +type M; if a mapping-constructor-expr is not specified, then it defaults to +{ }; the mapping-constructor-expr must have static type M and the +annotation value is the result of evaluating the mapping-constructor-expr with M +as the contextually expected type. +

+

+If the annotation-decl for a tag specifies const, then a +mapping-constructor-expr in annotations with that tag must be a const-expr and +is evaluated at compile-time with the semantics of a const-expr. Otherwise, the +mapping-constructor-expr is evaluated when the annotation is evaluated and the +ImmutableClone abstract operation is applied to the result. +

+

+An annotation applied to a module-level declaration is evaluated when the module +is initialized. An annotation applied to a service constructor is evaluated when +the service constructor is evaluated. An annotation occurring within a type +descriptor is evaluated when the type descriptor is resolved. +

+ +
annot-attach-points := annot-attach-point (, annot-attach-point)*
+annot-attach-point :=
+   dual-attach-point
+   | source-only-attach-point
+dual-attach-point := [source] dual-attach-point-ident
+dual-attach-point-ident :=
+   type
+   | class
+   | [object|service remote] function
+   | parameter
+   | return
+   | service
+   | [object|record] field
+source-only-attach-point := source source-only-attach-point-ident
+source-only-attach-point-ident :=
+   annotation
+   | external
+   | var
+   | const
+   | listener
+   | client
+   | worker
+
+

+The annot-attach-points specify the constructs to which an +annotation can be attached. +

+

+When an attachment point is prefixed with source, then the +annotation is attached to a fragment of the source rather than to any runtime +value, and thus is not available at runtime. If any of the attachment points +specify source, the annotation-decl must specify +const. +

+

+When an attachment point is not prefixed with source, then the annotation is +accessible at runtime by applying the annotation access operator to a typedesc +value. +

+

+The available attachment points are described in the following table. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attachment point nameSyntactic attachment point(s)Attached to which type descriptor at runtime
typemodule-type-defn, module-enum-decl, type-cast-exprdefined type
classmodule-class-defndefined type (which will be type of objects constructed using this class)
functionfunction-defn, method-decl, method-defn, anonymous-function-exprtype of function
object functionmethod-decl, method-defntype of function
service remote functionmethod-defn with remote qualifier on service objecttype of function, on service value
returnreturn-type-descriptorindirectly to type of function
parameterrequired-param, defaultable-param, included-record-param, rest-paramindirectly to type of function
serviceservice-decl, object-constructor-expr with service qualifiertype of service
fieldindividual-field-descriptor, member-type-descriptor, object-field-descriptortype of mapping, list or object
object fieldobject-field-descriptor, object-fieldtype of object
record fieldindividual-field-descriptortype of mapping
listenerlistener-declnone
varmodule-var-decl, local-var-decl-stmt, let-var-declnone
constmodule-const-decl, enum-membernone
annotationannotation-declnone
externalexternal-function-bodynone
workernamed-worker-decl, start-actionnone
+
+
+

Documentation

+

+A documentation string is an item of metadata that can be associated with +module-level Ballerina constructs and with method declarations. The purpose of +the documentation strings for a module is to enable a programmer to use the +module. Information not useful for this purpose should be provided in in +comments. +

+

+A documentation string has the format of one or more lines each of which has a +# optionally preceded by blank space. +

+

+The documentation statement is used to document various Ballerina constructs. +

+ +
DocumentationString := DocumentationLine +
+DocumentationLine := BlankSpace* # [Space] DocumentationContent
+DocumentationContent := (^ 0xA)* 0xA
+BlankSpace := Tab | Space
+Space := 0x20
+Tab := 0x9
+
+

+A DocumentationString is recognized only at the beginning of a +line. The content of a documentation string is the concatenation of the +DocumentationContent of each DocumentationLine in the +DocumentationString. Note that a single space following the # is +not treated as part of the DocumentationContent. +

+

+The content of a DocumentationString is parsed as Ballerina +Flavored Markdown (BFM). BFM is also used for a separate per-module +documentation file, conventionally called Module.md. +

+
+
+

Ballerina Flavored Markdown

+

+Ballerina Flavored Markdown is GitHub Flavored Markdown, with some additional +conventions. +

+

+In the documentation string attached to a function or method, there must be +documentation for each parameter, and for the return value if the return value +is not nil. The documentation for the parameters and a return value must consist +of a Markdown list, where each list item must have the form ident - +doc, where ident is either the parameter name or return, and doc is the +documentation of that parameter or of the return value. +

+

+The documentation for an object must contain a list of fields rather than +parameters. Private fields should not be included in the list. +

+

+BFM also provides conventions for referring to Ballerina-defined names from +within documentation strings in a source file. An identifier in backticks +`X`, when preceded by one of the following words: +

+
    +
  • type
  • +
  • service
  • +
  • variable
  • +
  • var
  • +
  • annotation
  • +
  • module
  • +
  • function
  • +
  • parameter
  • +
+

+is assumed to be a reference to a Ballerina-defined name of the type indicated +by the word. In the case of parameter, the name must be unqualified +and be the name of a parameter of the function to which the documentation string +is attached. For other cases, if the name is unqualified it must refer to a +public name of the appropriate type in the source file's module; if it is a +qualified name M:X, then the source file must have imported M, and X must refer +to a public name of an appropriate type in M. BFM also recognizes +`f()` as an alternative to function `f`. In both +cases, f can have any of the following forms (where `m` is a module import, `x` is a +function name, `T` is an object type name, and `y` is a method name): +

+ +
    x()
+    m:x()
+    T.y()
+    m:T.y()
+
+

+Example +

+ +
    # Adds parameter `x` and parameter `y`
+    # + x - one thing to be added
+    # + y - another thing to be added
+    # + return - the sum of them
+    function add (int x, int y) returns int { return x + y; }
+
+ +

+The Ballerina platform may define additional conventions, in particular relating +to headings with particular content. For example, a heading with a content of +Deprecated can be used to provide information about the deprecation +of the name to which the documentation string is attached. +

+ +
+
+ +
+

10. Data tags

+
+

Regular expressions (preview)

+ +

+The re data tag is used for regular expressions. The lang library +module for the corresponding basic type is lang.regexp. +

+

+The syntax and semantics of Ballerina regular expressions are based on Perl. +Ballerina supports a subset of Perl regular expressions that includes the most +commonly used features and is interoperable across multiple regular expression +engines. The supported syntax is defined by the RegExp grammar +given below. +

+ +
RegExp := ReDisjunction
+
+ReDisjunction := ReSequence (| ReSequence)*
+ReSequence := ReTerm*
+ReTerm :=
+   ReAtom [ReQuantifier]
+   | ReAssertion
+ReAssertion := ^ | $
+
+ReQuantifier := ReBaseQuantifier [?]
+
+ReBaseQuantifier :=
+   *
+  | +
+  | ?
+  | { Digit+ [, Digit*] }
+
+ReAtom :=
+   ReLiteralChar
+   | ReEscape
+   | .
+   | [ [^] [ReCharSet] ] 
+   | ( [? ReFlagsOnOff :] ReDisjunction )
+
+ReLiteralChar := ^ ReSyntaxChar
+
+ReSyntaxChar :=
+  ^ | $ | \ | . | * | + | ?
+  | ( | ) | [ | ] | { | } | |
+
+ReEscape :=
+   NumericEscape
+   | ControlEscape
+   | ReQuoteEscape
+   | ReUnicodePropertyEscape
+   | ReSimpleCharClassEscape
+
+ReQuoteEscape := \ ReSyntaxChar
+ControlEscape := \r | \n | \t
+
+ReSimpleCharClassEscape := \ ReSimpleCharClassCode
+
+ReSimpleCharClassCode := d | D | s | S | w | W
+
+ReUnicodePropertyEscape := \ (p | P) { ReUnicodeProperty }
+
+ReUnicodeProperty :=  ReUnicodeScript | ReUnicodeGeneralCategory
+
+ReUnicodeScript := sc= ReUnicodePropertyValue
+
+ReUnicodePropertyValue := ReUnicodePropertyValueChar+
+
+ReUnicodePropertyValueChar := AsciiLetter | Digit | _
+
+ReUnicodeGeneralCategory := [gc=] ReUnicodeGeneralCategoryAbbr
+
+ReUnicodeGeneralCategoryAbbr :=
+  L [ u | l | t | m | o ]
+  | M [ n | c | e ]
+  | N [ d | l | o ]
+  | S [ m | c | k | o ]
+  | P [ c | d | s | e | i | f | o ]
+  | Z [ s | l | p ]
+  | C [ c | f | o | n ]
+
+ReCharSetAtom :=
+  ReCharSetAtomNoDash
+  | -
+
+ReCharSetAtomNoDash :=
+  ReCharSetLiteralChar
+  | ReEscape
+  | \-
+
+ReCharSetLiteralChar := ^ (\ | ] | -)
+
+ReCharSet :=
+  ReCharSetAtom
+  | ReCharSetRange [ReCharSet]
+  | ReCharSetAtom ReCharSetNoDash
+
+ReCharSetRange := ReCharSetAtom - ReCharSetAtom
+
+ReCharSetNoDash :=
+  ReCharSetAtom
+  | ReCharSetRangeNoDash [ReCharSet]
+  | ReCharSetAtomNoDash ReCharSetNoDash
+  
+ReCharSetRangeNoDash := ReCharSetAtomNoDash - ReCharSetAtom
+
+ReFlagsOnOff := ReFlagsOn [- ReFlagsOff]
+ReFlagsOn := ReFlag*
+ReFlagsOff := ReFlag*
+ReFlag :=
+  ReMultilineFlag
+  | ReDotAllFlag
+  | ReIgnoreCaseFlag
+  | ReCommentFlag
+
+ReMultilineFlag := m
+ReDotAllFlag := s
+ReIgnoreCaseFlag := i
+ReCommentFlag := x
+
+

+Note that ReUnicodeGeneralCategoryAbbr omits Cs, which +is used for surrogate code points, since these cannot occur in a Ballerina +string. +

+

+The abstract parsing function that is part of the data tag definition behaves as +follows. The argument string values are concatenated into a single string with a +distinct token inserted between them to represent the interpolation point. The +resulting string is parsed against the above RegExp grammar with +the interpolation point token being an additional possibility allowed for +ReAtom. The abstract parsing function returns a function that will +behave equivalently to parsing the original string with +(?:ri) inserted at interpolation point +i, where ri is the +string representation of the interpolated regular expression. +

+

+The most rigorous specification of the semantics of Perl-style regular +expressions is in the ECMAScript language specification. For this reason, the +semantics of Ballerina regular expressions are defined by reference to the +ECMAScript language specification, specifically ECMAScript 2022. The syntax of +Ballerina regular expressions has been chosen to be a subset of ECMAScript +regular expression syntax with one exception: regular expression flags, which in +ECMAScript are specified in the regular expression literal following the closing +/, are in Ballerina specified in the regular expression itself +(using the same syntax as Perl). +

+

+The semantics of a Ballerina regular expression are as specified by ECMAScript +subject to the following points: +

+
    +
  • the version of ECMAScript used is ECMAScript 2022 (ECMA-262, 13th edition);
  • +
  • Ballerina uses the semantics defined by ECMAScript for when Unicode mode, as set by the +u flag, is in effect (ECMAScript regular expressions work differently depending +on whether Unicode mode is in effect or not);
  • +
  • the semantics of \p and \P, and of the +i flag depend on the version of Unicode being used; this version of +Ballerina uses Unicode version 10;
  • +
  • regular expression constructs that depend on the definition of a line +terminator or whitespace use the Ballerina definitions of those rather than the +ECMAScript definitions; specifically +
      +
    • . matches any character other than 0xA or 0xD;
    • +
    • \s matches any character allowed by the +WhiteSpaceChar production; as in ECMAScript, \S +matches any character not matched by \s;
    • +
    +
  • +
  • the semantics of ReFlagsOnOff (which is not supported in ECMAScript) are as follows: +
      +
    • the flags are modified within the parenthesized group containing the +ReFlagsOnOff, with those in ReFlagsOn being turned on, +and those in ReFlagsOff being turned off;
    • +
    • it is an error for any flag to be specified more than once within +ReFlagsOnOff;
    • +
    • the meaning of the m, s and i flags are as +in ECMAScript;
    • +
    • the meaning of the x flag is as in Perl: when this flag is in +effect, any character in the regular expression that matches to the +WhiteSpaceChar production, but is not within an +ReCharSet is ignored; in addition, comments starting with +# and continuing to the end of the line are ignored.
    • +
    +
  • +
+ +

+ECMAScript specifies how to compile a regular expression in the above syntax +into an abstract function that takes as arguments an input string and an index +into the input string, and returns a value saying whether the regular expression +matches the input string starting at the index, and, if it does, the index where +the match ended, and for each capturing group, the start and end index, if any, +within the input string where the capturing group matched. This abstract +function corresponds directly to the matchGroupsAt function in the +lang.regexp module. The matchAt, find, +findGroups, findAll and findAllGroups +functions can be defined straightforwardly in terms of the +matchGroupsAt function. The fullMatchGroup function +can be implemented by first appending `$` to the regular expression so as to +anchor any match to the end of the input string (the multiline flag is initially +off, so `$` matches only at the end of input), and then using the ECMAScript +abstract function with a start index of 0. The isFullMatch function +can be implemented straightforwardly in terms of the fullMatchGroup +function. +

+ +
+ +
+ +
+

11. Lang library

+ +

+Modules in the ballerina organization with a module name starting +with lang. are reserved for use by this specification. These +modules are called the lang library. +

+ +
+

Generic types

+

+Modules in the lang library can make use generic typing. Since generic typing +has not yet been added to Ballerina, the source code for the modules use an +annotation to describe generic typing as follows. When a module type definition +has a @typeParam annotation, it means that this type serves as a +type parameter when it is used in a function definition: all uses of the type +parameter in a function definition refer to the same type; the definition of the +type is an upper bound on the type parameter. A parameter of a function +definition can be annotated with an @isolatedParam annotation; this +is allowed when the function is declared as isolated and the type of the +parameter is a function type; the meaning is that when the function is called in +a context that requires it to be isolated, then the argument supplied for the +parameter must also be isolated. In effect, the function is parameterized with +the isolated qualifier. +

+

+Note We plan to provide full support for generic types in +a future version of this specification. +

+
+ +
+

Built-in subtypes

+

+A module in the lang library can provide types that are built-in in the +sense that their meaning is defined by this specification. Each such built-in +type is a subtype of a single basic type; a built-in type that is a subtype of a +basic type B is provided by the module +lang.B. +

+

+The built-types provided by lang library modules are described in the following +table. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Basic typeType nameCriteria for v to belong to type
intUnsigned80 ≤ v ≤ 255
Signed8-128 ≤ v ≤ 127
Unsigned160 ≤ v ≤ 65,535
Signed16-32,768 ≤ v ≤ 32,767
Unsigned320 ≤ v ≤ 4,294,967,295
Signed32-2,147,483,648 ≤ v ≤ 2,147,483,647
stringCharv has length 1
xmlElementv is an element singleton
ProcessingInstructionv is a processing instruction singleton
Commentv is a comment singleton
Textv is either the empty xml value or a text singleton
+

+Each built-in type has a type definition in the module that provides it. The +type descriptor of the type definition is the corresponding basic type. The type +definition has a @builtinSubtype annotation, which indicates that +the meaning of the type name is built-in, as specified in the above table, +rather than coming from its type descriptor. It is an error to use the +@builtinSubtype annotation except in a lang library module. +

+

+So, for example, the lang.int module would include the definition: +

+
+@builtinSubtype
+type Signed32 int;
+
+

+Semantically, these types behave like a predefined type that can be referenced +by an unqualified name, such as byte. Syntactically, these types +are referenced by a type-reference in the same way as if their +definitions were not built-in. A built-in type T which is a subtype +of basic type B can be referenced by a type-reference +M:T, where M is a module-prefix referring to module +ballerina/lang.B. +

+

+For convenience, this specification refers to the built-in subtype T provided by +the module for basic type B as B:T. For example, in this specification +int:Signed32 refers to the Signed32 built-in subtype +of int, which is provided by the lang.int module. +

+

+The int:Unsigned8 type is equivalent to the predefined +byte type. +

+
+ +
+

Lang library modules

+

+The lang library consists of the following modules. With the exception of the +lang.value, lang.transaction and +lang.runtime modules, each corresponds to a basic type. +

+ +
+

lang.array module

+ +

The lang.array module corresponds to basic type list.

+ +
= `startIndex` and < `endIndex` 
+public isolated function slice(Type[] arr, int startIndex, int endIndex = arr.length()) returns Type[] = external;
+
+# Removes a member of an array.
+#
+# + arr - the array
+# + index - index of member to be removed from `arr`
+# + return - the member of `arr` that was at `index`
+# This removes the member of `arr` with index `index` and returns it.
+# It panics if there is no such member.
+public isolated function remove(Type[] arr, int index) returns Type = external;
+
+# Removes all members of an array.
+# + arr - the array
+# Panics if any member cannot be removed.
+public isolated function removeAll((any|error)[] arr) returns () = external;
+
+# Changes the length of an array.
+# 
+# + arr - the array of which to change the length
+# + length - new length
+# `setLength(arr, 0)` is equivalent to `removeAll(arr)`.
+public isolated function setLength((any|error)[] arr, int length) returns () = external;
+
+# Returns the index of first member of `arr` that is equal to `val` if there is one.
+# Returns `()` if not found.
+# Equality is tested using `==`.
+#
+# + arr - the array
+# + val - member to search for
+# + startIndex - index to start the search from
+# + return - index of the member if found, else `()`
+public isolated function indexOf(AnydataType[] arr, AnydataType val, int startIndex = 0) returns int? = external;
+
+# Returns the index of last member of `arr` that is equal to `val` if there is one.
+# Returns `()` if not found.
+# Equality is tested using `==`.
+#
+# + arr - the array
+# + val - member to search for
+# + startIndex - index to start searching backwards from
+# + return - index of the member if found, else `()`
+public isolated function lastIndexOf(AnydataType[] arr, AnydataType val, int startIndex = arr.length() - 1) returns int? = external;
+
+# Reverses the order of the members of an array.
+#
+# + arr - the array to be reversed
+# + return - new array with the members of `arr` in reverse order
+public isolated function reverse(Type[] arr) returns Type[] = external;
+
+# Direction for `sort` function.
+public enum SortDirection {
+   ASCENDING = "ascending",
+   DESCENDING = "descending"
+}
+
+# A type of which any ordered type must be a subtype.
+# Whether a type is an ordered type cannot be defined in
+# terms of being a subtype of a type, so being a subtype
+# of `OrderedType` is a necessary but not sufficient condition
+# for a type to be an ordered type.
+public type OrderedType ()|boolean|int|float|decimal|string|OrderedType[];
+
+# Sorts an array.
+# If the member type of the array is not ordered, then the `key` function
+# must be specified.
+# Sorting works the same as with the `sort` clause of query expressions.
+#
+# + arr - the array to be sorted; 
+# + direction - direction in which to sort
+# + key - function that returns a key to use to sort the members
+# + return - new array consisting of the members of `arr` in sorted order
+public isolated function sort(Type[] arr, SortDirection direction = ASCENDING,
+        (isolated function(Type val) returns OrderedType)? key = ()) returns Type[] = external;
+
+
+# Removes and returns the last member of an array.
+# The array must not be empty.
+#
+# + arr - the array
+# + return - removed member
+public isolated function pop(Type[] arr) returns Type = external;
+
+# Adds values to the end of an array.
+#
+# + arr - the array
+# + vals - values to add to the end of the array
+public isolated function push(Type[] arr, Type... vals) returns () = external;
+
+
+# Removes and returns first member of an array.
+# The array must not be empty.
+#
+# + arr - the array
+# + return - the value that was the first member of the array
+public isolated function shift(Type[] arr) returns Type = external;
+
+# Adds values to the start of an array.
+# The values newly added to the array will be in the same order
+# as they are in `vals`.
+# 
+# + arr - the array
+# + vals - values to add to the start of the array
+public isolated function unshift(Type[] arr, Type... vals) returns () = external;
+
+
+# Returns the string that is the Base64 representation of an array of bytes.
+# The representation is the same as used by a Ballerina Base64Literal.
+# The result will contain only characters  `A..Z`, `a..z`, `0..9`, `+`, `/` and `=`.
+# There will be no whitespace in the returned string.
+#
+# + arr - the array
+# + return - Base64 string representation
+public isolated function toBase64(byte[] arr) returns string = external;
+
+# Returns the byte array that a string represents in Base64.
+# `str` must consist of the characters `A..Z`, `a..z`, `0..9`, `+`, `/`, `=`
+# and whitespace as allowed by a Ballerina Base64Literal.
+#
+# + str - Base64 string representation
+# + return - the byte array or error
+public isolated function fromBase64(string str) returns byte[]|error = external;
+
+# Returns the string that is the Base16 representation of an array of bytes.
+# The representation is the same as used by a Ballerina Base16Literal.
+# The result will contain only characters  `0..9`, `a..f`.
+# There will be no whitespace in the returned string.
+#
+# + arr - the array
+# + return - Base16 string representation
+public isolated function toBase16(byte[] arr) returns string = external;
+
+# Returns the byte array that a string represents in Base16.
+# `str` must consist of the characters `0..9`, `A..F`, `a..f`
+# and whitespace as allowed by a Ballerina Base16Literal.
+#
+# + str - Base16 string representation
+# + return - the byte array or error
+public isolated function fromBase16(string str) returns byte[]|error = external;
+
+# Returns a stream of the members of an array.
+#
+# + arr - the array
+# + returns - stream of members of the array
+# The returned stream will use an iterator over `arr` and
+# will therefore handle mutation of `arr` in the same way
+# as an iterator does.
+# Theutation of the `arr`
+public isolated function toStream(T[] arr) returns stream = external;
+]]>
+ +
+ +
+

lang.boolean module

+ +

The lang.boolean module corresponds to basic type boolean.

+ +
+ +
+ +
+

lang.decimal module

+ +

The lang.decimal module corresponds to basic type decimal.

+ +
x` is the same as `x.round(0)`.
+#
+# + x - decimal value to operate on
+# + fractionDigits - the number of digits after the decimal point
+# + return - closest decimal value to `x` that is an integral multiple of 10 raised to the power of `-fractionDigits`
+public isolated function round(decimal x, int fractionDigits = 0) returns decimal = external;
+
+# Return a decimal with a specified value and exponent.
+# Return a decimal value that has the same value (except for rounding) as the first
+# argument, and the same exponent as the second argument.
+# This is the IEEE quantize operation.
+# + x - decimal value to operate on
+# + y - decimal value from which to get the quantum
+# + return - `x` with the quantum of `y`
+public isolated function quantize(decimal x, decimal y) returns decimal = external;
+
+# Rounds a decimal down to the closest integral value.
+#
+# + x - decimal value to operate on
+# + return - largest (closest to +∞) decimal value not greater than `x` that is a mathematical integer.
+public isolated function floor(decimal x) returns decimal = external;
+
+# Rounds a decimal up to the closest integral value.
+#
+# + x - decimal value to operate on
+# + return - smallest (closest to -∞) decimal value not less than `x` that is a mathematical integer
+public isolated function ceiling(decimal x) returns decimal = external;
+
+# Return the decimal value represented by `s`.
+# `s` must follow the syntax of DecimalFloatingPointNumber as defined by the Ballerina specification
+# with the following modifications
+# - the DecimalFloatingPointLiteral may have a leading `+` or `-` sign
+# - a FloatingPointTypeSuffix is not allowed
+# This is the inverse of `value:toString` applied to an `decimal`.
+#
+# + s - string representation of a decimal
+# + return - decimal representation of the argument or error
+public isolated function fromString(string s) returns decimal|error = external;
+]]>
+ +
+ +
+

lang.error module

+ +

The lang.error module corresponds to basic type error.

+ +
|table>;
+
+# The type to which error detail records must belong.
+public type Detail record {|
+   Cloneable...;
+|};
+
+# A type parameter that is a subtype of error `Detail` record type.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type DetailType Detail;
+
+# Returns the error's message.
+#
+# + e - the error value
+# + return - error message
+public isolated function message(error e) returns string = external;
+
+# Returns the error's cause.
+#
+# + e - the error value
+# + return - error cause
+public isolated function cause(error e) returns error? = external;
+
+# Returns the error's detail record.
+# The returned value will be immutable.
+# + e - the error value
+# + return - error detail value
+public isolated function detail(error e) returns readonly & DetailType = external;
+
+# Type representing a stack frame.
+# A call stack is represented as an array of stack frames.
+# This type is also present in lang.runtime to avoid a dependency.
+public type StackFrame readonly & object {
+   # Returns a string representing this StackFrame.
+   # This must not contain any newline characters.
+   # + return - a string
+   public isolated function toString() returns string;
+};
+
+# Returns an array representing an error's stack trace.
+#
+# + e - the error value
+# + return - an array representing the stack trace of the error value
+# The first member of the array represents the top of the call stack.
+public isolated function stackTrace(error e) returns StackFrame[] = external;
+
+# Converts an error to a string.
+#
+# + e - the error to be converted to a string
+# + return - a string resulting from the conversion
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the direct style.
+public isolated function toString(error e) returns string = external;
+
+# Converts an error to a string that describes the value in Ballerina syntax.
+# + e - the error to be converted to a string
+# + return - a string resulting from the conversion
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the expression style.
+public isolated function toBalString(error e) returns string = external;
+
+# The type of error for a receive-action when no message has been sent.
+public type NoMessage distinct error;
+
+# A type of error which can be retried.
+public type Retriable distinct error;
+
+# The RetryManager used by default.
+public class DefaultRetryManager {
+   private int count;
+   public function init(int count = 3) {
+     this.count = count;
+   }
+   public function shouldRetry(error e) returns boolean {
+      if e is Retriable && count >  0 {
+         count -= 1;
+         return true;
+      }
+      else {
+         return false;
+      }
+   }
+}
+]]>
+ +
+ +
+

lang.float module

+ +

The lang.float module corresponds to basic type float.

+ +
x` is the same as `x.round(0)`.
+#
+# + x - float value to operate on
+# + fractionDigits - the number of digits after the decimal point
+# + return - float value closest to `x` that is an integral multiple of 10 raised to the power of `-fractionDigits`
+public isolated function round(float x, int fractionDigits = 0) returns float = external;
+
+# Rounds a float down to the closest integral value.
+#
+# + x - float value to operate on
+# + return - largest (closest to +∞) float value not greater than `x` that is a mathematical integer.
+public isolated function floor(float x) returns float = external;
+
+# Rounds a float up to the closest integral value.
+#
+# + x - float value to operate on
+# + return - smallest (closest to -∞) decimal value not less than `x` that is a mathematical integer
+public isolated function ceiling(float x) returns float = external;
+
+# Returns the square root of a float value.
+# Corresponds to IEEE squareRoot operation.
+#
+# + x - float value to operate on
+# + return - square root of `x`
+public isolated function sqrt(float x) returns float = external;
+
+# Returns the cube root of a float value.
+# Corresponds to IEEE rootn(x, 3) operation.
+#
+# + x - float value to operate on
+# + return - cube root of `x`
+public isolated function cbrt(float x) returns float = external;
+
+# Raises one float value to the power of another float values.
+# Corresponds to IEEE pow(x, y) operation.
+#
+# + x - base value
+# + y - the exponent
+# + return - `x` raised to the power of `y`
+public isolated function pow(float x, float y) returns float = external;
+
+# Returns the natural logarithm of a float value
+# Corresponds to IEEE log operation.
+#
+# + x - float value to operate on
+# + return - natural logarithm of `x`
+public isolated function log(float x) returns float = external;
+
+# Returns the base 10 logarithm of a float value.
+# Corresponds to IEEE log10 operation.
+#
+# + x - float value to operate on
+# + return - base 10 logarithm of `x`
+public isolated function log10(float x) returns float = external;
+
+# Raises Euler's number to a power.
+# Corresponds to IEEE exp operation.
+#
+# + x - float value to operate on
+# + return - Euler's number raised to the power `x`
+public isolated function exp(float x) returns float = external;
+
+# Returns the sine of a float value.
+# Corresponds to IEEE sin operation.
+#
+# + x - float value, specifying an angle in radians
+# + return - the sine of `x`
+public isolated function sin(float x) returns float = external;
+
+# Returns the cosine of a float value.
+# Corresponds to IEEE cos operation.
+#
+# + x - float value, specifying an angle in radians
+# + return - the cosine of `x`
+public isolated function cos(float x) returns float = external;
+
+# Returns the tangent of a float value.
+# Corresponds to IEEE tan operation
+#
+# + x - float value, specifying an angle in radians
+# + return - the tangent of `x`
+public isolated function tan(float x) returns float = external;
+
+# Returns the arccosine of a float value.
+# Corresponds to IEEE acos operation
+#
+# + x - float value to operate on
+# + return - the arccosine of `x` in radians
+public isolated function acos(float x) returns float = external;
+
+# Returns the arctangent of a float value.
+# Corresponds to IEEE atan operation.
+#
+# + x - float value to operate on
+# + return - the arctangent of `x` in radians
+public isolated function atan(float x) returns float = external;
+
+# Returns the arcsine of a float value.
+# Corresponds to IEEE asin operation.
+#
+# + x - float value to operate on
+# + return - the arcsine of `x` in radians
+public isolated function asin(float x) returns float = external;
+
+# Performs the 2-argument arctangent operation.
+# Corresponds IEEE atan2(y, x) operation.
+#
+# + y - the y-coordinate
+# + x - the x-coordinate
+# + return - the angle in radians from the positive x-axis to the point
+#   whose Cartesian coordinates are `(x, y)`
+public isolated function atan2(float y, float x) returns float = external;
+
+# Returns the hyperbolic sine of a float value.
+# Corresponds to IEEE sinh operation.
+#
+# + x - float value to operate on
+# + return - hyperbolic sine of `x`
+public isolated function sinh(float x) returns float = external;
+
+# Returns the hyperbolic cosine of a float value.
+# Corresponds to IEEE cosh operation.
+#
+# + x - float value to operate on
+# + return - hyperbolic cosine of `x`
+public isolated function cosh(float x) returns float = external;
+
+# Returns the hyperbolic tangent of a float value.
+# Corresponds to IEEE tanh operation.
+#
+# + x - float value to operate on
+# + return - hyperbolic tangent of `x`
+public isolated function tanh(float x) returns float = external;
+
+# Return the float value represented by `s`.
+# `s` must follow the syntax of DecimalFloatingPointNumber as defined by the Ballerina specification
+# with the following modifications
+# - the DecimalFloatingPointNumber may have a leading `+` or `-` sign
+# - `NaN` is allowed
+# - `Infinity` is allowed with an optional leading `+` or `-` sign
+# - a FloatingPointTypeSuffix is not allowed
+# This is the inverse of `value:toString` applied to an `float`.
+#
+# + s - string representation of a float
+# + return - float value or error
+public isolated function fromString(string s) returns float|error = external;
+
+# Returns a string that represents `x` as a hexadecimal floating point number.
+# The returned string will comply to the grammar of HexFloatingPointLiteral
+# in the Ballerina spec with the following modifications:
+# - it will have a leading `-` sign if negative
+# - positive infinity will be represented by `Infinity`
+# - negative infinity will be represented by `-Infinity`
+# - NaN will be represented by `NaN`
+# The representation includes `0x` for finite numbers.
+#
+# + x - float value
+# + return - hexadecimal floating point hex string representation
+public isolated function toHexString(float x) returns string = external;
+
+# Return the float value represented by `s`.
+# `s` must follow the syntax of HexFloatingPointLiteral as defined by the Ballerina specification
+# with the following modifications
+# - the HexFloatingPointLiteral may have a leading `+` or `-` sign
+# - `NaN` is allowed
+# - `Infinity` is allowed with an optional leading `+` or `-` sign
+#
+# + s - hexadecimal floating point hex string representation
+# + return - float value or error
+public isolated function fromHexString(string s) returns float|error = external;
+
+# Returns IEEE 64-bit binary floating point format representation of `x` as an int.
+#
+# + x - float value
+# + return - `x` bit pattern as an int
+public isolated function toBitsInt(float x) returns int = external;
+
+# Returns the float that is represented in IEEE 64-bit floating point by `x`.
+# All bit patterns that IEEE defines to be NaNs will all be mapped to the single float NaN value.
+#
+# + x - int value
+# + return - `x` bit pattern as a float
+public isolated function fromBitsInt(int x) returns float = external;
+
+# Returns a string that represents `x` using fixed-point notation.
+# The returned string will be in the same format used by `value:toString`,
+# except that it will not include an exponent.
+# If `x` is NaN or infinite, the result will be the same as `value:toString`.
+# This will panic if `fractionDigits` is less than 0.
+# If `fractionDigits` is zero, there will be no decimal point.
+# Any necessary rounding will use the roundTiesToEven rounding direction.
+# 
+# + x - float value
+# + fractionDigits - number of digits following the decimal point; `()` means to use
+#    the minimum number of digits required to accurately represent the value
+# + return - string representation of `x` in fixed-point notation 
+public isolated function toFixedString(float x, int? fractionDigits) returns string = external;
+
+# Returns a string that represents `x` using scientific notation.
+# The returned string will be in the same format used by `value:toString`,
+# except that it will always include an exponent and there will be exactly
+# one digit before the decimal point.
+# But if `x` is NaN or infinite, the result will be the same as `value:toString`.
+# The digit before the decimal point will be zero only if all other digits
+# are zero.
+# This will panic if fractionDigits is less than 0.
+# If `fractionDigits` is zero, there will be no decimal point.
+# Any necessary rounding will use the roundTiesToEven rounding direction.
+# The exponent in the result uses lower-case `e`, followed by a `+` or `-` sign,
+# followed by at least two digits, and only as many more digits as are needed
+# to represent the result. If `x` is zero, the exponent is zero. A zero exponent
+# is represented with a `+` sign.
+# 
+# + x - float value
+# + fractionDigits - number of digits following the decimal point; `()` means to use
+#    the minimum number of digits required to accurately represent the value
+# + return - string representation of `x` in scientific notation 
+public isolated function toExpString(float x, int? fractionDigits) returns string = external;
+]]>
+ +
+ +
+

lang.function module

+ +

The lang.function module corresponds to basic type function.

+ +
+ +
+ +
+

lang.future module

+ +

The lang.future module corresponds to basic type future.

+ +
+ +
+ +
+

lang.int module

+ +

The lang.int module corresponds to basic type int.

+ +
= 0 }`.
+# When `step > 0`, the members of S that are `< rangeEnd` are returned in increasing order.
+# When `step < 0`, the members of S that are `> rangeEnd` are returned in decreasing order.
+# When `step = 0`, the function panics.
+# + rangeStart - the first integer to be returned by the iterator
+# + rangeEnd - the exclusive limit on the integers returned by the iterator
+# + step - the difference between successive integers returned by the iterator;
+#    a positive value gives an increasing sequence; a negative value gives
+#    a decreasing sequence
+# + return - an iterable object
+public isolated function range(int rangeStart, int rangeEnd, int step) returns object {
+    *object:Iterable;
+    public isolated function iterator() returns object {
+        public isolated function next() returns record {|
+            int value;
+       |}?;
+    };
+} = external;
+]]>
+ +
+ +
+

lang.map module

+ +

The lang.map module corresponds to basic type mapping.

+ +
 m) returns int = external;
+
+# Returns an iterator over a map.
+# The iterator will iterate over the members of the map not the keys.
+# The `entries` function can be used to iterate over the keys and members together.
+# The `keys` function can be used to iterator over just the keys.
+# 
+# + m - the map
+# + return - a new iterator object that will iterate over the members of `m`
+public isolated function iterator(map m) returns object {
+    public isolated function next() returns record {|
+        Type value;
+    |}?;
+} = external;
+
+# Returns the member of map `m` with key `k`.
+# This for use in a case where it is known that the map has a specific key,
+# and accordingly panics if `m` does not have a member with key `k`.
+#
+# + m - the map
+# + k - the key
+# + return - member with key `k`
+public isolated function get(map m, string k) returns Type = external;
+
+# Returns a map containing [key, member] pair as the value for each key.
+#
+# + m - the map
+# + return - a new map of [key, member] pairs
+public isolated function entries(map m) returns map<[string, Type]> = external;
+
+
+# Applies a function each member of a map and returns a map of the result.
+# The resulting map will have the same keys as the argument map.
+#
+# + m - the map
+# + func - a function to apply to each member
+# + return - new map containing result of applying function `func` to each member
+public isolated function 'map(map m, @isolatedParam function(Type val) returns Type1 func) returns map = external;
+
+# Applies a function to each member of a map.
+# The function `func` is applied to each member of `m`.
+#
+# + m - the map
+# + func - a function to apply to each member
+public isolated function forEach(map m, @isolatedParam function(Type val) returns () func) returns () = external;
+
+# Selects the members from a map for which a function returns true.
+#
+# + m - the map
+# + func - a predicate to apply to each element to test whether it should be included
+# + return - new map containing members for which `func` evaluates to true
+public isolated function filter(map m, @isolatedParam function(Type val) returns boolean func) returns map = external;
+
+# Combines the members of a map using a combining function.
+# The combining function takes the combined value so far and a member of the map,
+# and returns a new combined value.
+#
+# + m - the map
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `m` using `func`
+public isolated function reduce(map m, @isolatedParam function(Type1 accum, Type val) returns Type1 func, Type1 initial) returns Type1 = external;
+
+# Removes a member of a map.
+#
+# + m - the map
+# + k - the key
+# + return - the member of `m` that had key `k`
+# This removes the member of `m` with key `k` and returns it.
+# It panics if there is no such member.
+public isolated function remove(map m, string k) returns Type = external;
+
+# Removes a member of a map with a given key, if the map has member with the key.
+#
+# + m - the map
+# + k - the key
+# + return - the member of `m` that had key `k`, or `()` if `m` does not have a key `k`
+# If `m` has a member with key `k`, it removes and returns it;
+# otherwise it returns `()`.
+public isolated function removeIfHasKey(map m, string k) returns Type? = external;
+
+# Removes all members of a map.
+# This panics if any member cannot be removed.
+#
+# + m - the map
+public isolated function removeAll(map m) returns () = external;
+
+# Tests whether m has a member with key `k`.
+#
+# + m - the map
+# + k - the key
+# + return - true if m has a member with key `k`
+public isolated function hasKey(map m, string k) returns boolean = external;
+
+# Returns a list of all the keys of map `m`.
+#
+# + m - the map
+# + return - a new list of all keys
+public isolated function keys(map m) returns string[] = external;
+
+# Returns a list of all the members of a map.
+#
+# + m - the map
+# + return - an array whose members are the members of `m`
+public isolated function toArray(map m) returns Type[] = external;
+]]>
+ +
+ +
+

lang.object module

+ +

The lang.object module corresponds to basic type object.

+ +
+ +
+ +
+

lang.regexp module (preview)

+ +

The lang.regexp module corresponds to the basic type for the +tagged data type with tag re.

+ +
 1,is the i-th capturing group;
+# this will be nil if the match of the regular expression did not use
+# a match of the capturing group.
+# The capturing groups within a regular expression are ordered by the position
+# of their opening parenthesis.
+public type Groups readonly & [Span, Span?...];
+
+# Returns the first match of a regular expression within a string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to start looking for a match
+# + return - a `Span` describing the match, or nil if no match was found
+public isolated function find(RegExp re, string str, int startIndex = 0) returns Span? = external;
+
+# Returns the `Groups` for the first match of a regular expression within a string.
+#
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to start looking for a match
+# + return - a `Groups` list describing the match, or nil if no match was found
+public isolated function findGroups(RegExp re, string str, int startIndex = 0) returns Groups? = external;
+
+# Returns a list of all the matches of a regular expression within a string.
+# After one match is found, it looks for the next match starting where the previous
+# match ended, so the list of matches will be non-overlapping.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for matches of `re` 
+# + startIndex - the index within `str` at which to start looking for matches
+# + return - a list containing a `Span` for each match found
+public isolated function findAll(RegExp re, string str, int startIndex = 0) returns Span[] = external;
+
+# Returns the `Groups` of all the matches of a regular expression within a string.
+# After one match is found, it looks for the next match starting where the previous
+# match ended, so the list of matches will be non-overlapping.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for matches of `re` 
+# + startIndex - the index within `str` at which to start looking for matches
+# + return - a list containing a `Group` for each match found
+public isolated function findAllGroups(RegExp re, string str, int startIndex = 0) returns Groups[] = external;
+
+# Tests whether there is a match of a regular expression at a specific index in the string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to look for a match; defaults to zero
+# + return - a `Span` describing the match, or nil if `re` did not match at that index; the startIndex of the
+#   `Span` will always be equal to `startIndex`
+public isolated function matchAt(RegExp re, string str, int startIndex = 0) returns Span? = external;
+
+# Returns the `Groups` of the match of a regular expression at a specific index in the string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + startIndex - the index within `str` at which to look for a match; defaults to zero
+# + return - a `Groups` list describing the match, or nil if `re` did not match at that index; the startIndex of the
+#   first `Span` in the list will always be equal to the `startIndex` of the first member of the list
+public isolated function matchGroupsAt(RegExp re, string str, int startIndex = 0) returns Groups? = external;
+
+# Tests whether there is full match of regular expression with a string.
+# A match of a regular expression in a string is a full match if it
+# starts at index 0 and ends at index `n`, where `n` is the length of the string.
+#
+# + re - the regular expression  
+# + str - the string
+# + return - true if there is full match of `re` with `str`, and false otherwise
+public isolated function isFullMatch(RegExp re, string str) returns boolean = external;
+
+# Returns the `Groups` of the match of a regular expression that is a full match of a string.
+# A match of the regular expression in a string is a full match if it
+# starts at index 0 and ends at index `n`, where `n` is the length of the string.
+# 
+# + re - the regular expression  
+# + str - the string in which to look for a match of `re` 
+# + return - a `Groups` list describing the match, or nil if there is not a full match; the 
+#   first `Span` in the list will be all of `str`
+public isolated function fullMatchGroups(RegExp re, string str) returns Groups? = external;
+
+# A function that constructs the replacement for the match of a regular expression.
+# The `groups` parameter describes the match for which the replacement is to be constructed.
+public type ReplacerFunction isolated function(Groups groups) returns string;
+
+# The replacement for the match of a regular expression found within a string.
+# A string value specifies that the replacement is a fixed string.
+# A function that specifies that the replacement is constructed by calling a function for each match.
+public type Replacement ReplacerFunction|string;
+
+# Replaces the first match of a regular expression.
+#
+# + re - the regular expression  
+# + str - the string in which to perform the replacements  
+# + replacement - a `Replacement` that gives the replacement for the match  
+# + startIndex - the index within `str` at which to start looking for a match; defaults to zero
+# + return - `str` with the first match, if any, replaced by the string specified by `replacement`
+public isolated function replace(RegExp re, string str, Replacement replacement, int startIndex = 0) returns string = external;
+
+# Replaces all matches of a regular expression.
+# After one match is found, it looks for the next match starting where the previous
+# match ended, so the matches will be non-overlapping.
+#
+# + re - the regular expression  
+# + str - the string in which to perform the replacements  
+# + replacement - a `Replacement` that gives the replacement for each match  
+# + startIndex - the index within `str` at which to start looking for matches; defaults to zero
+# + return - `str` with every match replaced by the string specified by `replacement`
+public isolated function replaceAll(RegExp re, string str, Replacement replacement, int startIndex = 0) returns string = external;
+
+# Splits a string into substrings separated by matches of a regular expression.
+# This finds the the non-overlapping matches of a regular expression and
+# returns a list of substrings of `str` that occur before the first match,
+# between matches, or after the last match.  If there are no matches, then
+# `[str]` will be returned.
+# 
+# + re - the regular expression that specifies the separator
+# + str - the string to be split
+# + return - a list of substrings of `str` separated by matches of `re` 
+public isolated function split(RegExp re, string str) returns string[] = external;
+
+# Constructs a regular expression from a string.
+# The syntax of the regular expression is the same as accepted by the `re` tagged data template expression.
+#
+# + str - the string representation of a regular expression
+# + return - the regular expression, or an error value if `str` is not a valid regular expression
+public isolated function fromString(string str) returns RegExp|error = external;
+]]>
+ +
+ +
+

lang.stream module

+ +

The lang.stream module corresponds to basic type stream.

+ +
 stm) returns object {
+    public isolated function next() returns record {|
+        Type value;
+    |}|CompletionType;
+} = external;
+
+# Returns the next member of the stream.
+#
+# + stm - the stream
+# + return - a record containing the next member of the stream, if there is one, or,
+#   otherwise, the completion value
+public isolated function next(stream stm) returns record {|
+        Type value;
+    |}|CompletionType = external;
+
+# Closes a stream.
+# This releases any system resources being used by the stream.
+# Closing a stream that has already been closed has no effect and returns `()`.
+#
+# + stm - the stream to close
+# + return - () if the close completed successfully, otherwise an error
+public isolated function close(stream stm) returns CompletionType? = external;
+
+
+# Applies a function to each member of a stream and returns a stream of the results.
+#
+# + stm - the stream
+# + func - a function to apply to each member
+# + return - new stream containing result of applying `func` to each member of `stm` in order
+public isolated function 'map(stream stm, @isolatedParam function(Type val) returns Type1 func)
+   returns stream = external;
+
+# Applies a function to each member of a stream.
+# The function `func` is applied to each member of stream `stm` in order.
+#
+# + stm - the stream
+# + func - a function to apply to each member
+public isolated function forEach(stream stm, @isolatedParam function(Type val) returns () func) returns CompletionType = external;
+
+# Selects the members from a stream for which a function returns true.
+#
+# + stm - the stream
+# + func - a predicate to apply to each member to test whether it should be selected
+# + return - new stream only containing members of `stm` for which `func` evaluates to true
+public isolated function filter(stream stm, @isolatedParam function(Type val) returns boolean func)
+   returns stream = external;
+
+# Combines the members of a stream using a combining function.
+# The combining function takes the combined value so far and a member of the stream,
+# and returns a new combined value.
+#
+# + stm - the stream
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `stm` using `func`
+public isolated function reduce(stream stm, @isolatedParam function(Type1 accum, Type val) returns Type1 func, Type1 initial)
+   returns Type1|ErrorType = external;
+]]>
+ +
+ +
+

lang.string module

+ +

The lang.string module corresponds to basic type string.

+ +
= startIndex and < endIndex
+public isolated function substring(string str, int startIndex, int endIndex = str.length()) returns string = external;
+
+# Lexicographically compares strings using their Unicode code points.
+# This orders strings in a consistent and well-defined way,
+# but the ordering will often not be consistent with cultural expectations
+# for sorted order.
+#
+# + str1 - the first string to be compared
+# + str2 - the second string to be compared
+# + return - an int that is less than, equal to or greater than zero,
+#    according as `str1` is less than, equal to or greater than `str2`
+public isolated function codePointCompare(string str1, string str2) returns int = external;
+
+# Joins zero or more strings together with a separator.
+#
+# + separator - separator string
+# + strs - strings to be joined
+# + return - a string consisting of all of `strs` concatenated in order
+#     with `separator` in between them
+public isolated function 'join(string separator, string... strs) returns string = external;
+
+# Finds the first occurrence of one string in another string.
+#
+# + str - the string in which to search
+# + substr - the string to search for
+# + startIndex - index to start searching from
+# + return - index of the first occurrence of `substr` in `str` that is >= `startIndex`,
+#    or `()` if there is no such occurrence
+public isolated function indexOf(string str, string substr, int startIndex = 0) returns int? = external;
+
+# Finds the last occurrence of one string in another string.
+#
+# + str - the string in which to search
+# + substr - the string to search for
+# + startIndex - index to start searching backwards from
+# + return - index of the last occurrence of `substr` in `str` that is <= `startIndex`,
+#    or `()` if there is no such occurrence
+public isolated function lastIndexOf(string str, string substr, int startIndex = str.length() - substr.length()) returns int? = external;
+
+# Tests whether a string includes another string.
+#
+# + str - the string in which to search
+# + substr - the string to search for
+# + startIndex - index to start searching from
+# + return - `true` if there is an occurrence of `substr` in `str` at an index >= `startIndex`,
+#    or `false` otherwise
+public isolated function includes(string str, string substr, int startIndex = 0) returns boolean = external;
+
+# Tests whether a string starts with another string.
+#
+# + str - the string to be tested
+# + substr - the starting string
+# + return - true if `str` starts with `substr`; false otherwise
+public isolated function startsWith(string str, string substr) returns boolean = external;
+
+# Tests whether a string ends with another string.
+#
+# + str - the string to be tested
+# + substr - the ending string
+# + return - true if `str` ends with `substr`; false otherwise
+public isolated function endsWith(string str, string substr) returns boolean = external;
+
+
+# Converts occurrences of A-Z to a-z.
+# Other characters are left unchanged.
+#
+# + str - the string to be converted
+# + return - `str` with any occurrences of A-Z converted to a-z
+public isolated function toLowerAscii(string str) returns string = external;
+
+# Converts occurrences of a-z to A-Z.
+# Other characters are left unchanged.
+#
+# + str - the string to be converted
+# + return - `str` with any occurrences of a-z converted to A-Z
+public isolated function toUpperAscii(string str) returns string = external;
+
+
+# Tests whether two strings are the same, ignoring the case of ASCII characters.
+# A character in the range a-z is treated the same as the corresponding character in the range A-Z.
+#
+# + str1 - the first string to be compared
+# + str2 - the second string to be compared
+# + return - true if `str1` is the same as `str2`, treating upper-case and lower-case
+# ASCII letters as the same; false, otherwise
+public isolated function equalsIgnoreCaseAscii(string str1, string str2) returns boolean = external;
+
+# Removes ASCII white space characters from the start and end of a string.
+# The ASCII white space characters are 0x9...0xD, 0x20.
+#
+# + str - the string
+# + return - `str` with leading or trailing ASCII white space characters removed
+public isolated function trim(string str) returns string = external;
+
+# Represents `str` as an array of bytes using UTF-8.
+#
+# + str - the string
+# + return - UTF-8 byte array
+public isolated function toBytes(string str) returns byte[] = external;
+
+# Constructs a string from its UTF-8 representation in `bytes`.
+#
+# + bytes - UTF-8 byte array
+# + return - `bytes` converted to string or error
+public isolated function fromBytes(byte[] bytes) returns string|error = external;
+
+# Converts a string to an array of code points.
+#
+# + str - the string
+# + return - an array with a code point for each character of `str`
+public isolated function toCodePointInts(string str) returns int[] = external;
+
+# Converts a single character string to a code point.
+#
+# + ch - a single character string
+# + return - the code point of `ch`
+public isolated function toCodePointInt(Char ch) returns int = external;
+
+# Constructs a string from an array of code points.
+# An int is a valid code point if it is in the range 0 to 0x10FFFF inclusive,
+# but not in the range 0xD800 or 0xDFFF inclusive.
+#
+# + codePoints - an array of ints, each specifying a code point
+# + return - a string with a character for each code point in `codePoints`; or an error
+# if any member of `codePoints` is not a valid code point
+public isolated function fromCodePointInts(int[] codePoints) returns string|error = external;
+
+# Constructs a single character string from a code point.
+# An int is a valid code point if it is in the range 0 to 0x10FFFF inclusive,
+# but not in the range 0xD800 or 0xDFFF inclusive.
+#
+# + codePoint - an int specifying a code point
+# + return - a single character string whose code point is `codePoint`; or an error
+# if `codePoint` is not a valid code point
+public isolated function fromCodePointInt(int codePoint) returns Char|error = external;
+
+# Adds padding to the start of a string.
+# Adds sufficient `padChar` characters at the start of `str` to make its length be `len`.
+# If the length of `str` is >= `len`, returns `str`.
+# 
+# + str - the string to pad
+# + len - the length of the string to be returned
+# + padChar - the character to use for padding `str`; defaults to a space character
+# + return - `str` padded with `padChar` 
+public isolated function padStart(string str, int len, Char padChar = " ") returns string = external;
+
+# Adds padding to the end of a string.
+# Adds sufficient `padChar` characters to the end of `str` to make its length be `len`.
+# If the length of `str` is >= `len`, returns `str`.
+# 
+# + str - the string to pad
+# + len - the length of the string to be returned
+# + padChar - the character to use for padding `str`; defaults to a space character
+# + return - `str` padded with `padChar` 
+public isolated function padEnd(string str, int len, Char padChar = " ") returns string = external;
+
+# Pads a string with zeros.
+# The zeros are added at the start of the string, after a `+` or `-` sign if there is one.
+# Sufficient zero characters are added to `str` to make its length be `len`.
+# If the length of `str` is >= `len`, returns `str`.
+# 
+# + str - the string to pad
+# + len - the length of the string to be returned
+# + zeroChar - the character to use for the zero; defaults to ASCII zero `0`
+# + return - `str` padded with zeros 
+public isolated function padZero(string str, int len, Char zeroChar = "0") returns string = external;
+
+# Refers to the `RegExp` type defined by lang.regexp module.
+public type RegExp regexp:RegExp;
+
+# Tests whether there is a full match of a regular expression with a string.
+# A match of a regular expression in a string is a full match if it
+# starts at index 0 and ends at index `n`, where `n` is the length of the string.
+# This is equivalent to `regex:isFullMatch(re, str)`.
+#
+# + str - the string
+# + re - the regular expression
+# + return - true if there is full match of `re` with `str`, and false otherwise
+public isolated function matches(string str, RegExp re) returns boolean = external;
+
+# Tests whether there is a match of a regular expression somewhere within a string.
+# This is equivalent to `regexp:find(re, str, startIndex) != ()`.
+# 
+# + str - the string to be matched
+# + re - the regular expression
+# + return - true if the is a match of `re` somewhere within `str`, otherwise false
+public isolated function includesMatch(string str, RegExp re, int startIndex = 0) returns boolean = external;
+]]>
+ +
+ +
+

lang.table module

+ +

The lang.table module corresponds to basic type table.

+ +
`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type MapType map;
+
+# A type parameter that is a subtype of `map`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type MapType1 map;
+
+# A type parameter that is a subtype of `anydata`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type KeyType anydata;
+
+# Returns number of members of a table.
+#
+# + t - the table
+# + return - number of members in `t`
+public isolated function length(table> t) returns int = external;
+
+# Returns an iterator over a table.
+# The iterator will iterate over the members of the table not the keys.
+# The `entries` function can be used to iterate over the keys and members together.
+# The `keys` function can be used to iterator over just the keys.
+# 
+# + t - the table
+# + return - a new iterator object that will iterate over the members of `t`
+public isolated function iterator(table t) returns object {
+    public isolated function next() returns record {|
+        MapType value;
+    |}?;
+} = external;
+
+# Returns the member of table `t` with key `k`.
+# This for use in a case where it is known that the table has a specific key,
+# and accordingly panics if `t` does not have a member with key `k`.
+#
+# + t - the table
+# + k - the key
+# + return - member with key `k`
+public isolated function get(table key t, KeyType k) returns MapType = external;
+
+# Adds a member `val` to table `t`, replacing any member with the same key value.
+# If `val` replaces an existing member, it will have the same position
+# in the order of the members as the existing member;
+# otherwise, it will be added as the last member.
+# It panics if `val` is inconsistent with the inherent type of `t`.
+public isolated function put(table t, MapType val) = external;
+
+# Adds a member `val` to table `t`.
+# It will be added as the last member.
+# It panics if `val` has the same key as an existing member of `t`,
+# or if `val` is inconsistent with the inherent type of `t`.
+public isolated function add(table t, MapType val) = external;
+
+
+# Applies a function each member of a table and returns a table of the result.
+#
+# + t - the table
+# + func - a function to apply to each member
+# + return - new table containing result of applying function `func` to each member
+public isolated function map(table t, @isolatedParam function(MapType val) returns MapType1 func)
+   returns table key = external;
+
+# Applies a function to each member of a table.
+# The function `func` is applied to each member of `t`.
+#
+# + t - the table
+# + func - a function to apply to each member
+public isolated function forEach(table t, @isolatedParam function(MapType val) returns () func) returns () = external;
+
+# Selects the members from a table for which a function returns true.
+# The resulting table will have the same keys as the argument table.
+#
+# + t - the table
+# + func - a predicate to apply to each member to test whether it should be included
+# + return - new table containing members for which `func` evaluates to true
+public isolated function filter(table key t, @isolatedParam function(MapType val) returns boolean func)
+   returns table key = external;
+
+# Combines the members of a table using a combining function.
+# The combining function takes the combined value so far and a member of the table,
+# and returns a new combined value.
+#
+# + t - the table
+# + func - combining function
+# + initial - initial value for the first argument of combining function `func`
+# + return - result of combining the members of `t` using `func`
+public isolated function reduce(table t, @isolatedParam function(Type accum, MapType val) returns Type func, Type initial) returns Type = external;
+
+# Removes a member of a table.
+#
+# + t - the table
+# + k - the key
+# + return - the member of `t` that had key `k`
+# This removed the member of `t` with key `k` and returns it.
+# It panics if there is no such member.
+public isolated function remove(table key t, KeyType k) returns MapType = external;
+
+# Removes a member of a table with a given key, if the table has member with the key.
+#
+# + t - the table
+# + k - the key
+# + return - the member of `t` that had key `k`, or `()` if `t` does not have a key `k`
+# If `t` has a member with key `k`, it removes and returns it;
+# otherwise it returns `()`.
+public isolated function removeIfHasKey(table key t, KeyType k) returns MapType? = external;
+
+# Removes all members of a table.
+# This panics if any member cannot be removed.
+#
+# + t - the table
+public isolated function removeAll(table> t) returns () = external;
+
+# Tests whether `t` has a member with key `k`.
+#
+# + t - the table
+# + k - the key
+# + return - true if `t` has a member with key `k`
+public isolated function hasKey(table key t, KeyType k) returns boolean = external;
+
+# Returns a list of all the keys of table `t`.
+#
+# + t - the table
+# + return - a new list of all keys
+public isolated function keys(table> key t) returns KeyType[] = external;
+
+# Returns a list of all the members of a table.
+#
+# + t - the table
+# + return - an array whose members are the members of `t`
+public isolated function toArray(table t) returns MapType[] = external;
+
+# Returns the next available integer key.
+# + t - the table with a key of type int
+# + return - an integer not yet used as a key
+# This is maximum used key value + 1, or 0 if no key used
+# XXX should it be 0, if the maximum used key value is < 0?
+# Provides similar functionality to auto-increment
+public isolated function nextKey(table> key t) returns int = external;
+]]>
+ +
+ +
+

lang.typedesc module

+ +

The lang.typedesc module corresponds to basic type typedesc.

+ +
+ +
+ +
+

lang.xml module

+ +

The lang.xml module corresponds to basic type xml.

+ +
 x) returns object {
+    public isolated function next() returns record {| ItemType value; |}?;
+} = external;
+
+# Returns the item of `x` with index `i`.
+# This differs from `x[i]` in that it panics if
+# `x` does not have an item with index `i`.
+#
+# + x - the xml sequence 
+# + i - the index
+# + return - the item with index `i` in `x`
+public isolated function get(xml x, int i) returns ItemType = external;
+
+# Concatenates xml and string values.
+#
+# + xs - xml or string items to concatenate
+# + return - an xml sequence that is the concatenation of all the `xs`;
+#    an empty xml sequence if the `xs` are empty
+public isolated function concat((xml|string)... xs) returns xml = external;
+
+# Returns a string giving the expanded name of `elem`.
+#
+# + elem - xml element
+# + return - element name
+public isolated function getName(Element elem) returns string = external;
+
+# Change the name of element `elem` to `xName`.
+#
+# + elem - xml element
+# + xName - new expanded name
+public isolated function setName(Element elem, string xName) = external;
+
+# Returns the map representing the attributes of `elem`.
+# This includes namespace attributes.
+# The keys in the map are the expanded names of the attributes.
+#
+# + x - xml element
+# + return - attributes of `x`
+public isolated function getAttributes(Element x) returns map = external;
+
+# Returns the children of `elem`.
+#
+# + elem - xml element
+# + return - children of `elem`
+public isolated function getChildren(Element elem) returns xml = external;
+
+# Sets the children of `elem` to `children`.
+# This panics if it would result in the element structure
+# becoming cyclic.
+#
+# + elem - xml element
+# + children - xml or string to set as children
+public isolated function setChildren(Element elem, xml|string children) = external;
+
+# Returns the descendants of `elem`.
+#
+# + elem - xml element
+# + return - descendants of `elem`
+# The descendants of an element are the children of the element
+# together with, for each of those children that is an element,
+# the descendants of that element, ordered so that
+# each element immediately precedes all its descendants.
+# The order of the items in the returned sequence will thus correspond
+# to the order in which the first character of the representation
+# of the item would occur in the representation of the element in XML syntax.
+public isolated function getDescendants(Element elem) returns xml = external;
+
+# Returns a string with the character data of an xml value.
+# + x - the xml value
+# + return - a string consisting of all the character data of `x`
+# The character data of an xml value is as follows:
+# * the character data of a text item is a string with one character for each
+#     character information item represented by the text item;
+# * the character data of an element item is the character data of its children;
+# * the character data of a comment item is the empty string;
+# * the character data of a processing instruction item is the empty string;
+# * the character data of an empty xml sequence is the empty string;
+# * the character data of the concatenation of two xml sequences x1 and x2 is the
+#    concatenation of the character data of x1 and the character data of x2.
+public isolated function data(xml x) returns string = external;
+
+# Returns the target part of the processing instruction.
+#
+# + x - xml processing instruction item
+# + return - target part of `x`
+public isolated function getTarget(ProcessingInstruction x) returns string = external;
+
+# Returns the content of a processing instruction or comment item.
+#
+# + x - xml item
+# + return - the content of `x`
+public isolated function getContent(ProcessingInstruction|Comment x) returns string = external;
+
+# Creates a new xml element item.
+#
+# + name - the name of the new element
+# + attributes - the attributes of the new element
+# + children - the children of the new element
+# + return - an xml sequence consisting of only a new xml element with name `name`,
+#   attributes `attributes`, and children `children`
+# The element's attribute map is a newly created map, into which any attributes specified
+# by the `attributes` map are copied.
+public isolated function createElement(string name, map attributes = {}, xml children = xml``)
+    returns Element = external;
+
+# Creates a new xml processing instruction item.
+#
+# + target - the target part of the processing instruction to be constructed
+# + content - the content part of the processing instruction to be constructed
+# + return - an xml sequence consisting of a processing instruction with target `target`
+#     and content `content`
+public isolated function createProcessingInstruction(string target, string content)
+    returns ProcessingInstruction = external;
+
+# Creates a new xml comment item.
+#
+# + content - the content of the comment to be constructed.
+# + return - an xml sequence consisting of a comment with content `content`
+public isolated function createComment(string content) returns Comment = external;
+
+# Constructs an xml value of type Text.
+# + data - the character data of the Text item
+# + return - an xml sequence that is either empty or consists of one text item
+# The returned xml value will be empty when the length of `data` is zero.
+public isolated function createText(string data) returns Text = external;
+
+# Returns a subsequence of an xml value.
+#
+# + x - the xml value
+# + startIndex - start index, inclusive
+# + endIndex - end index, exclusive
+# + return - a subsequence of `x` consisting of items with index >= startIndex and < endIndex
+public isolated function slice(xml x, int startIndex, int endIndex = x.length())
+    returns xml = external;
+
+# Strips the insignificant parts of the an xml value.
+# This first transforms the xml value by leaving out any constituent
+# item that is a comment or processing instruction. It then
+# transforms this value by leaving out any constituent item that
+# is a text item that consists entirely of whitespace, where whitespace
+# is as defined by the S production of XML 1.0.
+#
+# + x - the xml value
+# + return - `x` transformed by leaving out insignificant items
+public isolated function strip(xml x) returns xml = external;
+
+# Selects elements from an xml value.
+# If `nm` is `()`, selects all elements;
+# otherwise, selects only elements whose expanded name is `nm`.
+# 
+# + x - the xml value
+# + nm - the expanded name of the elements to be selected, or `()` for all elements
+# + return - an xml sequence consisting of all the element items in `x` whose expanded name is `nm`,
+#  or, if `nm` is `()`, all element items in `x`
+public isolated function elements(xml x, string? nm = ()) returns xml = external;
+
+# Returns the children of elements in an xml value.
+# When `x` is of type Element, it is equivalent to `getChildren`.
+# + x - xml value
+# + return - xml sequence containing the children of each element x concatenated in order
+# This is equivalent to `elements(x).map(getChildren)`.
+public isolated function children(xml x) returns xml = external;
+
+# Selects element children of an xml value
+# + x - the xml value
+# + nm - the expanded name of the elements to be selected, or `()` for all elements
+# + return - an xml sequence consisting of child elements of elements in `x`; if `nm`
+#  is `()`, returns a sequence of all such elements;
+#  otherwise, include only elements whose expanded name is `nm`
+# This is equivalent to `children(x).elements(nm)`.
+public isolated function elementChildren(xml x, string? nm = ()) returns xml = external;
+
+# Selects text items from an xml value.
+# + x - the xml value
+# return - an xml sequence consisting of the concatentation of the text items in `x`
+public isolated function text(xml x) returns Text = external;
+
+
+# Applies a function to each item in an xml sequence, and returns an xml sequence of the results.
+# Each item is represented as a singleton value.
+#
+# + x - the xml value
+# + func - a function to apply to each child or `item`
+# + return - new xml value containing result of applying function `func` to each child or `item`
+public isolated function map(xml x, @isolatedParam function(ItemType item) returns XmlType func)
+    returns xml = external;
+
+# Applies a function to each item in an xml sequence.
+# Each item is represented as a singleton value.
+#
+# + x - the xml value
+# + func - a function to apply to each item in `x`
+public isolated function forEach(xml x, @isolatedParam function(ItemType item) returns () func)
+    = external;
+
+# Selects the items from an xml sequence for which a function returns true.
+# Each item is represented as a singleton value.
+#
+# + x - xml value
+# + func - a predicate to apply to each item to test whether it should be selected
+# + return - new xml sequence containing items in `x` for which `func` evaluates to true
+public isolated function filter(xml x, @isolatedParam function(ItemType item) returns boolean func)
+    returns xml = external;
+
+# Constructs an xml value from a string.
+# This parses the string using the `content` production of the
+# XML 1.0 Recommendation.
+#
+# + s - a string in XML format
+# + return - xml value resulting from parsing `s`, or an error
+public isolated function fromString(string s) returns xml|error = external;
+]]>
+ +
+ +
+

lang.transaction module

+ +

The lang.transaction module supports transactions.

+ +
+ +
+ +
+

lang.runtime module

+ +

The lang.runtime module provides functions related to the +language runtime that are not specific to a particular basic type.

+ +
+ +
+ +
+

lang.value module

+ +

The lang.value module provides functions that work on values of +more than one basic type..

+ +
|table>;
+
+# A type parameter that is a subtype of `Cloneable`.
+# Has the special semantic that when used in a declaration
+# all uses in the declaration must refer to same type.
+@typeParam
+type CloneableType Cloneable;
+
+# Returns a clone of `v`.
+# A clone is a deep copy that does not copy immutable subtrees.
+# A clone can therefore safely be used concurrently with the original.
+# It corresponds to the Clone(v) abstract operation,
+# defined in the Ballerina Language Specification.
+#
+# + v - source value
+# + return - clone of `v`
+public isolated function clone(CloneableType v) returns CloneableType = external;
+
+# Returns a clone of `v` that is read-only, i.e. immutable.
+# It corresponds to the ImmutableClone(v) abstract operation,
+# defined in the Ballerina Language Specification.
+#
+# + v - source value
+# + return - immutable clone of `v`
+public isolated function cloneReadOnly(CloneableType v) returns CloneableType & readonly = external;
+
+# Constructs a value with a specified type by cloning another value.
+# + v - the value to be cloned
+# + t - the type for the cloned to be constructed
+# + return - a new value that belongs to type `t`, or an error if this cannot be done
+# 
+# When `v` is a structural value, the inherent type of the value to be constructed
+# comes from `t`. When `t` is a union that includes more than one type descriptor
+# that can be used as the inherent type of values with `v`'s basic type, then
+# the inherent type used will be the first (leftmost) such type descriptor such that a value
+# belonging to that type can be constructed from `v`.
+# The `cloneWithType` operation is recursively applied to each member of `v` using
+# the type descriptor that the inherent type requires for that member.
+# 
+# Like the Clone abstract operation, this does a deep copy, but differs in
+# the following respects:
+# - the inherent type of any structural values constructed comes from the specified
+#   type descriptor rather than the value being constructed
+# - the read-only bit of values and fields comes from the specified type descriptor
+# - the graph structure of `v` is not preserved; the result will always be a tree;
+#   an error will be returned if `v` has cycles
+# - immutable structural values are copied rather than being returned as is
+# - numeric values can be converted using the NumericConvert abstract operation
+# - if a record type descriptor specifies default values, these will be used
+#   to supply any missing members
+public isolated function cloneWithType(anydata v, typedesc t = <>) returns t|error = external;
+
+# Safely casts a value to a type.
+# This casts a value to a type in the same way as a type cast expression,
+# but returns an error if the cast cannot be done, rather than panicking.
+# + v - the value to be cast
+# + t - a typedesc for the type to which to cast it
+# return - `v` cast to the type described by `t`, or an error, if the cast cannot be done
+public isolated function ensureType(any|error v, typedesc t = <>) returns t|error = external;
+
+# Performs a direct conversion of a value to a string.
+# The conversion is direct in the sense that when applied to a value that is already
+# a string it leaves the value unchanged.
+#
+# + v - the value to be converted to a string
+# + return - a string resulting from the conversion
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the direct style.
+public isolated function toString(any v) returns string = external;
+
+# Converts a value to a string that describes the value in Ballerina syntax.
+# + v - the value to be converted to a string
+# + return - a string resulting from the conversion
+#
+# If `v` is anydata and does not have cycles, then the result will
+# conform to the grammar for a Ballerina expression and when evaluated
+# will result in a value that is == to v.
+#
+# The details of the conversion are specified by the ToString abstract operation
+# defined in the Ballerina Language Specification, using the expression style.
+public isolated function toBalString(any v) returns string = external;
+
+# Parses and evaluates a subset of Ballerina expression syntax.
+# + s - the string to be parsed and evaluated
+# return - the result of evaluating the parsed expression, or
+# an error if the string cannot be parsed
+# The subset of Ballerina expression syntax supported is that produced
+# by toBalString when applied to an anydata value.
+public isolated function fromBalString(string s) returns anydata|error = external;
+
+
+# Converts a value of type `anydata` to `json`.
+# This does a deep copy of `v` converting values that do
+# not belong to json into values that do.
+# A value of type `xml` is converted into a string as if
+# by the `toString` function.
+# A value of type `table` is converted into a list of
+# mappings one for each row.
+# The inherent type of arrays in the return value will be
+# `json[]` and of mappings will be `map`.
+# A new copy is made of all structural values, including
+# immutable values.
+#
+# + v - anydata value
+# + return - representation of `v` as value of type json
+# This panics if `v` has cycles.
+public isolated function toJson(anydata v) returns json = external;
+
+# Returns the string that represents `v` in JSON format.
+# `v` is first converted to `json` as if by the `toJson` function.
+#
+# + v - anydata value
+# + return - string representation of `v` converted to `json`
+public isolated function toJsonString(anydata v) returns string = external;
+
+# Parses a string in JSON format and returns the value that it represents.
+# Numbers in the JSON string are converted into Ballerina values of type
+# decimal except in the following two cases:
+# if the JSON number starts with `-` and is numerically equal to zero, then it is
+# converted into float value of `-0.0`;
+# otherwise, if the JSON number is syntactically an integer and is in the range representable
+# by a Ballerina int, then it is converted into a Ballerina int.
+# A JSON number is considered syntactically an integer if it contains neither
+# a decimal point nor an exponent.
+# 
+# Returns an error if the string cannot be parsed.
+#
+# + str - string in JSON format
+# + return - `str` parsed to json or error
+public isolated function fromJsonString(string str) returns json|error = external;
+
+# Subtype of `json` that allows only float numbers.
+public type JsonFloat ()|boolean|string|float|JsonFloat[]|map;
+
+# Parses a string in JSON format, using float to represent numbers.
+# Returns an error if the string cannot be parsed.
+#
+# + str - string in JSON format
+# + return - `str` parsed to json or error
+public isolated function fromJsonFloatString(string str) returns JsonFloat|error = external;
+
+# Subtype of `json` that allows only decimal numbers.
+public type JsonDecimal ()|boolean|string|decimal|JsonDecimal[]|map;
+
+# Parses a string in JSON format, using decimal to represent numbers.
+# Returns an error if the string cannot be parsed.
+#
+# + str - string in JSON format
+# + return - `str` parsed to json or error
+public isolated function fromJsonDecimalString(string str) returns JsonDecimal|error = external;
+
+# Converts a value of type json to a user-specified type.
+# This works the same as `cloneWithType`,
+# except that it also does the inverse of the conversions done by `toJson`.
+#
+# + v - json value
+# + t - type to convert to
+# + return - value belonging to type `t` or error if this cannot be done
+public isolated function fromJsonWithType(json v, typedesc t = <>)
+    returns t|error = external;
+
+# Converts a string in JSON format to a user-specified type.
+# This is a combination of `fromJsonString` followed by
+# `fromJsonWithType`.
+# + str - string in JSON format
+# + t - type to convert to
+# + return - value belonging to type `t` or error if this cannot be done
+public isolated function fromJsonStringWithType(string str, typedesc t = <>)
+    returns t|error = external;
+    
+# Merges two json values.
+#
+# + j1 - json value
+# + j2 - json value
+# + return - the merge of `j1` with `j2` or an error if the merge fails
+#
+# The merge of `j1` with `j2` is defined as follows:
+# - if `j1` is `()`, then the result is `j2`
+# - if `j2` is `()`, then the result is `j1`
+# - if `j1` is a mapping and `j2` is a mapping, then for each entry [k, j] in j2,
+#   set `j1[k]` to the merge of `j1[k]` with `j`
+#     - if `j1[k]` is undefined, then set `j1[k]` to `j`
+#     - if any merge fails, then the merge of `j1` with `j2` fails
+#     - otherwise, the result is `j1`.
+# - otherwise, the merge fails
+# If the merge fails, then `j1` is unchanged.
+public isolated function mergeJson(json j1, json j2) returns json|error = external;
+
+# Returns the number of arguments.
+# This is useful with aggregated variables created by `collect` and `group by` clauses.
+#
+# + vs - the arguments
+# + return - the number of arguments
+public isolated function count(any|error... vs) returns int = external;
+
+# Returns the first of its arguments.
+# This is useful with aggregated variables created by `collect` and `group by` clauses.
+#
+# + v - first argument
+# + vs - other arguments
+# + return - the first argument v
+public isolated function first(Type v, any|error... vs) returns Type = external;
+
+# Returns the last of its arguments.
+# This is useful with aggregated variables created by `collect` and `group by` clauses.
+#
+# + v - first argument
+# + vs - other arguments
+# + return - the last argument
+public isolated function last(Type v, Type... vs) returns Type = external;
+]]>
+ +
+ +
+ +
+
+

A. References

+
    +
  • Unicode
  • +
  • XML
  • +
  • JSON
  • +
  • ECMAScript 2022 (ECMA-262 13th Edition)
  • +
  • RFC 3629 UTF-8
  • +
  • IEEE 754-2008
  • +
  • GitHub Markdown
  • +
+
+
+

B. Changes since previous releases

+
+

Summary of changes from 2023R1 to 2024R1

+
    +
  1. Isolated inference can infer isolated for an object constructor expression.
  2. +
  3. A query-select-expr can construct a stream without explicitly specifying +the stream keyword.
  4. +
  5. It is no longer allowed for a lock statement to contain a sync-send-action or a receive-action.
  6. +
  7. A retry or transaction statement may now have an on fail +clause.
  8. +
  9. A named worker declaration may now have an on fail clause.
  10. +
  11. The compile-time requirement that a send-action must always be executed +unless its containing worker terminates with an error or panic has been +removed.
  12. +
  13. An alternate-receive-action has been added.
  14. +
+
+
+

Summary of changes from 2022R4 to 2023R1

+
    +
  1. Query expressions now support grouping and aggregation, using new +group by and collect clauses.
  2. +
  3. Keywords that start clauses of a query expression, except for +from and let, are no longer reserved (and so can be +used as identifier names).
  4. +
  5. Functions useful for aggregation have been added to langlib: +int:avg, float:avg, decimal:avg, +boolean:some, boolean:every, value:count, +value:first, value:last.
  6. +
  7. A join clause in a query expression can contain remote method +calls and other actions.
  8. +
  9. Clarify that the self variable in a method is implicitly +final.
  10. +
  11. Regexp type has a filler value.
  12. +
  13. Readonly record types can have defaults.
  14. +
+
+ +
+

Summary of changes from 2022R3 to 2022R4

+
    +
  1. Regular expressions have been added as a new data type. This +feature has preview status in this release.
  2. +
  3. When an optional field cannot have the value nil, the field +can be manipulated conveniently by treating nil as representing the +absence of the field: this works for constructors, binding patterns +and assignment.
  4. +
  5. A byte-array-literal can construct a read-only value.
  6. +
  7. An optional semi-colon is now allowed after top-level definitions and +method definitions that are currentlty terminated by }.
  8. +
  9. An int:range langlib function allows convenient iteration +over integer sequences with steps other than 1.
  10. +
+
+
+

Summary of changes from 2022R2 to 2022R3

+
    +
  1. Client objects can declare resource methods, which can be accessed using new +client-resource-access-action syntax. Resource methods are now part +of the type of network interaction objects and can be specified in object type +descriptors.
  2. +
  3. The isolated feature can now be used to identify cases where +a strand created by start or a named worker can be run safely on +a separate thread.
  4. +
  5. The variable declaration in an on fail clause is now +optional.
  6. +
  7. Query expressions producing xml values will now work properly when used as +interpolated expressions in XML templates.
  8. +
  9. Query expressions may be used to construct maps.
  10. +
  11. Query expressions can now construct readonly values.
  12. +
  13. Annotations are now allowed on members of tuple type descriptors.
  14. +
  15. The call function has been added to lang.function +to allow for dynamically calling a function.
  16. +
  17. An onGracefulStop function has been added to +lang.runtime.
  18. +
  19. The grammar now allows an action such as a remote method call to occur +inside a query.
  20. +
  21. A check expression is now allowed as a statement, provided that +its type is nil.
  22. +
+
+ +
+

Summary of changes from 2022R1 to 2022R2

+
    +
  1. The *, / and % operators now allow +operands to mix numeric types in specific cases: * allows the case +where either operand is an int; / and * +allow the case where the right operand is an int.
  2. +
  3. It is no longer an error for a panic-stmt to be +unreachable.
  4. +
  5. The toExpString and toFixedString +functions have been added to lang.float.
  6. +
  7. The padStart, padEnd, padZero +functions have been added to lang.string.
  8. +
  9. The quantize function has been added to +lang.decimal.
  10. +
  11. The some and every functions have been added to +lang.array.
  12. +
  13. The round function in lang.float and +lang.decimal now takes an optional argument controlling the number +of digits after the decimal point.
  14. +
  15. The length of an array type is allowed to be * only when it is +the outermost array and there is an initializer from which it can be +inferred.
  16. +
  17. A list constructor can use ...E as in an argument list.
  18. +
+
+
+

Summary of changes from 2021R1 to 2022R1

+
    +
  1. Maps are required to preserve insertion order.
  2. +
  3. The static typing rules for == and != have been +relaxed to require only one operand to be anydata.
  4. +
  5. The identifiers of organizations and modules refererenced in import +declarations are restricted to ASCII alpha-numberic characters with underscores +separating words.
  6. +
  7. Floating pointer literals are not allowed to end with a trailing dot.
  8. +
  9. No white space is allowed within a qualified name.
  10. +
  11. Add the !is operator.
  12. +
  13. Allow null as a type descriptor.
  14. +
  15. An object type is not allowed to include a class with private members.
  16. +
  17. Conditional variable type narrowing from the condition of a while statement +is applied to the body of a while statement.
  18. +
  19. Conditional variable type narrowing is now done for a where clause in a +query expression or action.
  20. +
  21. A function call is only allowed with an expression in a match-guard when +there is no possibility that it can mutate the value being matched.
  22. +
  23. The interpretation of multiple dimensions in an array-type-descriptor has +been changed to make the order of dimensions in the type-descriptor consistent +with the order of dimensions in an expression that accesses the array.
  24. +
  25. The static type of an expression now has singleton type when all its +subexpressions have singleton type.
  26. +
  27. Unreachable statements are now an error.
  28. +
  29. Conditional variable type narrowing is now smarter. In particular, the types +of variables can be narrowed in statements following an if +statement that contains return.
  30. +
  31. Variable type narrowing in a match statement has been improved to work +better for types that are partially readonly.
  32. +
  33. Many expressions now perform nil lifting.
  34. +
  35. The rules for determining the basic type of a numeric literal have been +revised to work better in the case where the contextually expected type allows +two of the three possible numeric basic types.
  36. +
  37. Restrictions have been introduced on assigning within a loop to a variable +whose type has been narrowed outside the loop.
  38. +
  39. Optional fields can be accessed using the . operator as well as +the ?. operator, when the type of the accessed field does not allow +nil.
  40. +
+
+
+

Summary of changes from 2020R1 to 2021R1

+
    +
  1. There has been a major change to how objects works. All object type +descriptors are what was previously called abstract: they declare +methods but do not define them. Objects are now created either by using an +object constructor expression, which includes method definitions, or by applying +new to the name of a class defined by a class definition. The +methods and fields of an object are in a single symbol space. Classes and +object constructors can declare fields as final.
  2. +
  3. Services have become service objects that work in a similar way to client +objects; resource methods on service objects have become remote methods. Remote +methods are in a separate symbol space from regular methods. There is a new +concept for resource methods.
  4. +
  5. The readonly type has been added. Fields of records can also be +declared as readonly.
  6. +
  7. Functions, objects and module-level variables can be declared as +isolated; this works in conjunction with readonly to +support concurrency safety.
  8. +
  9. Module-level variables can be public, provided they are not isolated.
  10. +
  11. Intersection types have been added.
  12. +
  13. Distinct types have been added; these provide the functionality of nominal +types with the framework of a structural type system.
  14. +
  15. The error type has been revised to take advantage of distinct types. Instead +an error value having a reason string for categorizing the error and separate +message string in the detail record, an error value has a message string in the +error and distinct types are used for categorizing. The cause has also moved +from the detail record into the error value.
  16. +
  17. The syntax for an error constructor that uses a user-defined type name now +includes the error keyword before the type name.
  18. +
  19. Language-defined abstract object types now make use of distinct types, +instead of using names prefixed with double underscore.
  20. +
  21. The __init method of object and the __init function +of modules have been renamed to init.
  22. +
  23. Module variables can be initialized in the module's init +function.
  24. +
  25. The table type has been redesigned to be more consistent with other +structural types and no longer has preview status.
  26. +
  27. Enum declarations have been added.
  28. +
  29. The return type of a function with an external body can depend on the value +of a parameter of typedesc type, which can be defaulted from the contextually +expected type.
  30. +
  31. Query expressions support some new clauses: join clause, +order by clause, limit clause and on +conflict clause.
  32. +
  33. The relational operators (< <= > >=) have been +extended to apply to more than just numeric types.
  34. +
  35. Raw template expressions have been added.
  36. +
  37. The ability to specify the visibility of parameter names has been removed: a +parameter can always be specified by name as well as position; a parameter +cannot be declared as public.
  38. +
  39. Local type definitions have been removed.
  40. +
  41. The fail statement has been added, along with a on +fail clause for compound statements. If a check expression +or action fails, it behaves like a fail statement rather than a +return statement.
  42. +
  43. The language has a concept of configurability: module level variables can be +specified to be configurable, which allows their initial values to +be specified at runtime.
  44. +
  45. An import declaration can no longer specify a version.
  46. +
  47. The stream type no longer has Preview status.
  48. +
  49. Module prefixes for the langlib modules that correspond to keywords are +predeclared.
  50. +
  51. Backslash escapes can be used in identifiers without needing an initial +single quote.
  52. +
  53. Language support for transactions has been added.
  54. +
  55. The error<*> feature has been removed, because it does +not work well with distinct error types.
  56. +
  57. In message passing between workers, the function's default worker is now +referenced using the function keyword rather than the +default keyword.
  58. +
  59. Make trap expression have lower precedence.
  60. +
+
+
+

Summary of changes from 2019R3 to 2020R1

+
    +
  1. Query expressions and query actions have been added. This is the first stage +of language-integrated query.
  2. +
  3. The stream basic type has been added.
  4. +
  5. Let expressions have been added.
  6. +
  7. The XML design has been refined and no longer has Preview status. +
      +
    • The various kinds of xml item (e.g. element and text) are subtypes of the +xml type.
    • +
    • The xml type can have a type parameter specifying the item +types.
    • +
    • Iteration over xml values exposes characters as text items rather than strings
    • +
    • Adjacent characters in XML content are chunked into a single text item.
    • +
    • The meaning of === for xml has changed.
    • +
    • The item of an xml sequence value x with index i can be accessed using an +expression x[i].
    • +
    • The syntax x@ for accessing the attributes of an XML element has +been removed.
    • +
    +
  8. +
  9. The lock statement has been added.
  10. +
  11. When a list constructor or mapping constructor is used without a +contextually expected type, we now infer a tuple or record type rather than an +array or map type.
  12. +
  13. The syntax for Unicode escapes in strings has changed from +\u[CodePoint] to \u{CodePoint} so as +to align with ECMAScript. Although this is an incompatible change, the previous +syntax was not implemented.
  14. +
  15. The never type has been added.
  16. +
  17. Lang library modules can now provide built-in subtypes of existing basic +types.
  18. +
  19. There is a lang.boolean lang lib module.
  20. +
+
+
+

Summary of changes from 2019R2 to 2019R3

+
    +
  1. An import declaration can use as _ to include a module in the +program without using its symbols.
  2. +
  3. The specification of experimental features has been moved to a separate +document.
  4. +
  5. A wait-action can result in an error value when applied to a future that is +not a named worker.
  6. +
+
+ +
+

Summary of changes from 2019R1 to 2019R2

+
    +
  1. The concept of a built-in method has been replaced by the concept of a lang +library. A method call on a value of non-object type is now treated as a +convenient syntax for a call to a function in a module of the lang library. The +design of the many of the existing built-in methods has been changed to fit in +with this. There are many functions in the lang library that were not previously +available as built-in methods.
  2. +
  3. A mapping value is now iterable as a sequence of its members (like list), +rather than as a sequence of key-value pairs. The entries lang library +function allows it to be iterated as a sequence of key-value pairs.
  4. +
  5. The basic type handle has been added.
  6. +
  7. The table<T> type descriptor shorthand has been brought +back.
  8. +
  9. There is now a variation on check called +checkpanic, which panics rather than returns on error.
  10. +
  11. A range-expr now returns an object belonging to the Iterable abstract object +type, rather than a list.
  12. +
  13. The decimal type now uses a simplified subset of IEEE 754-2008 decimal +floating point.
  14. +
  15. The status of XML-related features has been changed to preview.
  16. +
  17. The ability to define a method outside the object type has been +removed.
  18. +
  19. The UnfrozenClone operation has been removed.
  20. +
  21. The Freeze operation has been replaced by the ImmutableClone operation.
  22. +
  23. The semantics of field access, member access and assignment are now +fully specified.
  24. +
  25. A ?. operator has been added for access to optional fields.
  26. +
  27. A type-cast-expr can include annotations.
  28. +
  29. The error detail record must belong to type Detail defined in the lang +library.
  30. +
  31. The compile-time requirement that the inherent type of a variable-length +list must allow members to be filled-in has been removed; this is instead caught +at run-time.
  32. +
  33. Parameter names now have public or module-level visibility, which determines +when a function call can use the parameter name to specify an argument.
  34. +
  35. A type descriptor record { } is open to anydata +rather than anydata|error.
  36. +
  37. Calls using start are treated as actions, and so are not +allowed within expressions.
  38. +
  39. There is a new syntax for allowing arbitrary strings as identifiers to +replace the old delimited identifier syntax ^"s".
  40. +
+ +
+
+

Summary of changes from 0.990 to 2019R1

+

+The specification has switched to a new versioning scheme. The n-th +version of the specification released in year 20xy will be labelled +20xyRn. +

+
    +
  1. Tuples types now use square brackets, rather than parentheses, as do tuple +binding patterns and tuple match patterns. Array constructors and tuple +constructors are now unified into list constructors, which use square brackets. +Tuple types can have zero members or one member, and can use T... +syntax allow trailing members of a specified type.
  2. +
  3. The way that record type descriptors express openness has changed. Instead +of the !... syntax, there are two flavours of record type +descriptor, which use different delimiters: record {| |} allows any +mapping that has exclusively the specified fields, whereas record { +} allows any mapping that includes the specified fields; the former can +use the T... syntax, whereas the latter cannot. The +!... is no longer allowed for record binding patterns and record +match patterns.
  4. +
  5. The syntax for an array with an array length that is inferred has changed +from T[!...] to T[*].
  6. +
  7. A type descriptor of error<*> can be used to specify an +error type whose subtype is inferred.
  8. +
  9. A new expression can no longer be used to create values of structural types; +it is only allowed for objects.
  10. +
  11. Symbolic string literals 'ident have been removed (compile time +constants provide a more convenient approach).
  12. +
  13. untaint expression has been removed (this will be handled by +annotations instead).
  14. +
  15. The syntax for named arguments in a function call has reverted to +arg= from arg:, since the latter caused syntactic +ambiguities.
  16. +
  17. The syntax for error constructors specifies fields of the error detail +separately as named arguments, rather than specifying the error detail as a +single argument; the syntax for binding patterns and match patterns for error +values has also changed accordingly.
  18. +
  19. The error reason argument can be omitted from an error constructor if it +can be determined from the contextually expected type.
  20. +
  21. The syntax for annotation declarations has been revised; the places where +annotations are allowed has been revised to match the possible attachment +points.
  22. +
  23. An .@ binary operator has been added for accessing annotations +at runtime.
  24. +
  25. A unary typeof operator has been added.
  26. +
  27. The typedesc type now takes an optional type parameter.
  28. +
  29. The type parameters for future and stream are now +optional.
  30. +
  31. The syntax for a function with an external implementation has changed to use +=external in place of the curly braces.
  32. +
  33. A numeric literal can use a suffix of d or f to +indicate that it represents a value belonging to the decimal or float type +respectively.
  34. +
  35. Record type descriptors may now specify a default value for fields.
  36. +
  37. Providing a default value for a parameter no longer affects whether a function +call must supply the argument for that parameter positionally or by name. Instead +the argument for any parameter can be supplied either positionally or by name. +To avoid ambiguity, all arguments specified positionally must be specified before +arguments specified by name.
  38. +
  39. Expressions specifying the default value for function parameters are not +compile time constants, and are evaluated each time they are used to supply a +missing argument.
  40. +
  41. In the argument list of a function or method call, positional arguments are +now required to be specified before named arguments.
  42. +
  43. Types may now be defined within a block.
  44. +
+
+
+

Summary of changes from 0.980 to 0.990

+

+Structural types and values +

+
    +
  1. Concepts relating to typing of mutable structural values have been changed +in order to make type system sound.
  2. +
  3. The match statement has been redesigned.
  4. +
  5. The but expression has been removed.
  6. +
  7. The is expression for dynamic type testing has been added.
  8. +
  9. The type-cast-expr <T>E now performs unsafe type casts.The only +conversions it performs are numeric conversions.
  10. +
  11. The anydata type has been added, which is a union of simple and +structural types.
  12. +
  13. Records are now by default open to anydata|error, rather than +any.
  14. +
  15. Type parameters for built-in types (map, stream, future), which previously +defaulted to any, are now required.
  16. +
  17. The type parameter for json (e.g. json<T>) is not allowed any more.
  18. +
  19. Type for table columns are restricted to subtype of anydata|error.
  20. +
  21. There are now two flavors of equality operator: == and != for deep equality +(which is allowed only for anydata), and === and !== for exact +equality.
  22. +
  23. There is a built-in clone operation for performing a deep copy on values of +type anydata.
  24. +
  25. There is a built-in freeze operation for making structural values deeply +immutable.
  26. +
  27. Compile-time constants (which are always a subtype of anydata and frozen) +have been added.
  28. +
  29. Singleton types have been generalized: any compile-time constant can be made +into a singleton value.
  30. +
  31. Variables can be declared final, with a similar semantic to Java.
  32. +
  33. Errors are now immutable.
  34. +
  35. Module variables are not allowed to be public: only compile-time constants +can be public.
  36. +
+

+Error handling +

+
    +
  1. The any type no longer includes error.
  2. +
  3. check is now an expression.
  4. +
  5. Exceptions have been replaced by panics +
      +
    1. the throw statement has been replaced by the panic +statement
    2. +
    3. the try statement has been replaced by the trap +expression
    4. +
    +
  6. +
  7. Object constructors (which could not return errors) have been replaced by +__init methods (which can return errors).
  8. +
+

+Concurrency +

+
    +
  1. Workers in functions have been redesigned. In particular, workers now have a +return value.
  2. +
  3. The done statement has been removed.
  4. +
  5. The fork/join statement has been redesigned.
  6. +
  7. A syntactic category between expression and statement, called action, has +been added.
  8. +
  9. A synchronous message send action has been added.
  10. +
  11. A flush action has been added to flush asynchronously sent messages.
  12. +
  13. A wait action has been added to wait for a worker and get its return value.
  14. +
  15. Futures have been unified with workers. A future<T> represents a value to +be returned by a named worker.
  16. +
  17. Error handling of message send/receive has been redesigned.
  18. +
+

+Endpoints and services +

+
    +
  1. Client endpoints have been replaced by client objects, and actions on client +endpoints have been replaced by remote methods on client objects. Remote methods +are called using a remote method call action, which replaces the action +invocation statement.
  2. +
  3. Module endpoint declaration has been replaced by module listener +declaration, which uses the Listener built-in object type.
  4. +
  5. The service type has been added as a new basic type of behavioral value, +together with service constructor expressions for creating service values.
  6. +
  7. Module service definitions have been redesigned.
  8. +
+

+Miscellaneous changes +

+
    +
  1. Public/private visibility qualifiers must be repeated on an outside method +definition.
  2. +
+
+
+

Summary of changes from 0.970 to 0.980

+
    +
  1. The decimal type has been added.
  2. +
  3. There are no longer any implicit numeric conversions.
  4. +
  5. The type of a numeric literal can be inferred from the context.
  6. +
  7. The error type is now a distinct basic type.
  8. +
  9. The byte type has been added as a predefined subtype of int; blobs have been +replaced by arrays of bytes.
  10. +
  11. The syntax of string templates and xml literals has been revised and +harmonized.
  12. +
  13. The syntax of anonymous functions has been revised to provide two +alternative syntaxes: a full syntax similar to normal function definitions and a +more convenient arrow syntax for when the function body is an expression.
  14. +
  15. The cases of a match statement are required to be exhaustive.
  16. +
  17. The + operator is specified to do string and xml concatenation as well as +addition.
  18. +
  19. Bitwise operators have been added (<<, >>, +>>>, &, |, ^, +~) rather than = after the argument name.
  20. +
  21. In a function call or method call, named arguments have changed to use +:
  22. +
  23. A statement with check always handles an error by returning it, +not by throwing it.
  24. +
  25. check is allowed in compound assignment statements.
  26. +
  27. Method names are now looked up differently from field names; values of types +other than objects can now have built-in methods.
  28. +
  29. The lengthof unary expression has been removed; the length +built-in method can be used instead.
  30. +
  31. The semantics of <T>expr have been specified.
  32. +
  33. The value space for tuples and arrays is now unified, in the same way as the +value space for records and maps was unified. This means that tuples are now +mutable. Array types can now have a length.
  34. +
  35. The next keyword has been changed to continue.
  36. +
  37. The syntax and semantics of destructuring is now done in a consistent way +for the but expression, the match statement, the foreach statement, +destructuring assignment statements and variable declarations.
  38. +
  39. The implied initial value is not used as a default initializer in variable +declarations. A local variable whose declaration omits the initializer must be +initialized by an assignment before it is used. A global variable declaration +must always have an initializer. A new expression can be used with any reference +type that has an implicit initial value.
  40. +
  41. Postfix increment and decrement statements have been removed.
  42. +
  43. The ... and ..< operators have been added for +creating integer ranges; this replaces the foreach statement's special treatment +of integer ranges.
  44. +
  45. An object type can be declared to be abstract, meaning it cannot be used +with new.
  46. +
  47. By default, a record type now allows extra fields other than those +explicitly mentioned; T... requires extra fields to be of type T +and !... disallows extra fields.
  48. +
  49. In a mapping constructor, an expression can be used for the field name by +enclosing the expression in square brackets (as in ECMAScript).
  50. +
  51. Integer arithmetic operations are specified to throw an exception on +overflow.
  52. +
  53. The syntax for documentation strings has changed.
  54. +
  55. The deprecated construct has been removed (data related to deprecation will +be provided by an annotation; documentation related to deprecation will be part +of the documentation string).
  56. +
  57. The order of fields, methods and constructors in object types is no longer +constrained.
  58. +
  59. A function or method can be defined as extern. The +native keyword has been removed.
  60. +
+
+
+
+

C. Planned future functionality

+ +

+The vision for the Ballerina language includes a range of functionality +that is not yet included in this specification. +

+ +
    +
  • Security will combine language and platform features to make +programs secure by default.
  • +
  • Date/time basic types will provide one or more basic types related +to date and time.
  • +
  • Event stream processing will build on the stream type +to allow queries over timestamped sequences of events
  • +
  • Generic types will provide types that can be instantiated with one +or more type parameters.
  • +
  • Flexible message passing will support patterns of communication +between workers/strands, where the number of messages is not fixed and/or +workers are not peers.
  • +
  • Long-running processes will allow the execution of a program to be +automatically suspended and then later resumed upon the occurrence of particular +external events.
  • +
  • Reliable messaging will allow for sending messages across the +network with some guarantees about reliability.
  • +
+ +

+Proposals +for new language features relating to this and other functionality are +maintained in the specification's GitHub repository. +

+ +
+ +
+

D. Other contributors

+

+The following contributed to establishing the design principles of the language: +

+ +

+The following also contributed to the language in a variety of ways (in +alphabetical order): +

+ +
+ + diff --git a/public/spec/lang/2024R1/style/ballerina-language-specification.css b/public/spec/lang/2024R1/style/ballerina-language-specification.css new file mode 100644 index 000000000000..5434055dbae4 --- /dev/null +++ b/public/spec/lang/2024R1/style/ballerina-language-specification.css @@ -0,0 +1,86 @@ +body { + background: #e7eaeb; + padding:100px 50px 0px 50px; + color:#57595d; + margin: 0; + font-family: 'Roboto', sans-serif; +} +p , li { + color:#57595d; + font-weight:300; +} +pre { + display: block; + padding: 10px; + margin: 0 0 10px; + margin-bottom: 10px; + font-size: 13px; + line-height: 1.42857143; + color: #333; + word-break: break-all; + word-wrap: break-word; + background-color: #f5f5f5; + border: 1px solid #ccc; + border-radius: 4px; +} +section { + background: #fff; + padding: 40px 30px; + /* margin: 0 50px; */ + /* padding-bottom:0; + */ +} +section.appendix { + padding-bottom: 40px; +} +section.toc { + margin-top:100px; +} +section section { + padding:0; +} +h1 { + font-size: 30px; + color: #585A5E; + font-weight: 200; +} +h2 { + font-size: 24px; + text-transform: uppercase; + font-family: "CalibreWeb-Semibold", "pragmatica", sans-serif; + color: #20b6b0; + letter-spacing: 0.5px; + line-height: 30px; + padding: 0; + margin: 20px 0 15px 0; + font-weight: 600; + border-bottom: 1px solid #20b6b0; +} +a { + color: #20b6b0 !important; + text-decoration: none; +} +.toc ul li { + list-style:none; +} + +.cLogo img { + height: 37px; +} + +.cFooter { + display: inline-block; + width: 100%; + height: 100px; + margin-top: 50px; +} + +table { + width: 100%; +} + +td { + border: 1px solid #cecfd0; +} + + diff --git a/public/spec/lang/2024R1/style/ballerina-language-specification.js b/public/spec/lang/2024R1/style/ballerina-language-specification.js new file mode 100644 index 000000000000..7fe83a9b814b --- /dev/null +++ b/public/spec/lang/2024R1/style/ballerina-language-specification.js @@ -0,0 +1,22 @@ +$(document).ready(function () { + + var logo = '' ; + + + $('body').prepend(logo); + + var footer = '
' + + + '
' ; + + $('body').append(footer); + + + }); + + + + + \ No newline at end of file diff --git a/spec/spec.md b/spec/spec.md index 1f3a7e7a7af5..56dc1d5ee166 100644 --- a/spec/spec.md +++ b/spec/spec.md @@ -33,6 +33,7 @@ Below are the most stable versions of the language specification, which are in s | Version | Release Date | Description | | ------- | ------------ | ----------- | +| 2024R1 | 2024-07-18 | First release of 2024. This is the basis for Ballerina Swan Lake Update 9. | | 2023R1 | 2023-07-07 | First release of 2023. This is the basis for Ballerina Swan Lake Update 7 and upwards. | | 2022R4 | 2022-12-09 | Fourth release of 2022. This is the basis for Ballerina 2201.3.0 (Swan Lake Update 3). | | 2022R3 | 2022-08-12 | Third release of 2022. This is the basis for Ballerina 2201.2.0 (Swan Lake Update 2). | @@ -73,4 +74,3 @@ For previous draft language specifications of a Ballerina release, see the Snapshot | OAuth2 package of Ballerina language, which is used for authorization of listeners and clients (HTTP, gRPC, GraphQL, WebSocket, WebSub, etc.). | | `os` | Swan Lake | Snapshot | OS package of Ballerina language, which provides APIs to retrieve information about the operating system and its current users. | | `protobuf` | Swan Lake | Snapshot | Protobuf package of Ballerina language, which provides APIs to represent a set of pre-defined protobuf types. | -| `random` | Swan Lake | Snapshot | Random package of Ballerina language, which provides APIs to generate pseudo-random numbers. | From 470120cd2328834bee3706826d345291305c267b Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 18 Jul 2024 14:46:00 +0530 Subject: [PATCH 33/53] Update spec.md --- spec/spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec.md b/spec/spec.md index 56dc1d5ee166..7b2bebc74819 100644 --- a/spec/spec.md +++ b/spec/spec.md @@ -33,7 +33,7 @@ Below are the most stable versions of the language specification, which are in s | Version | Release Date | Description | | ------- | ------------ | ----------- | -| 2024R1 | 2024-07-18 | First release of 2024. This is the basis for Ballerina Swan Lake Update 9. | +| 2024R1 | 2024-07-18 | First release of 2024. This is the basis for Ballerina Swan Lake Update 9 and upwards. | | 2023R1 | 2023-07-07 | First release of 2023. This is the basis for Ballerina Swan Lake Update 7 and upwards. | | 2022R4 | 2022-12-09 | Fourth release of 2022. This is the basis for Ballerina 2201.3.0 (Swan Lake Update 3). | | 2022R3 | 2022-08-12 | Third release of 2022. This is the basis for Ballerina 2201.2.0 (Swan Lake Update 2). | From 2801fab64e7d7b858e41ce89f7966988371196f8 Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Fri, 19 Jul 2024 10:17:31 +0530 Subject: [PATCH 34/53] Replace HTTP links with HTTPS --- .../0.970.0/RELEASE_NOTE.html | 2 +- .../0.970.0/RELEASE_NOTE.html | 2 +- policy/cookie-policy.md | 26 +++++++++---------- policy/license-of-site.md | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/downloads/0.9.x-release-notes/0.970.0/RELEASE_NOTE.html b/downloads/0.9.x-release-notes/0.970.0/RELEASE_NOTE.html index a4b2b8a9e319..b9d63526b7da 100644 --- a/downloads/0.9.x-release-notes/0.970.0/RELEASE_NOTE.html +++ b/downloads/0.9.x-release-notes/0.970.0/RELEASE_NOTE.html @@ -678,7 +678,7 @@

Ballerina Message Broker

- Authentication and authorization extensions - In-memory mode

Ballerina Observability

-

Monitoring, tracing, and logging are three ways of observing a system. Ballerina programs have default instrumentation for metrics monitoring and distributed tracing with OpenTracing compliance. Ballerina metrics monitoring is powered by Prometheus, and it should be configured externally to scrape metrics data from the Ballerina metrics endpoint that is started with each Ballerina VM. Ballerina’s default distributed tracing is powered by Jaeger. Ballerina logs can be read and fed to any external log monitoring system like Elastic Stack to perform log monitoring and analysis.

+

Monitoring, tracing, and logging are three ways of observing a system. Ballerina programs have default instrumentation for metrics monitoring and distributed tracing with OpenTracing compliance. Ballerina metrics monitoring is powered by Prometheus, and it should be configured externally to scrape metrics data from the Ballerina metrics endpoint that is started with each Ballerina VM. Ballerina’s default distributed tracing is powered by Jaeger. Ballerina logs can be read and fed to any external log monitoring system like Elastic Stack to perform log monitoring and analysis.

Ballerina observability enables developers to understand the execution and performance impact introduced by the Ballerina program. For example, by enabling the metrics monitoring and distributed tracing, developers can identify slow services and can drill down from the services to the actual request hop that is causing the delay in the overall request flow. Similarly, by log monitoring and analysis, the additional debug information regarding any unfavorable situations can be revealed to pinpoint the root cause.

Developers can enable a Ballerina program to collect the data to observe by simply using the --observe flag (with default configurations) or passing specific Ballerina configurations when running the Ballerina program. The external systems, such as Prometheus and Jaeger, need to be used to analyze and graphically represent the collected data from a Ballerina program.

Ballerina Extensions

diff --git a/downloads/stable-release-notes/0.970.0/RELEASE_NOTE.html b/downloads/stable-release-notes/0.970.0/RELEASE_NOTE.html index a4b2b8a9e319..b9d63526b7da 100644 --- a/downloads/stable-release-notes/0.970.0/RELEASE_NOTE.html +++ b/downloads/stable-release-notes/0.970.0/RELEASE_NOTE.html @@ -678,7 +678,7 @@

Ballerina Message Broker

- Authentication and authorization extensions - In-memory mode

Ballerina Observability

-

Monitoring, tracing, and logging are three ways of observing a system. Ballerina programs have default instrumentation for metrics monitoring and distributed tracing with OpenTracing compliance. Ballerina metrics monitoring is powered by Prometheus, and it should be configured externally to scrape metrics data from the Ballerina metrics endpoint that is started with each Ballerina VM. Ballerina’s default distributed tracing is powered by Jaeger. Ballerina logs can be read and fed to any external log monitoring system like Elastic Stack to perform log monitoring and analysis.

+

Monitoring, tracing, and logging are three ways of observing a system. Ballerina programs have default instrumentation for metrics monitoring and distributed tracing with OpenTracing compliance. Ballerina metrics monitoring is powered by Prometheus, and it should be configured externally to scrape metrics data from the Ballerina metrics endpoint that is started with each Ballerina VM. Ballerina’s default distributed tracing is powered by Jaeger. Ballerina logs can be read and fed to any external log monitoring system like Elastic Stack to perform log monitoring and analysis.

Ballerina observability enables developers to understand the execution and performance impact introduced by the Ballerina program. For example, by enabling the metrics monitoring and distributed tracing, developers can identify slow services and can drill down from the services to the actual request hop that is causing the delay in the overall request flow. Similarly, by log monitoring and analysis, the additional debug information regarding any unfavorable situations can be revealed to pinpoint the root cause.

Developers can enable a Ballerina program to collect the data to observe by simply using the --observe flag (with default configurations) or passing specific Ballerina configurations when running the Ballerina program. The external systems, such as Prometheus and Jaeger, need to be used to analyze and graphically represent the collected data from a Ballerina program.

Ballerina Extensions

diff --git a/policy/cookie-policy.md b/policy/cookie-policy.md index 83a21d58ae96..198920d0c566 100644 --- a/policy/cookie-policy.md +++ b/policy/cookie-policy.md @@ -8,7 +8,7 @@ redirect_from: --- -Below is information about how https://ballerina.io/, Ballerina Central, Ballerina Playground, Ballerina Blog, and any other site to which a link to these terms may appear, use cookies. +Below is information about how https://ballerina.io/, Ballerina Central, Ballerina Blog, and any other site to which a link to these terms may appear, use cookies. The Site stores and retrieves information on your browser using cookies. This information is used to make the Site work as you expect it to. It is not personally identifiable to you, but it can be used to give you a more personalized web experience. @@ -74,7 +74,7 @@ These cookies are necessary for the website to function and cannot be switched o First party - ballerina.io + ballerina.io OptanonConsent 364 days @@ -82,7 +82,7 @@ These cookies are necessary for the website to function and cannot be switched o OptanonAlertBoxClosed - central.ballerina.io + central.ballerina.io USER_EMAIL 7.5 hours @@ -130,7 +130,7 @@ These cookies allow us to count visits and traffic sources so we can measure and First party - ballerina.io + ballerina.io _hjSessionUser_865786 364 @@ -161,20 +161,20 @@ These cookies allow us to count visits and traffic sources so we can measure and _hjIncludedInSessionSample - central.ballerina.io + central.ballerina.io route - api.central.ballerina.io + api.central.ballerina.io route - lib.ballerina.io + lib.ballerina.io route Third party - script.hotjar.com + script.hotjar.com _hjIncludedInSessionSample @@ -202,7 +202,7 @@ These cookies allow us to count visits and traffic sources so we can measure and First party - ballerina.io + ballerina.io _gat_gtag_xxxxxxxxxxxxxxxxxxxxxxxxxxx 0 @@ -211,7 +211,7 @@ These cookies allow us to count visits and traffic sources so we can measure and Third party - resources.wso2.com + resources.wso2.com pardot @@ -222,19 +222,19 @@ These cookies allow us to count visits and traffic sources so we can measure and visitor_id##### - pardot.com + pardot.com visitor_id##### visitor_id142131-hash - pi.pardot.com + pi.pardot.com pardot 0 - youtube.com + youtube.com CONSENT 729 diff --git a/policy/license-of-site.md b/policy/license-of-site.md index 07963b496a21..709738b28973 100644 --- a/policy/license-of-site.md +++ b/policy/license-of-site.md @@ -18,7 +18,7 @@ In some cases, a page may include content consisting of images, audio or video m ## Attribution -Proper attribution is required when you reuse or create modified versions of content that appears on a page made available under the terms of the Creative Commons Attribution license. The complete requirements for attribution can be found in section 4 of the Creative Commons legal code. +Proper attribution is required when you reuse or create modified versions of content that appears on a page made available under the terms of the Creative Commons Attribution license. The complete requirements for attribution can be found in section 4 of the Creative Commons legal code. In practice we ask that you provide attribution to Ballerina to the best of the ability of the medium in which you are producing the work. From 7889a7c5b989e1116ac4e5c6ac0886400c8fe804 Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Fri, 19 Jul 2024 06:46:04 +0000 Subject: [PATCH 35/53] Update ballerina standard library specifications --- public/spec/http/spec.md | 2 ++ spec/http/spec.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/public/spec/http/spec.md b/public/spec/http/spec.md index 29339bcc0cbc..33503cb35698 100644 --- a/public/spec/http/spec.md +++ b/public/spec/http/spec.md @@ -164,6 +164,8 @@ public type ListenerConfiguration record {| string? server = (); RequestLimitConfigs requestLimits = {}; int http2InitialWindowSize = 65535; + decimal minIdleTimeInStaleState = 300; + decimal timeBetweenStaleEviction = 30; |}; ``` diff --git a/spec/http/spec.md b/spec/http/spec.md index 29339bcc0cbc..33503cb35698 100644 --- a/spec/http/spec.md +++ b/spec/http/spec.md @@ -164,6 +164,8 @@ public type ListenerConfiguration record {| string? server = (); RequestLimitConfigs requestLimits = {}; int http2InitialWindowSize = 65535; + decimal minIdleTimeInStaleState = 300; + decimal timeBetweenStaleEviction = 30; |}; ``` From fa5c6e4fc4d238cdde18c07f7aa4a0e010cdd7a8 Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Mon, 22 Jul 2024 05:16:14 +0000 Subject: [PATCH 36/53] Update ballerina standard library specifications --- public/spec/websocket/spec.md | 18 ++++++++++++++++-- spec/websocket/spec.md | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/public/spec/websocket/spec.md b/public/spec/websocket/spec.md index dfeb6a7d63d0..b3381378b331 100644 --- a/public/spec/websocket/spec.md +++ b/public/spec/websocket/spec.md @@ -34,7 +34,8 @@ The conforming implementation of the specification is released and included in t * [onIdleTimeout](#onidletimeout) * [onClose](#onclose) * [onError](#onerror) - * 3.2.2. [Dispatching to custom remote methods](#322-dispatching-to-custom-remote-methods) + * 3.2.2. [Dispatching custom remote methods](#322-dispatching-custom-remote-methods) + * [Dispatching custom error remote methods](#Dispatching custom error remote methods) 4. [Client](#4-client) * 4.1. [Client Configurations](#41-client-configurations) * 4.2. [Initialization](#42-initialization) @@ -341,7 +342,7 @@ remote function onError(websocket:Caller caller, error err) { } ``` -#### 3.2.2. [Dispatching to custom remote methods](#322-dispatching-to-custom-remote-methods) +#### 3.2.2. [Dispatching custom remote methods](#322-dispatching-custom-remote-methods) The WebSocket service also supports dispatching messages to custom remote functions based on the message type(declared by a field in the received message) with the end goal of generating meaningful Async APIs. @@ -366,6 +367,19 @@ dispatching to remote function = "onHeartbeat" service / on new websocket:Listener(9090) {} ``` +##### [Dispatching custom error remote methods](#Dispatching custom error remote methods) + +If the user has defined a remote function with the name `customRemoteFunction` + `Error` in the WebSocket service, the error messages will get dispatched to that remote function when there is a data binding error. If that is not defined, the generic `onError` remote function gets dispatched. + +```ballerina +Ex: +incoming message = ` {"event": "heartbeat"}` +dispatcherKey = "event" +event/message type = "heartbeat" +dispatching remote function = "onHeartbeat" +dispatching error remote function = "onHeartbeatError" +``` + 2. Naming of the remote function. - If there are spaces and underscores between message types, those will be removed and made camel case("un subscribe" -> "onUnSubscribe"). diff --git a/spec/websocket/spec.md b/spec/websocket/spec.md index dfeb6a7d63d0..b3381378b331 100644 --- a/spec/websocket/spec.md +++ b/spec/websocket/spec.md @@ -34,7 +34,8 @@ The conforming implementation of the specification is released and included in t * [onIdleTimeout](#onidletimeout) * [onClose](#onclose) * [onError](#onerror) - * 3.2.2. [Dispatching to custom remote methods](#322-dispatching-to-custom-remote-methods) + * 3.2.2. [Dispatching custom remote methods](#322-dispatching-custom-remote-methods) + * [Dispatching custom error remote methods](#Dispatching custom error remote methods) 4. [Client](#4-client) * 4.1. [Client Configurations](#41-client-configurations) * 4.2. [Initialization](#42-initialization) @@ -341,7 +342,7 @@ remote function onError(websocket:Caller caller, error err) { } ``` -#### 3.2.2. [Dispatching to custom remote methods](#322-dispatching-to-custom-remote-methods) +#### 3.2.2. [Dispatching custom remote methods](#322-dispatching-custom-remote-methods) The WebSocket service also supports dispatching messages to custom remote functions based on the message type(declared by a field in the received message) with the end goal of generating meaningful Async APIs. @@ -366,6 +367,19 @@ dispatching to remote function = "onHeartbeat" service / on new websocket:Listener(9090) {} ``` +##### [Dispatching custom error remote methods](#Dispatching custom error remote methods) + +If the user has defined a remote function with the name `customRemoteFunction` + `Error` in the WebSocket service, the error messages will get dispatched to that remote function when there is a data binding error. If that is not defined, the generic `onError` remote function gets dispatched. + +```ballerina +Ex: +incoming message = ` {"event": "heartbeat"}` +dispatcherKey = "event" +event/message type = "heartbeat" +dispatching remote function = "onHeartbeat" +dispatching error remote function = "onHeartbeatError" +``` + 2. Naming of the remote function. - If there are spaces and underscores between message types, those will be removed and made camel case("un subscribe" -> "onUnSubscribe"). From cddaf0487c00799676161af5d92b8dea150a8038 Mon Sep 17 00:00:00 2001 From: Ashweni Miranda <91882446+ashweni@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:23:12 +0530 Subject: [PATCH 37/53] Update events.json --- _data/events.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/_data/events.json b/_data/events.json index 234eb9bbfb63..462abbbc3e0b 100644 --- a/_data/events.json +++ b/_data/events.json @@ -1,6 +1,22 @@ { "events": [ { + "date": "Sep 18, 2024", + "day": "Wed.", + "time": "5:10 p.m. GMT-3", + "expire": "2024-09-18T20:00:00.0000-00:00", + "location": "São Paulo, Brazil", + "url": "https://thedevconf.com/tdc/2024/sao-paulo/trilha-microservices", + "eventType": "The Developer's Conference - São Paulo", + "eventName": "Building Cloud-Native Microservices with Ballerina", + "presenterTwitter": "https://www.linkedin.com/in/lianecafarate/?originalSubdomain=br", + "presenter": "Liane Cafarate", + "presenterDesignation": "Lead - Solutions Engineer, WSO2", + "otherInfo": "", + "videoURL": "", + "buttonText": "More info" + }, + { "date": "Aug 14, 2024", "day": "Wed.", "time": "5:30 p.m. CDT", From 43599c03c46608f4f549275bc7678c414955517e Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Wed, 24 Jul 2024 11:48:32 +0530 Subject: [PATCH 38/53] Update meta data --- pages/policies/[slug].js | 10 +++++----- policy/cookie-policy.md | 5 ++--- policy/license-of-site.md | 3 ++- policy/privacy-policy.md | 3 ++- policy/security-policy.md | 2 +- policy/terms-of-service.md | 3 ++- policy/trademark-usage-policy.md | 4 +--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pages/policies/[slug].js b/pages/policies/[slug].js index f7f59801a932..493246f01e8a 100644 --- a/pages/policies/[slug].js +++ b/pages/policies/[slug].js @@ -71,11 +71,11 @@ export default function PostPage({ frontmatter, content, slug }) { {`${frontmatter.title} - The Ballerina programming language`} @@ -88,7 +88,7 @@ export default function PostPage({ frontmatter, content, slug }) { /> {/* */} @@ -98,11 +98,11 @@ export default function PostPage({ frontmatter, content, slug }) { diff --git a/policy/cookie-policy.md b/policy/cookie-policy.md index 198920d0c566..e13853ff85f2 100644 --- a/policy/cookie-policy.md +++ b/policy/cookie-policy.md @@ -2,9 +2,8 @@ layout: ballerina-inner-page title: Cookie policy permalink: /cookie-policy/ -description: Cookie policy of the Ballerina website -redirect_from: -- /cookie-policy +description: Learn about our use of cookies and how we ensure your privacy and data security on the Ballerina website in our Cookie Policy. +keywords: ballerinalang, integration, microservices, programming language, cloud native, ballerina language, cookie policy --- diff --git a/policy/license-of-site.md b/policy/license-of-site.md index 709738b28973..c79026e4ded1 100644 --- a/policy/license-of-site.md +++ b/policy/license-of-site.md @@ -2,7 +2,8 @@ layout: ballerina-inner-page title: Ballerina website license permalink: /license-of-site/ -description: License of the Ballerina website +description: Review the License of Site to understand the terms and conditions governing the use of Ballerina's website and its content. +keywords: ballerinalang, integration, microservices, programming language, cloud native, ballerina language, license of site --- Except as detailed below, the content on this website is licensed under the [Creative Commons Attribution 3.0 License](https://creativecommons.org/licenses/by/3.0/us/). diff --git a/policy/privacy-policy.md b/policy/privacy-policy.md index 2a77f4d6c3cd..b8243176657c 100644 --- a/policy/privacy-policy.md +++ b/policy/privacy-policy.md @@ -2,7 +2,8 @@ layout: ballerina-inner-page title: Privacy policy permalink: /privacy-policy/ -description: Privacy policy of the Ballerina website +description: Our Privacy Policy details how Ballerina collects, uses, and protects your personal information. Your privacy is our priority. +keywords: ballerinalang, integration, microservices, programming language, cloud native, ballerina language, privacy policy --- At WSO2, we recognize that privacy is important. This privacy policy applies to the Ballerina sites and services offered at https://ballerina.io/, Ballerina Central, Ballerina Blog, and any other site to which a link to these terms may appear. We’ve set out below the details of how we collect, use, share, and secure the personal information you provide. “You” or “Your” means the person visiting the Ballerina sites (the “Sites”) or using any services on it. “We,” “us,” and “our” means WSO2 LLC. diff --git a/policy/security-policy.md b/policy/security-policy.md index a79183fcc3c0..310bd1af9d03 100644 --- a/policy/security-policy.md +++ b/policy/security-policy.md @@ -1,7 +1,7 @@ --- layout: ballerina-inner-page title: Security policy -description: We take security issues very seriously and all the vulnerability reports are treated with the highest priority and confidentiality. +description: Read our Security Policy to understand the measures we take to protect your data and ensure a secure experience with Ballerina. keywords: ballerina, programming language, security, security-policy, security advisories intro: We take security issues very seriously and all the vulnerability reports are treated with the highest priority and confidentiality. permalink: /security-policy/ diff --git a/policy/terms-of-service.md b/policy/terms-of-service.md index 577e3171eb8b..95f7c5e333de 100644 --- a/policy/terms-of-service.md +++ b/policy/terms-of-service.md @@ -2,7 +2,8 @@ layout: ballerina-inner-page title: Terms of service permalink: /terms-of-service/ -description: Terms of service of the Ballerina website +description: The Terms of Service outline the rules and guidelines for using Ballerina's services. Ensure you're informed about your rights and obligations. +keywords: ballerinalang, integration, microservices, programming language, cloud native, ballerina language, terms of service --- ## Overview diff --git a/policy/trademark-usage-policy.md b/policy/trademark-usage-policy.md index 1db01c8bde2f..fcebe91d6a77 100644 --- a/policy/trademark-usage-policy.md +++ b/policy/trademark-usage-policy.md @@ -1,12 +1,10 @@ --- layout: ballerina-inner-page title: Ballerina trademark usage policy -description: Ballerina trademarks should be used in accordance with the sections below or with specific written permission obtained from WSO2. Usage of Trademarks in violation of the guidelines in this policy is prohibited. Any reference to trademarks and marks in this policy will include names, logos, and any service marks relating to Ballerina owned by WSO2, Inc (“Trademarks”). +description: Our Trademark Usage Policy provides guidelines for the proper use of Ballerina trademarks and logos. Protect and respect our brand. keywords: ballerina, community, ballerina community, branding, trademark, logo, brand guidelines, policy intro: Ballerina trademarks should be used in accordance with the sections below or with specific written permission obtained from WSO2. Usage of Trademarks in violation of the guidelines in this policy is prohibited. Any reference to trademarks and marks in this policy will include names, logos, and any service marks relating to Ballerina owned by WSO2, Inc (“Trademarks”). permalink: /trademark-usage-policy/ -redirect_from: - - /trademark-usage-policy --- The open-source software licenses under which the Ballerina language is released do not extend to the Ballerina Trademark nor does it give an implied right or license to use the Ballerina Trademarks. From 76e78bc0b376ca1a1bb5348a48b4d439054077cd Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 25 Jul 2024 12:13:11 +0530 Subject: [PATCH 39/53] Update _data/events.json --- _data/events.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/events.json b/_data/events.json index 462abbbc3e0b..1e6b3db3dc8f 100644 --- a/_data/events.json +++ b/_data/events.json @@ -4,7 +4,7 @@ "date": "Sep 18, 2024", "day": "Wed.", "time": "5:10 p.m. GMT-3", - "expire": "2024-09-18T20:00:00.0000-00:00", + "expire": "2024-09-18T21:10:00.0000-00:00", "location": "São Paulo, Brazil", "url": "https://thedevconf.com/tdc/2024/sao-paulo/trilha-microservices", "eventType": "The Developer's Conference - São Paulo", From 536f56a1eea4f57f3813b93b159a8dacbedc28ad Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Thu, 25 Jul 2024 13:38:42 +0530 Subject: [PATCH 40/53] Update meta tags --- layouts/LayoutOther.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/layouts/LayoutOther.js b/layouts/LayoutOther.js index e91a3294e586..2b8a6e21a4fb 100644 --- a/layouts/LayoutOther.js +++ b/layouts/LayoutOther.js @@ -35,14 +35,12 @@ export default function Layout({ children }) { {/* */} - {/* */} - From 75f531da846aa474d6600503b993f2f5abe8b3b2 Mon Sep 17 00:00:00 2001 From: Tharindu Weerasinghe Date: Fri, 26 Jul 2024 10:20:23 +0530 Subject: [PATCH 41/53] Add 1.2.54 release note --- downloads/1.2.x-release-notes/1.2.54.md | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 downloads/1.2.x-release-notes/1.2.54.md diff --git a/downloads/1.2.x-release-notes/1.2.54.md b/downloads/1.2.x-release-notes/1.2.54.md new file mode 100644 index 000000000000..63beeacf9e37 --- /dev/null +++ b/downloads/1.2.x-release-notes/1.2.54.md @@ -0,0 +1,34 @@ +--- +layout: ballerina-left-nav-release-notes +title: 1.2.54 +permalink: /downloads/1.2.x-release-notes// +active: 1.2.54 +redirect_from: + - /downloads/1.2.x-release-notes/ +--- + +## Overview of jBallerina 1.2.54 + +The jBallerina 1.2.54 patch release improves upon the 1.2.53 release by adding security fixes and support for Java 11 in Docker. + +You can use the update tool to update to jBallerina 1.2.54 as follows. + +**For existing users:** + +If you are already using jBallerina version 1.2.14, or above, you can directly update your distribution to jBallerina 1.2.54 by executing the following command: + +``` +bal dist update +``` + +However, if you are using + +- jBallerina 1.2.0 to 1.2.13, run `ballerina dist update` to update +- jBallerina 1.2.0 but being switched to a previous version, run `ballerina dist pull jballerina-1.2.54` to update +- a jBallerina version below 1.1.0, install via the [installers](https://ballerina.io/downloads/) + +**For new users:** + +If you have not installed jBallerina, then download the [installers](https://ballerina.io/downloads/) to install. + + From e774ffb9bb854f9abcf224692caa38ba58c9a37b Mon Sep 17 00:00:00 2001 From: Tharindu Weerasinghe Date: Fri, 26 Jul 2024 11:00:40 +0530 Subject: [PATCH 42/53] Update menus and add metadata.json --- _data/release_notes_versions.json | 20 +++++++++++++++++++- utils/archived-lm.json | 8 ++++++++ utils/rl.json | 8 ++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/_data/release_notes_versions.json b/_data/release_notes_versions.json index ef87dde32a45..eed177acfa17 100644 --- a/_data/release_notes_versions.json +++ b/_data/release_notes_versions.json @@ -1456,5 +1456,23 @@ ], "api-docs":"ballerina-api-docs-1.2.53.zip", "release-notes":"ballerina-release-notes-1.2.53.md" - } + }, + { + "version":"1.2.54", + "release-date":"2024-07-26", + "windows-installer":"ballerina-windows-installer-x64-1.2.54.msi", + "windows-installer-size":"272K", + "linux-installer":"ballerina-linux-installer-x64-1.2.54.deb", + "linux-installer-size":"152mb", + "macos-installer":"ballerina-macos-installer-x64-1.2.54.pkg", + "macos-installer-size":"172mb", + "rpm-installer":"ballerina-linux-installer-x64-1.2.54.rpm", + "rpm-installer-size":"175mb", + "other-artefacts":[ + "ballerina-1.2.54.zip", + "ballerina-1.2.54.vsix" + ], + "api-docs":"ballerina-api-docs-1.2.54.zip", + "release-notes":"ballerina-release-notes-1.2.54.md" + } ] diff --git a/utils/archived-lm.json b/utils/archived-lm.json index f22976092336..17a81e72f4b6 100644 --- a/utils/archived-lm.json +++ b/utils/archived-lm.json @@ -593,6 +593,14 @@ "url": "/1.2/learn/api-docs/ballerina/", "id": "1.2.x-api-docs" }, + { + "dirName": "1.2.54", + "level": 2, + "position": 1, + "isDir": false, + "url": "#1.2.54", + "id": "1.2.54v" + }, { "dirName": "1.2.53", "level": 2, diff --git a/utils/rl.json b/utils/rl.json index 4cf8f886ab20..088b742345c5 100644 --- a/utils/rl.json +++ b/utils/rl.json @@ -595,6 +595,14 @@ "url": "/downloads/1.2.x-release-notes", "id": "1.2.x-release-notes", "subDirectories": [ + { + "dirName": "1.2.54", + "level": 2, + "position": 1, + "isDir": false, + "url": "/downloads/1.2.x-release-notes/1.2.54", + "id": "1.2.54" + }, { "dirName": "1.2.53", "level": 2, From c212d2eeaa1fc1be14ecbec925f939d52ff34ef9 Mon Sep 17 00:00:00 2001 From: Tharindu Weerasinghe Date: Fri, 26 Jul 2024 11:04:31 +0530 Subject: [PATCH 43/53] Remove vsix link --- _data/release_notes_versions.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/_data/release_notes_versions.json b/_data/release_notes_versions.json index eed177acfa17..2cb020285028 100644 --- a/_data/release_notes_versions.json +++ b/_data/release_notes_versions.json @@ -1469,8 +1469,7 @@ "rpm-installer":"ballerina-linux-installer-x64-1.2.54.rpm", "rpm-installer-size":"175mb", "other-artefacts":[ - "ballerina-1.2.54.zip", - "ballerina-1.2.54.vsix" + "ballerina-1.2.54.zip" ], "api-docs":"ballerina-api-docs-1.2.54.zip", "release-notes":"ballerina-release-notes-1.2.54.md" From 0202218178c13d13340d9ab7d474af8f13784a8c Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Fri, 26 Jul 2024 15:15:31 +0530 Subject: [PATCH 44/53] Add NUST guidelines --- .../ballerina-nust-hackathon-2024.pdf | Bin 0 -> 58136 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/hackathons/ballerina-nust-hackathon-2024.pdf diff --git a/public/hackathons/ballerina-nust-hackathon-2024.pdf b/public/hackathons/ballerina-nust-hackathon-2024.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6ddf2e8a2b973c2355c47174b644fe2da0049831 GIT binary patch literal 58136 zcmc$_1yG#bwk--FxCaSN<1URi?gV#tcWc}U9^Bmn1cC&2r*RJ&Bm{SN%_IN6Z|!}~ zdH2?l`|5R3{e9g_zB$L5YZX1`7*tB)l1xBm4kW6X!~Jz6Ab=I%XkvrJ&(ES}?P_NZ zpj9xow>Ggh27E9!wKaCNa&!Q&v9hrPm;h?#V0#yUv4a^v%+bNj+SS_8!G#WqMG5R^ z=4NUR2GFY7S{t*xP7kmLvhe_<933rR=M#4{bpfcDJD8b+&B1hnf=I8oe;&yG&j*_t z1As^@qVfP11xK*GvE4sAas9KCn8=?_e|MD=1F#~o$jSWmt_c7#v;Y0#Mq-hd0{~y! zR7C);U^nys_gT6BIjfqNlR1Dz#KFPQ^>vV&iR)jV<*XfSkys=F9IxXY!LODBbXi}= zu<9eRsF<6&0(80A09+hA%peXPb^s8_&CJ8W$<4(9;NoIqX6NQ&<#_EV0{8>z-_x7^ z!RmE>0E@bcG}50p0Iij)s}nB^i-(IN8?&jS{VOv6berdYY#@*W$P8o$a&mC}(@=IE zc4kg)9w6wyY^Tc~Lp?m09o$@8nH`K-{*AGq|FN;`Y&^_7ARcxe04MjW*&t3%E&w|x zD>DZ>keds@$-}|S#m3GC`cH!T$5^x1pkucDD**q1%VO~wS1v4OEaoggNfBu$WjR$d za}g(1ZFw07aUSsxU?ocxQ)@LhMK&cd3kL~nJ02+oDQ9;@Ln|&bb)c%bnS%(6yS2H; zpK1P$@4!D{@xQjue=n4PJUq-w;B0Re14R%Uh}i0jpPb`EA%Rv`O- zHlqG>&RZC=**Um_Jajzl9i1H1WmMg5*wsO9GOQ9VVm6NA_U5KCOh5$(8yiP$TWjYJ z9{(HX|Ml$n?>YavkASaUb8&z;fE)nOYkalsv7Mbc*xJFE+1ioC32g0dZ0g12 zh*6oD)3*9TuEy?*Vki>MbggL)m+@%)Y0tqtdui%uynNoaDjN(1O)*uu3&Rx zdnC{7V}T#Bl*9I?&p6L8GO)u&M1e*|9_~_;jl1Y}vVq0|S}y_JW^U>h3T_FQ2~wnW zpZl%eXQ<+1qWq-chri!d1pH285d1wTl>2gPJ>u)-{n*4GV)?wg_VVy_LHhgYaVGD# z%w)jtE*d{WfPmPqtEb7|-Ve(&T|fQEHrd5;kzCxmutAF0$ldIUp*(MYS$^PG{~AA9 z=UWITGp!wZfeoFINw^b;mNjZ4JVaj?etJR6U*> z-v$KQ8cHjF&M_%HzOc2NeTM3mZ%cTyv1 z?p>@dSW>3d6@AyDDn`T`emfTG9in35;9DxWu8bDa=h#&KJ+3kzb@bA_37sbd;UnD~ zGSiJyBoEcI;fq7sdW!;hp+UI)7~Mj&vqGOHnhs-Up*g%aC{&Zhsk49^0~Wzeue3+%SUP5`1Aj%6H?Z+EYcLEuGgOD``+pd8R9^8e#5oU-~AlA%jSaWqx zzkX54A#39#Q_qAfEUI^c zwZ8O{oB2B|CvRKbczepFm2z#|^U<4N;NI1j*`H;#jc^}*0!b7+r%v}CJ(N^Bi5ixy_NsfThLgJQ(M+C<{-)4VJ9^wH0&moOpQ#!?d{#Oj zcam?hVHZhS&}L<+1K)ozfB%NwyA{o6NMlNREK|*88#>j9WD2_l_2V?9Su%SR??_go z4=%i{I$kvpeO(z~>cQzAX2iozXD(AEoO0DT0+U;#j3=pIH`g(B6sq5~-Wxo`N&z-%C|63xIcEVh6DFl2Y1K$o}R;6J|k~)GWHL${QpfCLjpnno5U*rTCTvM^}j;Rwq5pzWmD3A1m5<18I7l z@f1*%?gqR{KQ>??+|54+OCD=7dxHX;_V|x>aU$%e~ zE>n?WBWDT=xhCX@0K8m#31K1DA{ny{ffx}pBW2)xhBI2d6E#$|tO>-V!J2Rwp&jHb z)5#@uTB;POANo1AlW+u487Z>Fun`ZDpMO3sM=2EL5AG}1szy39(cMt?xr+LJ8xsL0 zXq8PUqb7!u;F=9``?UA}7N#`Hr`zi|#YA-fIe|)mgyfx$W#ZvV9w6024PP5fYX5Ld-qoS^4tGng17(f%h=oe@y;-4x{QZAYO^_u zo>7qwUa~@Zo0iG0r51M_&Zey+{Uc}PxSyUh)z#OOl2Ux^gb3-P*5nW26Bkx*imcQ_ z?WS6a`?BqQOzRFRjg<^HmJ4T3t}G%;&5?ecFI2kT>A0UCwGzp#env^ECIz!C`mV=< z<%}K76^BDwVZnfW&EDr*27pbm)&`8wrk`_fbj!C9{EGMA4i&~w$c!lpmfD_!7O2Dt zskF|oE*fkR8}7CkLA+2IiUk8_4=dbb2)$jRCm+@70p>3ol225T9J<9ETGtF7Bh_vW z@q^G>QRv6PYvSMHd5WbpX3KpzC%FlGYBk~f^U+-@Ki#J&Tpw)ByIhJ@7G_eH%4G74 zc-ejU(NvT421DE-LVG9Q((|JiCLR38%ig>(8S2M=dGvQ}I0b^ex+0h1vGC(VObm67 zFyaJlY@P)>N%M&l(rHiDdq1{sG*>@7JwFSP*R)Sc!l+s0b6@=Oohs+*ITNmv$%!q6| zM;owyqmZ3I%2X2eE^1pjb>kthA(OIf)QCPUa{o$14383r>Hv7KyqYj6bJMv~Z56r#pI=iI#0?TV2l!Pr;R ztl`>DJX@tIU!0icy|!=4z4{JuP66E@m7s{Bd@|ieJL@y|HDPeNb#WgtyV&hdhrE92 zap-tltyOiaEaq6*Qa0*cyaf%ww;W%?$ny>6d55Z)!i`#t;LSJH*+xFuRM0m4@SOLz zd9|w+C11vWYJ3?i`zn-_18DIhH0odt=y^PeLnwK-8t-4ur|5!Mllq~~y9tVtfTikz zR33-iR{PrbME954Ecr(DgIewU9)H*eouG}qN#mXCY;E=gM}`n>Hq1?epem)yb=svo?FklNYwqAm{fAH)&uQrWcsA2qZKT9KGl8bAXXt)Tguqc{aT!D z!VPK@ktBhAa83z(#6-+{nrHOwioFF^zRwPY)N&#xQweQ#7qJ9+!SExG9b4?5RV=b6 zkf?IL9I7R3;dfwbs9Ib_iZhwu9=UyRbZF5KsqplNbe)K@TBHv~SLT%DVJslBdKOa- zGSG%a%;54%m+SZstji;iybtG&!RNcM&GB)(YDYMJJ5P`0)5JZm9SX9_+iFyBw1ijN z4Aez|zoe8w|<|H^!fLj zmYMpwpNl4SC3*M6aT(m@mtxD9zvYPTGI*SXH@ayep56pkZ|!mYxDzfg>{+F=oDApP zC5A9EqTIUnF5`cj6KARnI=8VL6Ub2^bMO4p6P+Dvrq|^q!YGp1UoXDjOqqYFQj=n$ zdM%SWaX=ytQYd9xJnvn#lC)paA&Hj6V_YZbw&eS0#jxM>h-1S*1EzfvUW?VfVKd-r zDo7ajiV+vN;x=QkFfZ)&?2JO}Qzl~#pxeFT0lUQI=Je-Qh^KyCxV6tt4Fm0hz2dO9 ziNx;{4BOqrzE{exWESdlaETj~XB)&~K(5AracZ$2VvPmHu14MogY7-4SoJpT)wRdy z-C|EhXAd+CT6N>T_Gtq;s1BwNgFn;?Sd5^VFllQ`MghLm2sBh z3`lx?I5yLe75AfZ}_8Mm*O+>){>tbN)gdP~yZuy7-TFPWUD(Iha$FUAPL zZhdN{?(#WAD64*;d*g*cq*=BS`>2*^<*f85iG#)$BvglIs`jF+_k4qz*t23{m0%fU zo4x*p^ta3XIU&Z%N_))#5BKb}#<4{$8NBf&a$GM1gl?x@rju}Tx`|LJC)FE588@1- zNvNW}+V2wBA)mFq3hSgqJw0`~8xfShlW2K1dn2SFC5!ZC>x08}zn~mVku=&49a#d5)GCYkYH|MLg(U5=l+zEhd9Jqz(TrS zZKL@kwU7!w&kj8=#YO?=e#fzP!x4q$x7{{@J#&SaO}&uT)c1ZQMxD)hrP+(}*%aj@ zx)ZduCuL8vK<^(5j*69fhme%v0*$&yzuqw`doRQ zx6cwx@*rLef4{qssdMHT`gC+Oe{JD&p%ud<1Vbg^E_LVRX zgf|#g7cZauZW`cJ2Qf%Ljr7^4>+1Owt=l9!ZmobNPO3a%bg zmaO1XQ>{%*#7fGu>ACh*Lic#+HJ zu24Y?WlO$4vrez}hz`y{Y^uFe!2r|kD0F#p#}rb?ZK-4h1?{DHVSp>4uS6p-WhTXW zH$IG~cL7Om-!br6oTj+e2|<9(_nu&FpIoV&kh_e`Y>PDDaG7@oIV&*q6B?Zhvwl+< z8-p}WEnpNT(|uZsF^IgQ`A`xbvE(7^Wx|lvc~4hDSM&>XF67oo2A7*yv2&dwz-0aN zL`_Y6LVR*fozI8l)0^?`L9Rr;O2h0Yn~jYVcbC5A1%aGY>Kar-cVFv`r-BOInywNh ziK*N@Q_C0ySdUL0*(ZX`IEpT#QrHcMD{oYnRftmCH(xyXMlBa}&u0p46G&(48Om2l ze!81BVKDU4Lk}LQncb%3WKD^q!U{S?wm*da2pKrSU~gxr3!YX#Le7w=A=4y*y5)j2 zXQ>JBniK4L*;idwjyDJ>j7P7aOa`wmFR)Sl5Oy&APPvX{qnG1s3t%?iiVPCU%CK>R^*^I`2^}N zS@D@LNcu5miQ9fF=l@))MwCOPAiMKk9kkmT$~h^ETp6TAd~0LEhpA6h{za)iT)XRn z1s!>1Mvd**;WLN|E%kJw?pt9}KMERxy(rruvO|z~eTRxhtVGkMK+-R0K<D`lt9Q)gK*8E;m-nT+_C`JRqeFh3@AW*yQk@?T|~6h{rf{6 zgxvxu7VqH8j%-c@I~jjN#}jLnyk>;6VOzGg>kn1>$2>_@9Ta4TwCBoIw)JqT}dn+6{x3wxhv)>VEbj>=4ap@GfAtqV5a2POQ&8# zmpUrzm$DC}d{#B=1Pp|^%@x8X8l8;riBT}aUbRs~-phcc#32V!k*5hWHz z`}+!Z6iUmx#c<^884BWOH3{NTkbX@;FbJj4D?1fQf!C4|qvs#d6r;a0%Fnspuab`6wN!WyqC|DRZE|BJn+UMwBWk8 zBGobFpsPx{{*Wa65pd@zoMvIg=VH#7uG_-af!0$PY|c>E0a>R59v6mvf|a0K@>#MK zj&vj1k|_)x|AHT1EJv9aa!}!yE!3Fb#PA_=EBnpV{rJN-ScB%W~wuQ|kLbDYZ z+`OsPuzZFb>1cEJ1InunytM#-YOhaR{$UNT)-O6`m~sU}Ga>3^#C}SHzQ3i*!z#Jp zIwf01W&$>LSAcW@P__O0#JWQh3X4~%s{uVidJ5m0b{^&Knzzz8Q2-}Sx+?%Yz5WAF zS=DU6n0f47hkS#MD$K9z?noDSurB}~BGL>KiDU}n>?nhbK&MvBNysOpdAOUyj6MER zsze-d+Br*KOGf4ud4XU1oFLNU^)+JKL?`kS9p79T&lNuoC(}tTk&>7f&+|x&fvzai zts5Ma`^rLxA1K(4JMn!kfg@_2rnKtS_>sa#Ap0e6CV{GOt-SxTeC5l)p47!a4kI-m zer{EB!AFfR>Wnu9i^{{Yqin%mmB#VMdN`HekqnaNSGhhSD1Ff=s z<>wv5V#wEI;%;eklwFI@F`vSJd+|c4LtD**Lf%3fsIX z(BSKclc^5h=ZET8=K0GBzDP!LU>jX&o{?af%_>HZ?TzQ1Z!|p8M76Oy!M-!vLo=_) z&JR;VK;*;p=RG@nujg)c4${qpScV&J=f#CbN0;8PB+68!W-gOQgYZ5TkiK(d=n!kW z&Bbp_IbC8aJ=3d!1RYa`Qv$6loD#6y&=K8(MPGOh7CUtP=O$LWa1*({)mgZ3zBC6C zTef&duA?pXLkM36CUy^zyZk3m3Ec+uuY-rMC?W2mdQJkktGx!j)y~NP#&t0f6#f|M z_UB}0@>#Y3$DwU)YpYE87^3zBJ5pNI7GGa3Cacxg2c#_po0B3YWh_e%k_QfOV{=m|KR>sKa34<<@5``W8_!(pRk4r@ z_xn-V_occxTF8=pMDT$EqEcknv9S%6!^cFShD!BCx6C$Mj`Ww#eb2%b@%qZ?h1wtM z0U%*B_^QZS05%&l@E9YVdM^zw&ve^&Q_N{9Vz(zr*8LgYCRf`fi85!X6g4&WWO8~W zG)|JxMVPIcK7V4p&Tl_SoZi6}+~HhI8)v$twhT1T6U@yQimYop>U#=HuNYbGqTCCe+Z!`0ft+SK?Dh2h`T6aVKt3Lq;FfSrfyl|R7_0s(*=uQgE~F4orqFb69u zGaEOMoBjVY^i3)K3Mzxbba}7rCtzJzIvbZ_p^M4)*~?^&UAq0bYkpJcW_bJPb(lBDlbpcu#Q`w zG)188F(fszb$U5>!x~3bQW8xM)*d^7-i6=~=OQ|2WQ3D>aLeP~@q_D9(X) zAx}e!E|9D$cK=DZdm(#sSwLv!gY8(nzD%TI<6tMz;W8OB(P6M+u7gLm?{L{rP9ID# z@+#;g-IRVm5_|_SSEEcoYX=G}M+t9aBdE>g9TTEC+B1296M*|uKXtwI;k@3{y=~2$ zf7%(bZaq-1D;Y;Vt%?hlHPU?-?4C*Uvv7IFu1-}RXuxFZsv#5m25-rzWIikzPW~K^ zMVT&EZ4vK*+=Wuq(}3yZ3oc>PkQZj(hJ;um^t=`7&%2KMf~bm={I5k#l-KT!!HifT z`pk6w_kC^gLPY^k?U}eCJp3qStu#QE$ZsL(J;nL5IaIo8{8UhtOKCobdm<9nAeUAen2@egl2;nJw}|=q-FD$ z&nUqRpjO&0c0E28X1DaFP(Rg#^v)}3owfT-M7RD#whFpR~|iu4hA$bgZ} zk?p))$Ww^($J1=S%9kOj@Qeb8f-X;AGE+Z$2N`m<0zvKW{x;p5XR!`hUEC&}0UO4H z?@_4BJRk5E;n^B*r*a>Ky27nZ!LJy&_pFV<+9s_vnVAKg?)SdD3q?WpQBCbv4!U@V zZ=#S-y{q`Vks2l6Q`ptpDC3E4DF^YT?tL9}hUhjZv{2*yJSZPqJwIbkWQ7m?=ta>; zmTVh4p^i363s%sw6zCOLU-G`=9h0`FS^{D`dUo>MWTO1IU{!t7it}U{-7eC=rRVCg z(sS9lXI)f>e~)v9R$OoE-ph6)ke@d!@hj+79yQbLM}5qT^0;b_CFrdf|BarvAH4^n zdte5{d3c*ad!u2FV8R$ZeI>bSqbsdlYR}$V-z+$hzQR_++J;n>otX?YW3mPCy|fBiZ^5Fye=@Qn(p zk=hA79_i6q27{pySefrDJ4&Zvs(sHnojG-#XKvr`Y84>sFj8D4TcP?WzKMu`6#t3k zQLehFa-AVlZIWEBPsYs%$~)s^vDP(A^!27N*P?xdeQusNjL3*-o7?S1=^*Xk6isr- zWb=`dwVs?(UX$`fCqw3t8>u*rjPI&K*q{X^F^u69`ewc4WeO-}%W%l)Q>@wvT3hk@ z*kMpA^-9wfZQNFzKGy}1}18u z|1v?VG32n~MdHufn^7Z}F{=3j<6vn!UjiF3=36m%&m}W6a{IkLm)Af)lX}hFTBjsV zD^tVP|M+|TElU7GK^2YG^pWKrRjfko_LVNQ!>)WqWd_Ey=?gtBz93ZJP1Inu?U9!} z!Q+5S42qXD_5${uyk)O__2bWX>NCo00yp^=vScO|W+g1HSb9hpB3tEe(=1#~W)b^^ z^%jF@Akc|#v?NADo5}6JZSUCZqPX9-?`xByWAJ}%O>N;?pdF@nNx!vKuuN#ET(V}* ze=l2>Fp|!Os^Jc65^wLd+go*eZo=UglymneT#CD>#3(e|PGqn-u$P>}AI=UhfG^(Q zBCIhpf6x5W`|LqW&rbc!&|N%|I>Cvr%-!M1s=DHsEl)vwjfg(1HMX-c!KVChp+?rN zX#2=9sDhItvO@;uyt${^ZVJKVTmw*UxW{oiO@bT2U^Z#3^K3%1NAYc#{v<!#vhQp=05jan#G!Gb^p>~sVp#|7S&0B$9` zMcD4-`tljKI-2xghJ+y`egC%=OW`YbB^GR4w`^P`;WcT)VKZhQBO!+CNhR5tCqFqn z@v3q4N3ts=_yI|U393RLtumuQ1VWmjb`1B3Kiebnj0K(^GoVytDPZu=4zt*xqgPga z^2y7S-cDB+A3JmR*N2&jB7oMae44eLFMC2AC=kL&Jx$?*;6<#J~R^7miRC)2Q%5Q8QT-UU{`T}wQj-nG>>ao&G8jV zao~Yhuu*E~B#vNR#|F*5_LU5m4K$??M;FiF&^Gz1$pgxJ`>ce}$l1q_cfmzKe>=BRryoe#{$t%$mYuXdt*&V_>gYDPO8!}eXWC$(c10Y4RsOX}@ zZdAQG@2s?P_gc*;WT)lr$qiV@UmPHJf1>Ayfb!<+0mFmrYB+{a7&mqY?3 z)T3KenXbG(h>FFnc3U67>g z8&4(u-(ffnL|-K53#j2QGY)KBA~fpUJ48b=qTF)&inEi!iDVs3A?Y^3%<-m>ykH-y zlz``ADH;eT8gXq(#dSz3liK1(23L8k|CLZnvo1a&tOHrmY+#$*34erFuhS z@O$;LtHtBW3*0TbVk!PP*+#fJ6;Jv1vZU^e{<+`WPAM4$`J#?;PgvBtu(y7+29$F& z)xT`NF)F6?%~51Gl;McMN_B7HTPH+#rxf!2gX!wA{-H-bIQ(OT|+m1>!O^ zZf~Kf?s&GRJQ_pWkt1y#aGD|d=vJa1h(mP&yL20IMwSOB)P;S?8~Di^q7CX>5jFp-L;>+!IQVDI~U#3 zaY9eAEh!B!Q}<5telX>#Hn@0$1(}(t`MLSb?=Lq725~(%5&6B0(Mi0i0H4$rGF`3;PAp(GMz`wW+_pV)k-$WWDXetr_g7n$!`&1^ zsSr0BhI>3E)&rtO8RW6CjJ6)I39{fS=`446)|D&f^)G4G?Z8qz*Ab#ifbC#47wnAy zQXfwHXODGbHo>=>XSvP+aC5o>GHeH4y&yQL46yyr-8I2(xsKHB9x5U-Bjri%lhTu- z?qtDvo&kc7f}|IV^Vs}zH_J*wVHgG|(*x^&BLnMLvKR_Bo*dO-;%BhX1m!@rt(H)H%JmT;K;!TX+A`#S1U z!0;y(yp62{bGY~Q=agixgxn07@#a%So2jLkcQ(5Ompkhvfw}IKS3@pE4V2aKbH>hx zI6ui+wDLJ}^9@wrrTH~}Hxl};Z50|$&afmmzVN=X`O`}0@2_jWdFRb&%B^-<7JQB^ ziK82t7*(#z)CI58Wm!%#s3TjfhU04FZfs?ikPmJi%UV!A4;(NwTB5B`y)EmWF!yr0 z=mBqgv@VntETjQ~BrADV*lo~!?a}c%)bTs=X7|JW#7wgL)hYV#Uw;$!BoK8=fFx|! z(HSJw(m|r%S=h4>LYlrcTyr5`QB<&U9#z>Bu1iKVn3n3?_KY=^=XQ;|*5`}akfvFE z>>t#RIqra|=a#h+@*n(+H%BLE?WrW`O)|NmuRN|n{Y zB@_#%h-gMguFE)cAtKKmLEOMz+uB{DwNQQR?zWq1rb6W6zxGmMaaqPK(f53iL+U?{ z6EXjFbd&Bat)VaU9_Q40TpG6Gpv&{+@6M+M;py*Zi_++CS2TE#p%zJ5`n%9Fssj9p zFMmTDel+L%kNK|uK$=%FwtVHBtC+hux`9p2UH-^rUZq5)s^+iyn!i*;ENbSSt^gKk z``3=5|G0|%<0}1{7n1OFl~Q$m<*)x4D#Z@?LvL3>Vv%~4y!^R)mD8|DIy$)iX_b6U zhyC3u$qC^6yY)}Iyt$dRv8bcx-})XdARB-i^jE&@k08k9Rp;}kE8tJ6NCogm=c4i| zF8cfONBi*l>5o?`ueQ7@qFl`#UWfcevVXNg^;Ldk>Z)W6{_ERUMbh85fLHa+>xh3! zeO_e`|4u>j|1U1Dm;pHfuYZ48`Jch)uSDi66n|m$Z=m=Kw|@`CtBC7=2gQF-68(X~ z*xfy3cdz4iAH7AW2IR?L=W95G`L ztFfJ<ZT`nHBe95^ySxU)U#7hVg~qFf$Q-N$Hn(^c!#VsT=>Jas{)eX5vDPk5 zcE(<>0=mDId4B|L|EdyW`-6YWAvK1KKk@b_X_xM}pM`~`rDf-3PR8lj$tNYz zh*&!+e*EkiEX8{L(?xlN4iXdiv>af)hA9JW(3udKui1|bLcjC*S`E=;BvG@-6kA2m zX87scnpnh7DCZs3Fs=$J_jiHyr@`#m;D;X!@&W~M2z0*D@k=A>3}LBVj~7!>@oRu= z7DHG}-s1Xqy$u*>RlKH~+LImTTv+6OF&Le{t~f`-8d3Bg7(^*!D&#CtavC&z&^d=3R z-23Ef@}^UJHII5ZB3TbUmICe_jS|~98!wDX?d*nS@5BZFFnm>70(JrXcCWZyp>QtM z4$t)^$H0@d#Mu`qF2?Bve>ozgbI40q_9MzBOXHC~2d1ojyydV#SiKA_tiR`r#0gZg z3|WVW&YPwSz`f;gACWSK0?V%Fr;uGrUFnkSyZycM`-r%$2bBHV)!xvWiuf~NS*)~V zdr+iX$iX{AFT!->^LInMagY!AWq`S&jQT`{@3K2dIA)ypxZ1K|!_;7|mIX_w`x*wM z512(2m6BJ)HU{#H79Hc|4sxP|Bs_#rSD zNn1i8^c^NS4YF1YmCP9nO;geHqRF0RPzTrXZox~`cYj1HH`67SP~PPkfBZWH>p&V+!JE{p&-CqCSfEe;KV zDY%(4ev%;mNRl??R93al1@WB3JjvNZaX>xrH0r))Ma#Alrz;!)H%b`H&JGBl`M8QP zxYdkVWm146tkJ~2?gJ{K1jwJ~6VnipI=$~c7rYhhVsiOVyY4B&=KMtFC(4B~$ft^a zkK|5U5xJY(Kav$o{Izzh;3m(BzhFOn({y}rDbE~DzpYdDH=)>B^CntfUbGNb|9Z3i zfw2R298GQ2cw? z<$2t;`Uw1Zw|X9&uw`z-x6hLb3Sj<0Rz~HLZum9KV1RcZ@Ac>PlK>vgTs*Pf#QRCb z=OGod@Oru&f6i!XL-*4M)B6vd^6qC{0JkTh2uU3YW&v&Q7AS#d2-xp!#|wjCqC1#m z4V?n#VOe5Cdim3SbJVBcfXrqs?}tx3?%7v;U9`DEitf;$xMG~k!|tc9qnD&xPs9-w z6jSU=A!$3OlcOYkisx{iymv2}ti8`HzC17o2%3@(+iy08p2shK2-_$S1dxDGSEjhf zZ@V5p3M#>#*f{z9^6r7{K`ohdE7nFQa6=|5D=*P|u;=j?c29sG>f5qpUFKI5ETnG+ z6M7}LOZ=oDO`N1H0NWJ&;5Zf1+?e$!vczEejW@>3TqWA_erN887JU>Q%y;E#E%*YcD}K=XBbxBvH_!x6)hwj z4x?^Kg0Y6qEz(KdOD1brvskKdCTrQ7655PPTH!tUT7p-k{l)!J*7E|dPRVXXhz5-A z3?f=mo-j;KgS1j3`&ZGW5|5}U%+P-z+lQ^oStavJ-Xy?(L>I9=p@AP#9Hy9xjT0Fa zWFDwVm%AHP-MGct0^EbV68RGIHV823V7w6gy6M zRer(k@;FZr@mv;=}&pW1a86i*H zCAyn}AKC~h(-YQ)i*F8H5A)m6g$byU-FK99a21PngSIb+wi*EbnE zT{+}A3nfEmaa)RoW=h_kH|bYekxgW%No=E=o}W;Am^>#7qSQB7tUAgg%DF|c_p$wv3ZlhoaHg3-^ktDYrKty{xdecnJNAQN_5qgc z>Flj+m1v+c`*_g#cgf>fX?<3Q*0ON#vb-HR&~7^aW-vQ6K~cdKsNA#I^g@TFs9Ih+ zODbxQ`Y!f6UQBRTdg^yJ9g%WC2}Um>f@WU}dBU|(3?uC0P3aZ!3I31}vSiAt=w)I* zOcXBj-sxe^^33WS$kKhV;-+yvHDg>p2KAafq;-GB#`bGDJ;TW8Mon+fiW4o~(D_nb zG+c*9r3(EP8y({aEu9q-2l_+edQTB0k(D)_*?KpIIEwryJh=zJ*ZVsT>9zdyF%MrE zXq75{vf@Cx(Bb6SU*%K{p|G7Lfh=C7uetqV& zAkbfP5tx@Ixb4^cmA~W3@4ylyd1b9Nilt~$BEN}|AGU&GvpvmihnANS3k!67 z9DIvJis$qDF1^4tn$heoot340qbU8C?|@>yoswv2-rD2{c(_zJRTR+DP>$XwSUbxp z8sb?mG>lry9%nwG<^3b0GJ`!S4IS>OqAU|`Ccv_)mZpjM8V5J()Ax{x0L5NI+g~{H5>;Q~ylJ-Y$IVeoQdAM?) z2Z-$VG^#p+L^CJthp%SsWeF*x3-x~0n8-sHNUqlc;xg1f7xfQZj_JsXi}F$^tnC9O z5xMP8bvxPiiCvlCpY`?+UG9@ag(AKQO*IwfHK=sQkNLnj?7lyxHGp;FBXgq$mbdU1 zon1RKcjh(Vir;0fGbkA%)1XZ0nZ!3(`Bi?4YyCitze1H0bRRnk|HikpAT(#=M=>fB zb3hlVkfAcAW~iXy)ve?;Z?WE2*N-@>y>y!WG+dNfj zLz`oiEqhzar}~+jmg`Vh)|=T=w5g~zcjT*$Tv$K!k4%Sco(^jWQY~RU4=<}CJPWt+ zaTp@e+gglKX3(U_)!D6N`4}^8B<~P@(C4N^V48UTprta&CdZN*u2n|cM9JVm+n~gw ziEuuGi7_*TB@bI~9B#_yoNRe6Z$!VTn~MQi88;YHYU)=FOk;8#7SIq-|9YL9{a<;Yf>ff|6LL zX*MfDE8+8pN{kN<$BH*nKja@ZZlezDJ|w0Jb8_(Q(4p25_CGddy+N#T6xCD;Wj0X~ z{qaGObf6i4z3)FshnT7`LT^mB=Na9Ph z`3$E_D~x5&P%jeG4rTa^w0)@?0$f150V?q0$XGuTmt^UT7ZF4YRNex&H4(lOtMEkY z)EF@Gr5eyp4PTNDxyGR7+F$cG5eFOBR|`9vRA@y1?9?w1xQC@>33X4zkalOdS3a4+ zj9ca#d3J$d!TPdo&_O-HoC7ybJx?f5{37lMHxM>pAcnwgybZtTC*%zQNLz#lMu6lK z;<*%LnSzAs7Zb`e^!ZN2@>@?+$T8HDKZF?m3GJMBgA-DozJ-I*5$%b1PQC#Pal{PA zoTSJVdwRd24ROTi8W1HC@-W&v)qU?`I1ia!xKW1PR;aE44`#F3Ho^OK4^ zVN;+3ZYW43`9ts|_#+m>J)vse*T4gV76lS>peQkK`bts2C;$AL+Bz>B5)$M zBg`X;Bgh~C6GRiB2~-V24Mq*rw9rN=)D_td#SWP_rVFM(goF6|LM$LWkZ}5AdZ?9D zJ(&(BQ$$9Dg*a9r=5%1G)R-_r1TVxD!XeI72&WuVN>HN-O^=Ba0T#zE#8wXa0Eont zAot`oi4&oXO#q6M6+&T3Y*Acbv_v3~MFoA{r>`3;)YEt>O{nKkGEkWHqM>Jrb@j(tF79=a=12v^8 z#sf7mSSSp7D-6Zk12dj++4-V9NzREZZVWwF>mt?w{xLiuo^aq%)_Us67UBuJeY_8CAhttibc38rT?NGx#FPjD<4N$Rp`9UuCLajQRjOLii7B=q#o{x%f$m-fRZ z#t?FM47zKS`WGnIXmu0732yB$^fI5pK5&`c00WA@?^BaOTxQA^wzLCl)+2OLJAyEW z!5{(p+$QYY$10*)Czz_9q3VA^F5=2t+8ws2ozQ+Ev=FHVprjMt{I1sfQ#smM$M*`K z?tXHO2q>H=BNQkG!T}3_6~TZe{2fEqBWh7QRJ@l~Gl|>RwXJ7?xeae&)}=?z=4`Mh z@^b!x`znTATMtFg3fc*u-K~Ec+%kh5KeQ`HGfBWBMsr*D3c?AhT~k0C$}(Ed3Ze~V zvzBssJBNQ8^z!w36~L9g*|J+3<%Gsg&Hs_FnKq%kJvpEac^TC%**`sZi*GkN&b@EQ z8~9D6{ptyW^)PxjDka6j`l}T#Gs}!-jCzQAgnGao_6Bm_e&`f>F_{Ghh#VMf@f9l% zQvpmRmhe#$gCevqG;80SIS*c62p0nwNSrHdCYGZhS_;e+EkTzIg!xD^QCF0NfCTo1 z|+xbG@5;wc%a`~d2xUTEK-QqW^^>o0T7@H*}cXz;_VA%1)x-wbS9JZa@JpXV;YkbN5&XsM;KO<2;G3W+ zy9>KJ0RG<4%eFm4z+0Z?-R@_cX49T$;BvL#I2w5AS4jKXw&CjOc*?DRQf0^5YD2^A zQxbj0?(yPe`Kn@lp*K?X>IO_kz42UxE^{(W;S-xDkzXu9*e;bdRychElbT zFpE(uypv4sr<=32ko$_iExkh_9H_dyUbtjiuE?iEe4N8EvOJ$tf@v+&noxC_hmCvO zqmh+(BW}>joks|?W^Zlg8#>kMI-PjcE^n`|qOKEYHRZVH(5iMxXR@w)mQ9jctvY5F ztkiXX=%|lXTWU-vHv>VE)|XA1qkGTKcnO5- zpF^RS4VU}it2OJhr7$G<))jxg<3)LAM+0x*e3Y=N(k8pFjiK}5?Qa8m;Phi(F)TOaH1W^Qag$7rMT{IDuYj7GC}(GuI?BskWvyHw0GZR!hTGA_ znbjq1%YEyWnaQOEA=6)Jp6PcEjKidT0AEX9EnYDm%!3SpwZn zt4^R0(S&zpACo9aor2xAd-FB_IR7H-oJQq3<@pv;|E`>JflDA{5d8NjK^D z>%p#++7STZe5Bvf`s+DZsGyF+*U!jQ|yA#33Of|$9sa(BDqs*E9DP^ zBw$i8uPgIB(u7sI6pD=5?J}f<0fz0i$V%r6sg{-kn6p1cU(_mcS8d#;h1 zvQLPl^fEKHdnU6fcw*%%BUhUsD$HK3k-OeOY+ceM^ zhiaMQLdJqakV5gGEgpVX4_;lVa$_tjci#nK)STZ}tM_6Qa^m&ks0i^K3pGe##c{%Gs8BG+0XzUT>*E+>$bnQFmJ{&a8;}A>=Eru^{v5RO7 z!~(YV7|60!n-S+wmrvZTv<%^*kHV_7jaq@XL(X2Ll!Oe`IrHl5?tZsYE|x~KgBx)) zF`_K|+eb-eE5;L$;wjR?jLCQ~Q&JXb#K^;8i?HD&lGqH( zA0_TO)*yba7sS0yRH0AXIjO{$6p2QrqMbS?WpEi55h614IyQpMfyXvwnHWrFHy?0@ z0`m96;d=pQ_ z8b7U%Atd8T4M{zbVj@jBp~*=Zek0X0vasRXNlXYK0M2Idb6*?!>gQ&&TemuDSMtuH zSK^ut%B&bNT4XjJmzDhzvJ5Ep5FA1yE;Xw@n>=N&%;eymBczV4pb6b_$>io(ol>`u zr`XAm^d(8nGL@mwK5spjLo&tYQc{~oB$(%ZaQys2HX#leuV)mzk1~qiBVShfDt6=) zdMClDJ;GFPKEjL1q)tLdi+QNo7pWu2C0B9ic6Fvs^avA11f*~zx+}u-s}R!oLI@=( zv%Q_e$0F5QU9Zp`xBWLIG(}T_tzFuD7-(T1!|MLqz(A7=kYCi((qyxtq%Un?Uxj%{R}KbziU7 zJI51Yd^QnuO0p!Y3Hjp(g4^Uvl_UytK9s)e5HB_L>0ohY_l~}o10x7T87Oj*5vKsB zO9Lzjq>=U0X`B-miS@mWfA=Z);EB@-5lc!*+YoP8VOMB!oHuW`cr1Qwvi#wcw44Jx z?RDZ~mLpt%^Qm9>NRa7fh*l6A)-W@n!J-a*g5}UkxREkgmQtmcAaR^iEBPT+?+I;( zyHrYvA~98jwJwmROi=RKDMYb2Df|Tm-#R zpS{GGrT$4o{F;&I4ktD!fx&@E#yPEw4Z)6)DMw#!%1RIfWkR9l z<0?NLx$e^%3I7!^Wr~e-2+~0*2ICzzb4g}o1!(~EgzT0B+Z3&*1hHutM~wW9ejV*#JkSGUJYjvviGinFoX z8&!Yo9-$%5Ck;A{jXpN{F=;{6{Ge3{R zG(=E70>2(MBX(hbE%rq^$bq~crn($Gfrfo^ctuJlwwdNnU2gRDAC zPJ5`7*FMy>dFP0qv1^{%cY2KH$}YRif+<(}HmW){ zbYg~jd{LT3B!ybUfwfU6NX(5hAg&sg<0=?HF%9C)x0%{bOpd%}u@`{5iBV)8N(ec0 z`OJj~bUJT)Z|v%lIQG z=~QEub%s3|DZ&kZfV^5bWm0y4Z7mB;hHOx$d{98Vq=N)c)pdf1;&(GSIa8a5nKFtdVE&^IrBlQrTeO$J|i8xVaQ@dxcv#rh&YWsN^NA;n2$LZnx7fvU^;x!J-Lv(W2V>G2U zxSeGer@4`A3Y@Xd<9Kgc-yi0phdWC+Ssu3<&h)#h16FwBpNKu2*ayh9rY_ax8?)QO zal_IdQ*%E3idC0XNBw&H$0)6PZ%Yy^dW)FEFtRoL(`t!oD&^|wWvz`#X}>$nG1jOI z+{>YJHdR?%96~E&&p;o2ZMDqSL<&-!UjE*6Gu*m*Vdb-g$G<9{uF1X-!4UO(yK!G? zRCjScxmvbiNBU4^t{q^ZBa1&UqJG&CoWd;EknM@N*zDhC{;7JDse45M zbiT-#tOy*`C3oh!zycUF^6u;Zsc+^{bZu38HsX-VLMC#D`wDxmZcWVB;Zn0up{j`= z9oUO!?o7oq6ZRCSMZRD*K#zUV#_A8aw3C(Su)ImSXYQ(Lp4C=NvE&o3mR!-&&Q?)$ z+X+f^q^)3DN-L+LCS!)JA9Uks(TPRzC zM#_6lW!OhZ=HT-xY(DK*&4HKUBesCH6R;jx%6RjqN467FS@Wi$>jqG<@6|q{vacZBH5w+Te&I@ zh_NgbQ9;UU^g?CG6ldbJs{K4cv7F<#2I1un_sq+;E_z>&=A0@{O}0u`!@2HgaLVY( zz~lmqtZS80{IRQsP~izx)*6(-d7~A z)bNm*m7cduHr49Hy7LYP$I9pFXKG#p(q{#?ojUWWWcFaT3WI*V`e*$qFcN-o=HqzF zlhGJ%vQvd6QjnIM<<^YSanW9%f;;wfX;MaZV|s#pV(>IJmbqTl3A%Cve!4aR;yX63 z{AG~8M2#g)>t$O6jKxb}CU!|7xeY(EGqVcUhKfoNP21m^Jr0$>oaB35SBmUO1v2=2 z-KLT0cIw|$dLy+AWNpU^yj9Dk8J;_a<8*ZuXA&&qUV^!)KqB}wWgkhUI`Xy%RVdEG zt*~CPy>;`hlW?$A+@0gP9Bt3bjwam%YZKMj=T|&Rl}{Tl3$ytR9SOd6896hJ(QMCP zU+((6P}FPFCYl{cBosbv?yu^mZNLoJ4eypZ1Fl7Eq~(9!vD2BAp3ub$oj6v4#i1lZXS za44{is#<$ZC;9T)%(n5Zhkd2nibl#djU|YIT1pFTA2+OI!-252f+Fk!@nyKe%tt?~ z*5G%0YWfb247cZL(fzMKk$J7g^^(XI`I<$8HahJ^CfA?<*lc9kbhVQd4YgU4%L8Nw z2+Fm-h;Q1%W9SIwxaZ=j^{L`0!zz>2>JqpD9m7?9`%|Pk#h>CuGPgb9I4cA0IbD1% z&Z|bJTBfOdP`5LiAkbJk;gKPQ5aRVzT{8MXWMPr~AKK%=OW#I&WX@urrryxKqS!=bt^fh?*ReQ)!Jk zRR)V}mIPG_96X(up602!<*Lm%52FiPh)|4G3lqjzaC-~s!wSnYD2ONuj}!GP70Hu7 zWkR>D?zrLy(tC2~-1W`wGZATC-}vQ!K`nD#Nu*!1KyvTZNu$_9*4uXT&qin?DhOc$Ew{~p!F zdmG~4gK$TSY}j5K#r-=wx3Xj19{&8gU3ae*ROcz@2-TClF?tP;?YNtf1`CDlI*`~< zaw5)Hq^7icRN?4GoP(~cXh%|mbATwlp#?`}aA)E~!};W|q>U3Smw@6xN%zH2*6xF(!cBe=5%S{Gmf)v+H*8GZ{@m4j&~V`F zl3wd_*{j9Q+gjP;b2r=HsWgTvdl)9X<|<9NU6q^#+t?TERIZNlZg`)zBOD4=v*%XSKfHhBV6sD)wXjw975*Dvv);=_AdrHN^tY`Vw2iyP|xvq$%qM zFb4~*E4UuWxODN%Xw5zIqHY@}8aaGRbH_K*bZ_M4&>C*Xv$}}tyBWPi&qjK}V4U)8tn|8-RVYW>tuTYvyOGHH?t3Y& zWIO6xqh1cvN!nbkpINUn3bGEmE?y#H64#qykc~{3%s!N3?N-};1#VW(B zXxRNnQ&06{Ct;dSi#any8y~z%^zE&m&)UDr?=fD^seZC*kLK+%@Y2!8paj8r5ew%{V@I=UJ@TkO^T6GR_-B0Aa4u`1AP;-0P_VH> zqhl*#=;eM_C_j&F|Ws-GX;u`A-rVR5<)qu`Ls zUeaQ%bhSA)TDTu!Iu($}#TKbAqt!B$vV#G6H0GNhGKc* zTD1$M!=>cYXZM5t_m*N<;dH+CoXQ(Bd)K97X43gLy%uUT`Y}bi;@dv8&U~)~+C|J^ zwHDsdT-S=)^^H2YCr6FVe!#{*xp zy|`bID&sEu{q^yTBvbx!4^&<83D&2MkQ2)Z_4~+7aq<4FxOm4by$?lxY^_A%;wo@C zY?i+IO?^R=bBI~xM5&R#9JStb=ct9FWT7i@p=-}nclMla9}Dv4iLs=NivrcREmZ=5 zaqdr%ZPH@W_;}`G9$YQ91tOJEo@&OmB8#@N`n+mt{o!LX+n6g`n_HQ|cvkGJapo@E z-t6@A%*h4wh}q!0De|2~rAAljXw`8b!o{%@!B%?eIPXS|2oKX8;R2wjkrUpWB_I|b znCm50y_}9K%Y{h~w%h0^^9Y){iq-@5ut(ko&H{{%6)> zP4h0F*Hc!TlKcTA_m9^XS8a6~jXl#=-{E_nU`ibCOgOSraHz^IJ*{(@QgA32{h|-c zY8`CZX0SY8-dAxP%Dh^+hGVcP=eNBYzUJ>JvHso{<@&IvOw`#D$ugQA`v3Z7RcTETS6;hzH%1hDk2?`&dF*jAE$AzgW1+%V#_gg&G>_%^U06)ifAM; zc9qH#hS_?oGg_3&u&Ts)+vewulkr8TE`&q1D#Leb^^^lY#N-hs z8f#WJEE_^SvhkFXYE=4roMIH753eXwx+xFI^1O_eeQNGh!s$YO8x1f9Mmq?>AxKwO z49|Laxil#MJU{M9QR{P)#O{K_M{g zx>ur5Pp;Ko&P!nVgDwj?C=#W6&7R=I|J3)+W=)R-vVayd#=K!c^dhQJUvm}8@`Y^O zWi>w0vQ_4n8){P3-sQF2I|jnk3;n!wh!Vo9vS1vPxI_NC@7TH{jixkK0jUn`k-nm+ zzK*KCg&G6Nd(Iwtoktlk`huBuixpl`19@{=?d)o@Ny`RJdl_Il+fK$MUD7LI+J(=n zyA1J1pJ%pctP0_xM6G3r5kAx{%oNcNUkwYX+a4qQXl_V_r(d$FZTL{HYYKny!!E~> z7&D|X?!2!j5F@zOVHGs#2roJ9I@!#bqm; zNIX@TYR+seY-9a)(a+Kcr16iT#%tZ?(G&U9UW^yYd`y7}pRc5R8N0L#SOszkR@C(%(X~{~kWTxOxH8lbYv6hk?EVtgs**I0< z@0x3hykE|bi1nc5$00wg!A(J$*7XVXENw3nW>P=Fu2m-Vxgx%?V(-zT&=W+zp~lQqnorPX|qx4s%O7H%pBcAmm2my z$l?8hg%8K?m43_2b9t&A#Y=LY+xO9UX1UE${cB}6?tH!rW)tEC_z~bss>Ds-KY@3l zOVz+fEiwf>(B>f<{)t1B0)_q~!e(*#)W@*6=Tl?L1AHGwaV~My!nKqf$--z({T~%; zl^UFnhyF-^~z;q_=PUU@~UBhCng zMINETMSTu@MW>Q#sq07zw_3`?68Se~(&=k@?1Om~(3L|~9D&~Jn0w%#88qRq;iX*4yFTHwFGLvt3zvFvs&rH`*qOb=Dk*N)-@xE@9AI^3@Z2X;3 z49ZA8tdP(8NEL%HxJfB^!#5v{5iin85?&ZW@nY&pCyRw0+F{R_6j}=G%+c0Vu%V&d zCj0Bu)R@K@UvDMLRqeWMvWul@%zL?eE$I%Kb^4+5Wx4Eb#-Wb)`MrufdKe7kk=cpY zHCF2-LZu2^kb-!&)U{uya?hU^|GUpJ2|S6lYKWA?OU1ii#6OOBq_hRchV}Y~2O-Q{ z_BD~@Dfb24q|mbF*WT*GW_D59ij$aa6O68QXZ3T^GWyEp^ z@NH?Mrm;PS9Zn|Gqd(&?E?*Cz**r;atwgv~ScIjO&Au9~+`!33e8H?w%7(M{0DbgQ zv>>k?CeZa)O%+RQQO3xf{uJT`chr9dT7Uwjj)R!u7^F7C@@ zi-gKyt;1BX51FN_sve5l>oNp-*=b%pau9#vDTtu`P5&&dgg}L3EW|;g_Jt}j>s4+w z6*Rm7zFLX4O+myBk#$q0qaAqS6lCaJwHFv%b*$0y){so?`F<@b>^f{Vke;PmUqfA_ zVu7WoQ{=!#$E&1nzj9&lSaEz4~>} zsLf1o15J_sF4XtJR6FtxcMQGkzv?6j{LXp~jVb|19HiY$xfcXe?QeMh!so2mHU}q} zzSA6S^|6%ep-O}o&6Zmn)WOOlia$jf;kNmP?mMB6-p_r{fN8ndJHgD9vvJO;e()QA zp2BPj%g_Jt{`LMRq2=*#3dMWV{sGtzouOeXEbkrbcADJWd~}yw#l}k3=5?(V2i*e% zRd_77Bg0!jCjwIksg@0&QE+cXM_LbHr@Us(3@e-zEW<=|6~sAHSu7tm95u0heKo?0 zJ$zI)_m5kyGIA}|l2Yq=gXz?W)khhshwyCw&{|OsBx#ZBxKc^|l^l+Iu*^fX{X;p1 z=t<~P-b0A`1<_+POQpW9Uhy~W;1{*-C(I1a!7lm{vU{d4J_#p(H7;-y#Y*YY2T_!( z@>%FrA_5B1sD&^>`F1!W9g2^l#6K0B>B~w~yeC1_BU{0~);>V(Do>+`rI zvsqvOeM6emao*+rueiEfmhyz#t!OvMBjw$cmTcMvNd!-s`^%V!mec69p`&cUy?lw% zXlcsRg2$2{8InWM1nRV+TqA&%u;swfXC_zlhaG}>%z4W41*Gp>T$81mU0ww_Qe2YB zd}fVHQ~Xg}MTZ+>0cThewN167Nvn~6u2>y?xJIgT_VYsX_qrU@H^oK_wfCDx;2SOR zIZu+Q^u&s?AI=75tsm#+viPchmc%+>7K-K$TH;!j=qQq0!P9D$CvUY8trFSBV;0nJ=R&$w2V&n#Ja#FHNx@k{(LUOF<)OcXgTl#Sy4N#Ov%H=S0}%6fNGX{XpLvmvxT7|Eo$@qdiLmFtrL9q?PsOhF%b`;=6#Xiy zfR(9zP|AqNqK!k+C-=RH!5it1=9usHH6^md#g*j^)^zr2C^}`@GiHnE_cTh@-2{=r zqBbtr=b1YKY$VUvKBahV%H$&_F=3y}-H(-m14GyB-D1!7j+`5m4j-IC;4Q^YEF$0yxN$~q$kJat4tK{J< zec2dUHPoui*Yt5$OH=Vl=3K8Oxpt#Tyy^KJBmJsaXe$~@@^czIu7*;mIBj|-)M|8p z%5`4j8;}_A(=aBB`RZ{RKJ*hHRqnJuxLs2(Z#tfI9uKmet-2M_@<+2@Q zePVV$NQ;BA(pk#qdy^JnE0N*S-=5Re*w$Q8K8#2Dik1r?hxva1?*0dD)W5KbZ>U-b zu+h-L+|J3?;a@0Q2y5UQk={QaT48-Fa{~u+dLdgYBS^QEzNzCIm!6=bAp{Le$^nAF zVc+!MF6dd_u9TdNtyM|cAvADo9PA)=2;@`WPTbhs)Xa&Lot2q^lNH1T(U*WgEX@rC zZQf`FAxdx45c&taOV13ce+OdadaE1N^_03H)!&{%UuE>|AXsK2h!4!2-2Z7-a(9HdLBhtw_6@SEXl!Z@sTk-^N+k&4 zOEiWMEy}$y5khM6ky8Cz4brIOY-eX>Z2jg+rZ=>%+8dNv3&aGesrTkI$V}h9>`ec* z{|&ON1!9LV&9Sj_LJ0R*xENTt-p(LGtdR119L!8_FkCiH4hRz&3m1p>o0qiMKoGJ+ zNRhsOi*bUuAm=RX>1dWI~WdhIB)C@gPz2HY#K$5Y{{{NYz751_&7=)7u*TPb=h{iIstk znd8kM4u}FPGdlwt(?7R^%$oTh)&CJ^VFN)71F=DbA)e7<1`rnqJH#W*OmFM(-}8F2mK73(5U+E9AXOS6{$zoWF}}63LFUfE#SS3= z{I@hj8-gR(;($!!U!H(02nWPq2vH(4qz~d(Er>D$Co{xdOc2a3h=G%XlM90WW#?dE zf-osUyuu9Pf>;Uh81uip#LNysbwdaRS(%v`-dflo5M|akW>1J`{wr1>d*iFxKT-5w zB`W_J{lC}^|4)cwHYT?J#1m`BFIfZ#pa-9Nhj&;p`nP70h3ZKIbgl%fNxJt^5S9s^j^YKsWAs#L7U4T$0V==0f1y>ai^#BZ zd4_GMz2JLUsf_LzDRzc)V>ibg*#UN&&SA60UAAW4GmCVTz8LL^hkP#KCnO`Bk(M(L zkAPaaMW_FJQvcs%y8q5uZ^;UhV*g)KoQMsCIPfha{dXdx7yox^H`0fsSxDM@1MI)u z?X60JvaO1Z`5V_D=|7?MpQ-mhs-gZH%MPLZpL*;SsbaU3W%_BpA+iUcFvV-Md`XOvh|@MmxA2cQRN_2N&VV1Ch-* zHWYldOnI8@OE(b%&sJiWy3DS-zpQBCaR@vpiFdV`4Hb2-cNFUiifc#2@|f?p8kh6G zG^@a&?S=5%)`6oA4l6r$d%{nyau{AZnKCvQN{u;O6<6d z_QnQxgxq%EuGBZ;aoXTsDjB(OOaMFk3opdgGjvc}Jo?Zp|aa;GhSqmVF0m#5#Bp z;$fISrtfKf5?gz>5$m^Mh9Fd=bv`2>mw>IiDSI(2)xPcni!Xflqt2k+s9n@v)oWvV zE}dC?S-$Zk|}q_uK}%F~B9ixODx^QZbd)sjR> zAAu}5-R=AgUp(#KAF(zf9ilglcqo^m)Oq*I8(7f=5E3xa3tCskM9j2v*O^I$47U73il+1S^yXrpt&r>*22RxXc(1gd-*te<0I~(M}kf5oyM-=R}zy z@yH;|O^b$w!7cdvJQWrD4%;jzfO4e@ooraZAo<&OP$Urt%}8ecaEc?}{OfzSL9`p=zASn+p6q5{KG7hs^tv{q_%O;iVKsjK zQr(I=_r(t%oCUK8^#hrTz-(ZenN`v~OH;su&K|E(8T*KPKAf7eng<|nE*oju$FP{h{I zV=?`P`}zp$?n}~U_zjmpA?3ShyV_U>Obf~1iSw}*$v9%hPv$2c-J<8wXor0cBg6ypEycmL}VW=9!2?vtps2f!AhuC{? zn_*WE`|Oj8W@RI<(4qx!l7El)YcoGAo?mo4oY#k@2xLfhI4CRacz@RkyWZ8#wQIwDU>rJ)7|e&k1jw zEgz-fF1Qu6^KtTx2JVl$&=}v#*Tncm#Kx8O%$<}Iw#j1g6XD~B6cvIG1%TYSL7qj^ zDTB6$fj_GJ8si&}6E#~=E~>K}eq&2S7if_aSRVB?yx76s0YBFqkCYoFs= zlnO7LTcn9^Wxfx07=-5_Id&ng1$Dw=-=TY9mSSEp>4g)cpHDwMQV#M_6?H{*26Q5M zpO?Iu6$9n-ffv~L%=ra=bMd{>nex|rr9Fw-UEl;dzG%p}{@y_T9xgt{W!K4K;RTw+ zeeZj&-xCN*gen z%aLB^-QDvP=!jP5=;m_N5RWrXc%E^E>mDB4?GNz>1z_+z@v^S_pT5dmPDZuxjbZK3~Pc1OG+~WIDQA z>!IJm9RLrT=+?C6bdkmgCM_(4KvHa}cxK}HuqCi;DfpTkfl9PB@Xgb$lOIzy_Xp-s zFaEZI`vX{)JP#~*d-SSPLM-}BQD`iHi5vAWwBnf)GT_`uB~M#ojPai@DK_?I=iTjD zf<90-i$inAE1u6e)a)tPWkk|TFO-yQ?gM(FC5<*r*#03PS7|S3;si*oJiXH{3}rs2 z6WiTgWO1(Wnlsz4q~;reDeGT);SYeIz#G_r0tSw#Pvb)3$R{?Zx%*I>dw8N@ZWXSv zhm>lvwX}^k4#pg9EcTwhRN}2=Rk{yLb<14Mp8BM$fC9#spucEUaKL-<*PkLo2qfxt z9Lic!+p{yQDJ8J6xUq|x90^1r7l7ySP^_=W$GidO&Nw`6tnH2D2sDLJj>%2V-@ty}vwO zjQjL|;HP`VN?HjS;K#KM;;zh`-E-hP(P@EeWQnAE?Yjd0Xmf0FQamjUMHBCjP$uW* zln2OXB#4QXW!#gX@ZLM;tz9On}GxuiKv;!eM=@&d$$6QUk0)G7-1IUpxnS4YavET-+Pu zt6B0*mX}pBQ=vPHJ*Wb0%}6BI3BK%J5#pdDE|1T!4(nGHb+x)u!B$-pqLC(`J95QI zu}F{!U~Wke#ma|m^ZtGhe~eu{*oVyAVfK!kS+4(rNt5m81P^%IK9(}y9f3KfJtsb6 zNU(3+<`5=A;`ZoByR)e)85gHcSnVeXabGSX+n*qsV5Z`66bm7#GPs6Zi#T103tIC| z|1DZU<{F{^yHL5sB@!5ZSj3qCo|G~&Ibu9qJd)D`gsk(7LlpnA5kT4$Ye_WtG&!VL zxCJQm9J|8Q>^T8d3U_ew@s_4nCc;C|dI69tK9z%?m6MbOMRCyY8T#d?Ohk@t4xs880Od{vj?Dn13EX- zCya^_vd`3Lw4R>k+x^qmiqLm9`tnGiaA}M}CxAE{1L%8e_u93*isF^VMam7vG{zz@ zD@a+>D-M$Z?Vwi%u>Q3Ftoa84t3F+&Pt2^)G^40Ra?*k5PbQjcR3txsD-Y*(Vk!n% z06;-{iwiY8%Hviig_)BhDK)p1NsZCubftV!_W?-5nCRmlKP*5Li4Tube%}r6I-=k3 zUJkA%1YC~S91dPV{x;B!g?wb7M+xA@ogeMqMz%84qXlT;&JTBg2C}o%WPzQLD~$C} z0Ofe<{oTgM6-IinfFV5fU)_qpB&M1aun01pk)9ve2Z+rCd7#1v++k))26G`_v5fb2 zTLDd&$43Nk0GY^6Oyi^7(!fRBlpXK5!bj1XrFVM^9kXFA_QnIvRQyDh`U+R4)>&0PHkcM*{MhuCoI9 zjMv`-`ApW=ke?#JF}Qb>01}onXuzx9`YCdT;kqsIQzG~l&n*V*isu#r?qWJK1-|rk zli=Mk0#{Ae=>WcZ>-0dMvF>!_r)cmR%NYUCXQZ0|xqY`ij0Kd^X9I{t7I377e zZ=DlBj!bB{P6ZIdtBFX#(qJ(DgWOOHvoX{rRV?OYSL;B~`lA0^y(s^ANkc%X2HzbjtH?DX7W| zZdK&jqv{+q>mutEJvB{YD>%!8BE zQu%a=byVI?fptvYCWyu#2jlkh0}^2OynP0}65Oe!@`i;|J?D7=DG@BYHEk#<0W91j zKNL&~Q?Un!6H@m;U>5QbHu<7rX|ZZ^>M8l6qB-RRYHB6qHWQe5w6;a?0M(}XXECJ| zmQO4^vI{Bd?_wsWlM}oJ7j~}}P1&xgjkD!%n2leFU0k3a=W6QT&x^5L%MJ1s905Fz zN!YGk2S*idI6RK46FTHr*Yc0F2Ul~C7=Qf9Hb0PKyB14(U>sa6I-={ifg4=SOYJH? zk{R?7Td+0%4&j5SruHV)X6h<`!9Cy;?-0euN%*;xneC<`!JA9~3nk zFl2L1s3T7xDmogk>A;*ntMO*2`8Wuq_DriQrt*xdqom>%U)bz*Ih(ulyrPa#xS{H} zfj3?&JmOC9POl50_6)6qqxSUUJMwu*uvKs&>2P5*zLj_Jt83dwSt}@QqiTz=hyvB-GT(?k4@x-3Yov#D z0U4{IEVY74)) zS#{36jUwH%lOdJ46lzM1;dMh)S`rJ09%~MRNfT-Gg-wjPR?PG*p>;tCDDty%3owH_ zQ=+#MX(Rbo4AxhK4|_TfBD@JBMKhTqT_x#!h5r@JB#oc_MhF|@Y|RK7F|V_jtyTaP z&hu#q6+zhMMOF_rSQ{|QUzMT~K;y#?`iEGM(5{>VloK`TAXJ#lw-Tsd*R&9;V;Lh1 z(omPLQUU+qRpARpdKP%H-;K2 zq;L$DDbQc&{cMnKKUlYSoO(sTLKQI)QmB+9N|Ge0kx&P3{8#_|cST6>KMWf^43m1R z`|B1th+SBDywO^srqHHK_}E8zPM!JJglLF9ye z>Zyr1O-)5%)|rG-Dka6D9E$B91(7Bf3HAy4gYpK;&Es-r!_9yAExsMSVxHj$WCOf` z?%6`ClmaAxXM#Q5*jJ2k{=bVMu`f`2Bm%y0U*PV20S~m_JV_=`p*xVSP{(zVhn{@d z>26;U_F@EHVXxS?GGSlfa+>^n(DpgNuc&)X0$tD#4KFOO1P_F-huykU)fZi5F?YVO zSBUGn2Zk@nU>z6_jH+yKyY8Oaqc7^6sh=*?Q@c;$E7vpPtK9X_GyeqRWp=QqFY?$U z#(2Fz*tyc#Ju;*QflrRs>1(G=z-xg`{%fF3{43`;{5bO;enh8tRYbv-A*8mrX7Fa{ zd*;X6FU3EWp5-iDAF{_!E=Z~?E;f~L)_Vdpsgr7}U;oS}(Ti~vgv;Kv=f%Xya_94exRav`z z;tNNA!p*Y+3XZzIa@Z5z>JEQ>*}NG4A<(<%>-6z>R)_TP__o$l{T?0C)!EWj@19|y zdH(~y3*qW*>qn?|(b`&1kIzW|mk;aFthtekA#2^nVo#CJen0${<*!NjE>1Z6#58z&uC5?a+sM}&EADmLot-}9YL4Q!jaP?|8E%a92Ae$xJ9}5+L$F7NW1(L;71=kX@a;F&kaH2(2D%=rbqzz^}DKQ(N?q zIbG$LobH_XwiotPKdyg-3>T9TQzs6>mVmG(7gCIdR5$TM&uGs;5@6rKc`JB%HqBjn zxL8SG{;+b{ZTUf~-`4I~d{0i9;aFz2h>Oq2{k8KFA!;toHQ#uaq+btt(H+-3wY{#+ zcsH&y?gBH|+PW^91GFXFM}K}vf#Jt){-OxHyTJ;3bIl&*^A+c>pj9HE4Mat%^wa3U2;8Slj!R5PiZ%6YlU^-->Eh3>yOFqWB}>rOA$vm+*c^%2&DO8EmyprpV6Y$xG~k z7u+7v%<5B|=45lzW ziCYOW6(JQO6$TAF8YnDCB~V0Y zOh~v8D3Nd!@&H^0=W=p<)z$adX$ASJZ52%F;LV^%)e^;pT zz0Y(cq#&OQpQ0PDwKXkHE*{=vE+4EZ#v4}g10=>K9~6@+*n`M>_q0SJUJ zupiR!1{lj12;%?K&3~`<(xl!Gt~H_miFs83Vq?Vc9m|$51n}YKA1lF+K0sbILH(dV zhm6O;uTt@|s}f)69l*CzQ8G%j*+EDCgr~x#mlbG)+{V?l>Si!5Wlgd4c>42 zKVIhA+QMXuHR5oU&R0Q^TR4HwNf{X!*n?{(5<-*XaxpXZ)mH@1OguVuryZ&}lEuAh z_U8U-i=%0$6-jHlI}m7_tI{0pAS>r?;-hn&hR?9@O6ykXpHLrP{C;+Dr0zD>r=H!- z(X~>elGWp$vr>ZhnYVfKDtH*qXl+{EyE;QVexzP@<6)zgD_4Yd%dLNE)?cPA5ks_~ z1D2v+%9i6=*>W#Y*F>IVLAGZ5pj})`ls@}%+(>(%ks3>KqC28I{?ZlU24W8#Ck1%c z;H%$=9*7>4sr-#-mx78eQL*Qx5>*hjl1q-k!qUk`h6?2?L!sJ*!bcQ`zjeY@it?nr zTy!SX0OpohU&`XiJ+td@tD>=SUQY!j;rTHOkDMZ~jBi)(2Q?xY!Fll({G9iyy=Ejy z!kzH;&xmBwqyZAS!waSGmqObn7+9k|L0jdC<@hf%^16o52^bR2&i;N!QT>|2%*w+;?{cdjJtY8Iy>0$HLNuRTGD)rvDtj`zJG6Hp% z(qV^;vV*K+_qCm}Wk=mGRp5nIO{g(a)e;dbcnT?a*~dUPk<^UD!`jIH2OR?%3$j_O zoCx+4W*fcEZ?>mYQu?VN(wry8@s^RQdDx?+()hT}m}5CY0sRH#lWb)B_L|S3nF()e z63_i+Gko+@jsP`xx5a|FmLB%%>Y~*e>JzPByPmSb^IG33YV01KOZgAK8um)QBZSWV ze1T-i+l18UzEMJ}u|A5BExIey(*56;& z=2*Y4yV3J7*E>OGdO}SnjkwLuZ==R9CI$v$i>J-a#HUxeQu$^CtbEN7aFMIC_kOpH z;O*|zt5v9T#Ly|HRvN>Nji9#cYAuh~-_cB+j6gZl*Dy$I!XB8Ol~iy&`$hwzA(ODkhF3?*P+I8H(*t;Rj>;2UB zo45CdzA6|b_)?JrFB z@Hmc|4qr?*Ic|t~RgpvSTqSKlZm>pmaQRwH7e(FVLi9M9ev>9oxwAPz+DDlVJONY1 zBn@xrn4|bV`mOQ=LTM+vp`6rXCuBHhf1`J*at;}+)-ic|q1fU(7m~c#d$I2#Rm<o2!RX#}&oSG;HIz?kHXE24(>_WRdg*VZ)*9B;|j# z)Z4p&8n2K%;kB%%WlEwWRHL7o9_9H{`aNT;bqoN+{P6tB=g#2oEp4=ae@;)mro!@B zGEJ^Difz}l;k217y~kjf?l^b&oxk+l1cRvbaxyNZ(f?@A3^gy zMNNz{N=h;`=Rj%><+*kZvY!a2#;oz(V}Nsq`FFn^sh5m#fo*c+G2wR2rsyC^Qs!* za$ZCAI0BFZlI-$E3SNET>S!BuH{?Xz5=5GERVVafL1V2a-EaxPV>CF~r!XHOe-5^L zt1FL$p)NBE}tzJ-A#nGd7+kYXRc)7iFyl z8Ol%wQXd-HS`7^OusiRc%K7XIXtUKc6Kc#S;IAwZN3gA{K=De>1h+j*`Ejy6AoSqy zF8_x+XicUy%o*o2>pT^T2)LdNW*!0Wgbk9{H*?D#Ty_FUj&-e^#s3Uk?unSiVT28+ zc2`y^PADLxrO-VD2Z-4k#_Uyk?#<{KhUbrFcB-|rB!CAjCT?y z=1`%F`i%9#%V(zD2lun-$`|Br-)~UjrOc+L1duhMj*Hbb(fmWIcC2h;;v9)0hO2+ke+txIG7MWwUCzNhoKC->vFWyX%OI53n%J)#!;#Dm zczFE~|Ma_U4YAuqH2MLY6siz4>d-tqGq#-unFLM}ng`vMHu_TrZCqx6pBDPLMuDcR zJCrA|aVWrHoDzD4(yB@kN6K$r=qx4loEMt70iwfjmCZdo(rnBkkMQYHJ_|aRlOMgf zmzuf$V(ZkSyXDW*3V_|}{Zsqd*4+S;*SYRD1p3U+ z(Gf&~myc8Mrr!6t=jD%`GHiX$0=?GVMfqC&Hs1oV_8sg3(05r8E6WX~Xc6nkzrn&C zX6g)6NeuHH1R*6Oazu7;AKle^bC2AGijg}tT+S#G9f2B+$Fl4xu~wgxT`PffiLuMN&&c(xV5~ z<4YGeiMK!_FNPK8;O$)pF z#JWsvxYlcIZi8T%=c|pb23KlyL%QLb+zki({_%^rA*cLF-hPGk$JQ?i;5IdBlB#4e zP4d@l8fi6kQauTh^qhJvCt3S}P+e7LRcAK>%8nILymm>XQOM0b;;mio{zD{2|4~v2 z_;Q2}GW*hxilk7r&YBdi=x8FYII`w4A!G&_OSkqRF?ShuF!ZcwxhLnyg9J6N1FO6z zmM zR_fv1S?A@L&r2l-?loFX-K2H4Lw5QNYqf_MVX^z@I;9*28=5*?tiSU%I-IA*r}=!> zHXVLG2qa#>yVD`GHM(8NOr}xm3e>Fv}BUgM5SM(Y)J@3zgR0djky@SZdOa8A9iCvg~t38vG*A2HuxJ~8~bUkPakH!kDqLA zE_QeDQ$$l(D(|ChhY&EuuO+>^BX<@!UiI$5!AdY{EUt~)!=ynEN z>_grRV_9_{W$ZemKMm~yP&)1=!rq_bpz^AN00@^LFdR9s*rl&CPxd->-aEJ1 z%U3avyQuX8*g^QigdIf`2(&mHNHj`yWclx@psjrtH*9pQyC9j z%*yYWgF9UOHPqjrp2%VuDfbUdvz|X|P8YTpTgH`gYf~ask9!~Q-?g|Lc{uv&#B^B4 z!upK_2J=kw&`C-_h7M@74T8{crMOv?>rxkQSI5wD>d=z;?E8u?TA#w>F0;^c2y`13 z@>z>b*M(H$6~K2B=2iJ^tiFE2>nB}bRO{IO^*9m~kquPch?y%T9!l(=g;5KR~3|;h{X%@T%U7=g$h>-ucqoaBeJe4VFq< z^5e=X_pOO>$I-*!-X?fVJq%AObs0nd9k9X=*EG)OLC7l|6{VIhA%~itRsizuXx_uD zv#sCxIBxj8uG>_@Oiq%50Wn99qKEc^ozfj|-S?7pV*<>halz0jyZFn{`es$N>G@$$ z#h5s4NcN(c@W8pimp!@=#Z`6Sn|63hK8kT3`CwB<;%H&0r6ja+dUDDOYp7DL3_Sxh z?cdP0)kD$9rAi$}saZ)E<7W}&;f6WQMJQw7H3fJWiT!eF<>Rm#CgOhCnQ!v!!cbEb z&Cv;BWe{iLAAT~b$!WGXYblT4U^wdNx#<-N zotYqZc6m#k7M8nZDJyJ?OO84m5!kh$TiWfc%07=Mv!&U1B((yG%fL6*%&7_aG9@Fh zw6H4}cNoU<=|I}+&0wrjcxl2V;+*_qe;_(<){@p&J&f_Rrv*i7=)X}=7s$;sGuNVX zyE(Fu^cgbkcWgE4nr%{J`)h}rHI}^OB%Mw_zr&xySkp4)vOs51v+rj} zjK=m_!7Eh2>$257O|nrH7CeVTPMVp^Mk+*xwgdB7Gedc)@%!kL{779@^_HhY!r|Gc zHoa{0=qNV9pWH5mUU-S=p_wHx0a7~XQzo=Un{F%}GDXd= z^L)D>fxF;o8uXmF-;{!EoFV9{Xu*TpvuQ=+s>>s)R9$Hd?3=mZoLe+5Cv6z@E7&^d zse>5*RL!Fll&Igf3PlgusXR^f`D}vKLg#Qd1!-xA zz+`VCAzGTiuVwuKDJxNHU%ec%=5Nsnkn4 zEaErXUHN4E%<6L1Zc9#+ZxNlsFYxlmboH9^X=qCC`w;XYF9uE7;pQ)?_PS0tAI&ly zbi8-R?M5LdRqJb&0OkFYk9iq|!*My;7WF01CfZ1U!oZV1!dO`@bB7VM_fBsIN8u%_ zs_y(H`bb#m_yV1w^bF=P=d0g0W|M7jI=wGtJ^D>Go#}^7Ch`KMZ;-Un%`<;JVxOAO=RD>Xp?S!n9g#)NG%`*U1FZN!?JW%Mb&^H#=^>` zsP^ujV&>`ILhP8mYb!%*6KT}7$}Cf}DlIyZ6zdr~bAgmaDj_Yc6c_XQB)XE#J4IXZ z>HT1Na+u<4XK1g`y&m;~h;S=wRvlxn880`5X!2km{gA_i1yX284DdyL=X=w%+ z7mGZykh*PXkOjvLR#s$WXm(_uMveUSR5b_VBO?aj`#?k3?>UR*^LwLU!ei_uNS6y%NerIFoXJ_ zPQQd)U2tZvO<2dg`zNDgIDeg*Fs`!+MhSvb(i#pq-n&BeqC@*FJw(4v?v+hqtfYPw zbYAF^)Bf6!IIc%4{G(@|TFU9U-wa~t%=6ONhBS58rH zv>IrlnUqH8(o|~QoLAe_&7n7K<>V}x+@3!ucxWg}hV{J|;{ISq%Dm~;sa{{-I*QjU zJz6Z&{rTEj&kW_wgn6lmWrdiGXvNi8pV4c~m@kLnrz31woZP;~V^)A3;4O!fIa;4O zYpS5=QOd?Vmr`M5Y-(&Xo80^-WOwZ8H@qUM$cOoP04rY}B^8pAAa>rU?G1e*(prEg zU6NW>xat(wR4A!8-rQ~^jASa8z8-wXVE(T)*(>fu!!67e!>QD%*q^UC*pyuG+M4|4 zVzuXmIeG`r--b_#Gr46JY*<87#V`t1zn_@Y{jskL4ybnBPr+UG_mDRl8>Zv{Ve}qX zZD_2u61SUG?P#oZGP48v<27}Ao?TtX)eZdOy2G3E!$2#!Z|7|JR1-1vV5Tp-hCcT4 z_#5b2VoTVTsU5MFXH<{QnI8qGoivh3@dV5sNJx99oF*1S$B$XEX1~MEfzotzh9c5$ zJvEN+AB*c%V&iCL4eNa7W;(JqK1TyRrrN}cdKwi8%l37ZC-lzy&#k@ziXn-)ggDiP zy-H66CvY<%PkQ+VN#-^kN2gP6n)D29B})gfTMKKdy`JS<0T5POl+x#&p^$@zE5nif zgKRvlgCsm1SXsQ~#e7v9s?(i4jCpP*7CWojoSD2E1M=%u%zbjBBrX=u55_DW7&>E_ z0jC}JUM#dsb7>-FjPb#B`MlLpS+BL@&8Knl$|T=6#oOqmYU^yIC`ZU^r6~@@?~faP z$*H`^=}3=`9?h0HYOh;UbT$MmNVDlD21z%cx|;%%el z&~_EFxfbO>Yo?`pKK7&4DGZzV7j0RnR4>ukXvof;>`kQsAT3P}!7aLiMyLCRW+PG>adhqcM!otXQu~7)PE`L+AJVH0B=i&x zhf%bw7rYthkA`;eI%18t`F>C?sQ*4hp%UPbC()YZLqO4nA z4D7>Em)KS=WeId`ifg%9v88_$IW5{T?~lImllr*px9XFU<}fylYY&~abmUtan|t_> zWG^=qla@BHO_d!G^UPB%j)lqJK8R)0v(L?KWkni`Zqb}LL`-DwwF!NkLVHdY4LFhs zE*0QaXQ~@8&88NyZh+;@F=Xlm&tEm_imXY`1uqIYdwXG?#_YTZwl6hODpO~BaKUGZ zWF=3smiCUOzLBW1jLJ#VvPPkt;k`||6iL*5GqRXq-n33blA3T{WK{61W6B;wm}0=F=n-9xpBnav#=)bO)=1N%&zO3ofQ4uw z+3a?LuqdR3t80RPS~pAMwH{HTee*KMRPmlB?nCiBrAvtEHX4dzV7grv zsf=At#2J${E)U=AV66xEw*Z+ZL=RHnm=_Qd6(QdCozQS1=3>D*{hb&oFGd7ld{-G- z7ATy~OX!=NR>b7@A#DifLMvCGN!iGtFEb5RC?nK=VhLAb03 zb%VL2Fgg|~bWNCmG+-+|P_31Qh_sE!sOM3I?|kvOwbItn7CUpA7lEU7O_`l_x)o#b zj2{qFUV_H+E+~cu@83}+t;^t$F(i}3dD{CxUHCZNCCWU?-+U_>LToR@vvTpi96d!b zT5RQp1NyD#gcE*QsN5lrF5=|fO38=6+F1=yc<`0$}yg$7(tx zmmrxYdZ6<^L>=%Y;dk=OgcqX6_B3^v8A$kY!$^hkpm!n(C4IT}hUUm}X?|JpG0^`q zD{ZGk%}5Eb+X~kOw|Wh{358fxhx&;MR-7vDDIy7hl5AIFjWU63qyb|$ptCC@OhGpJ zBtcw9y{YDH12Ijs!VX*)Qe;82GKis z_jI!n>+iLvrrR=C)ROI7p|CAlxI_!E^Rzm43hp|pQZ{!SSrlbRN?ac(kGC#-%58^9^23m!gzZEx%efB2G)4o6AveeRZkKu9{vAf6neIH1-{E6FW zZE9hVZYAfRz-fE5Xi{K?MaRQEIi2P?w%YU4vt!!$=g3VlM2x{OE!%hl@n#v3#bC3> z{;KaDKM~9(^qsUY{zww!x{eUt?~nz)RceL&JT7A@Hb-T4_Y~re#W?*TF-L|A2WKlf z`D}A-TWu6RYR2&?y;}oEl&9VH*ar1e|$X z_IAFv&&SO0deafq_JcV)P^m#Iot$$Z&PjGVT*&l`C~!El)Jm6=d70$glG60(C_CI{ zrb_plhHPD-w5RpgW6#5cY@so6;oBQMFq9HW=$x83?8cqY-4RXIFDHeDYR=655|ANp z=_Z*NL`>qKfkRk`bM6^3W9DYla<5&^+H)`EYHoYEZ(`ABq+zF-!>TuHqa>n26A2uA zryLRNe}CZ}$||;i(w1z;A7Sf7n)Hc_tGJUp#72QSFz~IPbQQ+AR_#*x3{tCSv#|bI zaHjGt^9VEuEi)2Jr0iS$CYLPD! zNsau8&gv`Gt(W~a`i@Sd8h20IP3QpI^8(+1^bc_(@lqm@PL(ohk zqPwT+dN9<7h1VZ46G2F5noRZ}RkXV+yqce02w~qaCeutpR?OUWU44xtos#=XND-^U z$ht_ScMf2`VV(PZ#x-yYu4FYkD-e!V}Q;36I~l4YrEH_PE(dHen6EkpK@2AmRd{{`FsA#UZin6UyJeo=v#mvtH9 zF^B)h;dNR-C`MtfNiBZuwuXcA2$TkX4t~03`auh2%I`R#ccl-x?T&F)FI1;qBD++1 zENSI*UzQR^Q)Is+GKHM^^6rz>rJjXl{_fTILx_x}UF3sY(k{{@E7h^WZ;xwsxaR)* z@dMkBIV;a-=2KlAGcbp_fG19%!RYcD?ENJ!}o}LPEGRP z#~k(rWd+OqSgiK1tzXS+H7(e(QT7(?b^A24BeyyYW94*Tvdz{ndC3ByFhT;V&OeUB zh%jX0jY}sJK78ufx;?Xeo!nd0`kIW}->)D%c))*^)C!VVgd)e61ZDco;#>=Ax()6p z{ZfzIlFSt?iI2oxkO+y)eX$%^ClC)KJ!(S&NduI~z=)OP45OtWFfnGqy%+kMjr-OC z1##Y~_EVlKCvD8U|6vi&Ntw?l)P-DcSxxy_bx28n;DE~V4C+{}-ETN?MsgZicL=dy zshk>P0xiXH{wNGcwp)3ej1!|^$J(&*g~qDe6Jx;hOIq+Wc97Z%{4KRzT~~hC8Qx36 zjf1Z_TfGwyI#sTZP?{-BR->Nf)R`1Bcy5o&apRa$UD4#If;^sS5M{^se?TeZv|&j= z_XY(uS(aKbltpK9KHv!p1f7Bhl(nS%hew`}U|&%W&j~whZ$E8hRC87q(`IDBTrlvp zI&ac@;hY1%8`-%$tZeU12dmrglQ&Id)W|6Q(ACiGFwFk5ZsUI4Pp|KDWLoNBYm?XN zs^QYu_ruS?=yEx~+w(npy!%yOK4|vg3Vbv8Vcm9R;L1|oD@yQB^jt(!c6Ax}C;E~+ zHYhD)$Xqe9>nZo`rVCt8funx?36^T(Jm z94M6#Wi_yL2grPticoeda6m>ZEYmNdKhEAFwZxKDsF9cfV^tIuoNRVD2vPS4w_1Yg zP>s<*LLq=R3kmKL^s#xzyiDA4v&Afo9g+&=Ji8pubm~^kzBM^h=QIM5?-#_>5p-L> z7t5NgRYQ1O0|{8(436tIb!jSqA~uvXwEN)1#%^x&3KHOCe)cF5Z2pNFEx>BGko8Ei zIhy+Y&23}GBcp6_^0y=XOMf}i9$_M{62_Yg3HeZjYBv`-bOayQP@Jk>CYT9AF2(q^ z9LcP$(@bt8FD@yGPAbLJ*8*8kne_b*n{=U-N@R`%f+eo6f^&+htUwFJSbSiNyIJyu zrOX%gDG_TV!IkH1s656!)DJ$iGbvPw`s6PJvNq?3*!Cw81B+272=}uToL>ig#fs6b zs||{gv1qRT%4q3)t~N(bhWv9r@JxH6+< zL4r_}dTWZk+{HD@l~{sRvqDdxFv_RF@J6$u2nC~AP>zj{p(Et#7`TSZGjH%^Zhv0* zIkzbD>loH!r*#ikyc<77qqwN_Px{^>5z0ZB=IR~No%ht(e)aa!0WxXW%s6_{6l)0N z(*$j*V50(KOANH^V~c%8Y6=Ir!)g#p~v8-*m3i4cAQk zq})WfJMX{Sw?v4fi;A>Gm{tx_a*o_Rj&zLcxQ^jOPgl36 zor8PX%j+EBgtk<~MyamOU=GdgxD7KEq4~giln!xEK-TJceJ~gI$Q**^D0QhOFDr`k zVY{(;^ym>64(U%B8TdfZLG;z;_k1yy%!sKy7Mc{)9`Q=~urDQRDf@@jIE0jbkk8zu zmJXx!=qD8Va=J`u-vExuq5$%?@2)qp-^gUfKqM*R&396%6ry$P)ZOt0gugU3?k_Jib&Idh!T80F zaLE0|?QhLqg1H5D-Bau?i0y3|{L$)QC58nIW&O33pajZ?j-5}unxgUMf~g)R3c}l; zC1j(9=z(LpWbJ_x9&JSk=?CUSoF)=5`InW?>Z8f()X2Vy5f6@O4y62PA_dT$RipGv zaMqnyjtsIUjt$-*c_`cYpnhzp1y`#|4!XdkBR2v|O#^G^h8?VwcgD^KfRAdMc}aBL z^DUh6O3G0Z{2Dk<9?HG)Ny9-zXGpp#X~}H^Qxqwj^%8s!&&qH;iRi2Lf1a(nQ`ZlZ z2+Q49*D0mwF%mbK>U^rPe4o}{@FtN~=*!3{W3fKaxX{Mv`17S^ZMX z!W&I`?&uv2xZCLp!y0{@hs~ez>?UZ|z5|&kiH;LuZ7T-24XoWmA!OYn0bHB|!&xb3 zK%2z|JpW6N!RR(~td5}hKohYLr&`TCA?za@A4!h;@L>gcC+ZKOU2xI)|HN)sI0635 zzd1(#PlB1qe-X?8`po|+UIwt5{>n?NT>r1}GHy-==6?cE|7w@9a|19gb|S8S*P;Ha zT=tjC`By&YFC_IpTKGTZvcDbiU*xj?-rWBHfc}4gmH~Jy1`cL`c?Hm{{-R}UtPI?2 z?5xZHCySKa_vKM*v)R{&;=4FH<`gZN?t4B$U&|7)qS0xAW7W^By=Ec;K; zjEjq#frE{U?Jr{X*E9n#V@yn}+yLV1AEp@#JHtOoJ2n=8gT@YU*8W!TAD;qDFu=@V zX9qOw-%K+A^2W^h7ZqdUWMTjiXn+p-&*Cfq>5Yw>g&9zoixXfnu>#;XKv`xYHb5)c z|4v;%r~O+IB2Iu$22k1l%MSk54QL1(U{(SK1fZJ%(7k`zKQn+_(`97?4B20$3?Q5_ z1MD)uCg7M^SpogX!35Cg{^M`}d-yx1Y=A-F0Q4RQ5hpVnK<)cGEgHGyo090x;<~h?u$90VEn=g8e&*Mg-`uzt|ktKPQd;|0L4>VtM~3 zL>e>ezcN+&Df0FqOh{qRxdRjK$iNVCB*Y~^QK{kqi_MTkOwviw!r^qz@7Z4VBy0e0yR&@t#2+C%lb#{DxzlTQZIxkse9?I( z^JUP**TKC$+8AHvV-av5g&xB*&NjES!Z{C@t7SYe3+i!By1Y#DDcJ~c!Y;gUwePk0 zb=n}`Hp67G9%5X^1V%15Z+0aNu8P7WPE7@#CI^$vYz&iq3jsD&0wSzhBnmU77St+d zV>*r!%1t`R0c^~RM3FMPNu;VF2i_?=sS^C1UG?w`hGUxBG@ys|!icGt;iphTs5%x$ zsBumGiMK2r29te6*$s!V7v3N4Dff19Q;JcwS-IQ=ERBAkuq$i$k)5u%TM`ykUuT%= zc_>Cp`#E=5bZB0gX8Hy!@M-kb`iq)Fu+26*7xv*REdh#d^$ft}{mz0CC#;OB!!K~< zneDazdHVQk?EP=n*8f;4|A&?K-xt;YQzq^2|H^-3(*91be_7{Q|4!k5JC=WE(pcC4 zE5rXilg7cq1;8PR0Gy$cb2vIYz zIH|xuY8-N45@2i+Bel@)x@aWP@}xBDdvw;cX&?>3pv@JvL?O{!qCj>nx?nvk(Co*b zGnF7?alPlyz1LfOzcpy>`37pI_H+dpxw~ZXO%F7?KekHyN-Od8(Pcc4mD8Wne^V^FO;d z<7pUM%KPMaLd@)R?DhV3w($p|CI?t{D9vrbqOWzZ3Hd~A`Yrc#>CsI}1Z?CuvtF^F zQ3XO$7LL7>!q{bC3*{_zgjE01er6u{nCP30LJd8#~L2kUSQJ|}bsuQ-_WNM2sN z#*qF-@h3Wx^y}4jDc9IoS@UpdkOd~Uaev(7nK;FIqjCMS#J$vHgHrwGH`>eBioP;c zTTo|a2s&~8_|@sf?sgg>c?s5e0rEXRqSqryVqQE59>obMd$@5MGp0W`r>*v^?l)VRlXqPSw~Ds1H^W0;&YxS#e)GV>iH>TJ448I zA6m9zIk%Td?0mb2^F@7~9W_Vs>lZ3N>w~Yu>+GdP>j&EwLQXF#@^QCXs`{SBk45us z%c~h9mEev$o*${V98Ix}nI#Nmg|9OV@i=~`mhB6OC4@|UYb+8EZAY+uy1yO0&7HFf zm}BJ=!%gJ$qR^#cWMgD0!Mgm_()0y8r(S@otTK8*1T}JU$FT?NlXDVhJ5Y1Cm>qwD zV~$oI;pwc-H-4U`r-wzPvfd+1nMjY8pa0IqbRCY4dQ-^qG+;*ER?>D{!3-Zq!B@hi zp>-_Qtgz*o8IEOWhDoQV0|w8Gz^)jkixmN%5r;p2w9SJ3w1+>yzl`X;AT(>99P*_T z#;;Y=3kBqEP}txuiMBnPDXzqltv=QI>CCRHyW-#KlbYUPsuraMMxXzdE zrqRTIVnk>%tzGnL?ijA~v=m`p$Enejm@6U6)ETPE6}AwN@s{O5l(jze0hKJz;4dTc z9{N_9-!?fbu=M_@_Z6e4PE_*KoR8Ri2l`?Vc8{%YJ($Aw7p;^S^VP6Q%}87<59(TD z_RO)CM6q!V=GZ!iKgrfeg)8CH+!G7kF9fnkvP)LF5t&1IgO+6ECfAnOg!=fcI~K=L!FW3 zSon-4aCRzR<1h8f9h+p$r|a0>iQ(c8{ev$}iWkXQcs&pWkz@^O)O%EjmI9aJI;DHg z!&z~w#1PTQEK_{axTTk(Ajevh%Gai;zo*fDx_ByzHEe>qBl;;sq|%o>Rpm+(}Mt0lP|D zuZF|NbcYtbONiKAFD>C~hhO}9+NcOS`ensj43i`>u7)b&*;tG}%ycO1F`i?l_LLjq zn()v@hAj4IZ(Cl31D297vPc$8Jt)d^DKW<$@9ez-PYXZv{OibQw$kLx3R&cCsa#H% z;>K&`6sbq#^yMJsaGtqWy8FAwy4OD1U%~IKWSbuoI93hbZ-WY0{CVbs)79y5bw21f znoWEelD*1Qc6V|XvHT&_?_E5Ze`gWwaR;c1xm>`u#JunsL5Gke^5Hz@O& zzI>H%ChU| zN2&L<>iL=NK;IVMU|_Frvt`e3TD^C=8CQPeTHV%eZWgBUoi9w+G(fd+lkxeUPjQ&d zEcHM-EoX?vD{qy;ClgaQe7tB+C6}Y4eT8vC{tlO04V!#?kZUsaGq_lrCyT&@W3m~S zQhvtS?w$M2ShiVnSeP_oKVB4eaqGKN%PkX~K>`NU@9=XET)JV} zVywze+rdAFRD6RYUez8rW*SVjcw#gU;Z#E|MmasKyi==j>AazaHlbHyCeq^4RqynB zEAg1b_ag5&y#s^^sL1P9!Ei;#BE0y^{9rx-i zktQ8$wejkDZHPyuB+)<~MR|;pA9EXvgqw9`n9FnvHnqd*k6pa#Z`-6c3RITE3nhWy zYjS0W9TTlSUSIE&lFrC4hlit7f&?*2!E7#wbmoVvy4$sK{3Lx%Pa zU0AFD4c)KvmGJsdaylbuS*CIC}z#C<9OVz7p)DKxZ za!Do4&)qE8ajRx*D()(6Y3%IwRjc7xTUttU(lx&@Wj$u+{ian`myEE|^GegX)PMIH zm*XIzj;J;Ix-={lzbW7xDoea-6yyDJ*1=&^l1;XbQ7@=ak@YQwwZWCCissfcQ8P_y zs-R%ug^f#6rjuwmkab;Vj~?_jLNhfUOO$}th0D8hbHd1YNzNPUgcKm}De=y(^OZA` zc9PM_rsSQVj4tCTf7zjX7&6D9pkgVz)sFVnFu`#Hh&2>%m1BIwy?j8 z)vZyMp~0T&e8#>x*yu!KkwVL#CeVnmhIvvF~+naYi2TYSu@M;Y%mDAt6E<5P%=Npet23jCi-iUFI$-}So5{)Hh%I( z98H~lHR9y*?NPv`bE}fW7d{{8cx*!x{Ao>7^<=vr)$z85Pxyi3`@;MKuCMCPIO>|0ZWEdiH*{5%565Fu zZ{J3l>ovF5@_Wyo5ueuM%|msC`~$mTTqBEuDYq-e<^0)(68A_&vJZz&o8V8g{aiB> z3XLjqc=e(l`f5vc*r(&XbJ#Rr{1}=vG;EqNw4sy3qFmQ$tvWS{ce&G#Caef=ouAhG zm25hpI%iFqad7jfS?N!>j4+nvkJYgk#}gvqGi>zsXr7Eq7&M8{B zYfyvgi;7mN(%V&7S0Gq!Q!6Z8*;*zuj$-1R$y7}fl~_bLZ!{Q2<)u-KF=6NS4H!{_GI|YECr@LPNTBzEY4eeiIxggujJc0+!Z!M5Uux!e%y&J1p_Zsp(qm@{dg z0$$7O$UQ5yFS;rrDA55@xmK@qsm!UE@=lmnmwv29@DWxd&sw2yfp3r@QBY>D0)fmD z#h1^M)0f>6Yr%5&p3pmUK2tceDjumNds}%dzmEFKiM2hS)b5aI;nB)-?NHwG&Z5jr zz(JjiVT8$sht7V)MY6q8#hUan2fu%L(5uUr96q?Bky1iw9|hwvkc4?9F%H|&-1kYF zzELhUhHhz3d#UBu>&S7Zp@0&n0a@6Yb*CO6M9t7eqGtDkxpf?6JQy=f00@VodRJw^ zF^5jJfVR-waV;==!A+R`uinlxs;O-413|$QjMWrZ+NRcvhB4DG15^6+>K%__u@#Fhr_(u_8?wNsyDgKqA;270oyAJ&)YKBUWUFx-|TmE;tnSG#zbP zK)Um)Yon%Q18cFxe|Z_ZF*}^SryA~;9jA8P;OWFAR*qAqYLS}}qjy4E$hW;7|H`>6 zW!NXF8%W4&{DjAhy=OB@Cbe9bJ+{(nF5TsHH^%^z3y1H!`ExB9_4m z3l^UyYf;RX<*f!w>~zp>18Qmh)rCDspg4sDidu*=4Qhgt;l}J7m(;d+?wQuNnxh4O zeIQuP;N}exeAOEgH}`0H{8INAH_I~1Bh3^AT{iW)?_~p9M6I(S}aQn1$s7Js>$YDn(@HJ z=Urj<`ryf*hv!4W>7s?vrlO{S#)d#>M-JfUHZ8-;kt_kS0k8nM_0#(IE1ie6#obIb-Qm#M>;ZiiHML{5tW(qOK2&TKyCWIP z4e_cPsu6XX&ovQa(bv?sEXf}D+{H29yBwCK*Ms5gz*d4!Ln>R@GvwhT-Q2(SDk zKOB5ldN9jLze2vmx>Rhy;B`rIIi;yK_&k39%icVC}rm}GHhJ27=cY4&L__N)$pexs^a`5dr*77f&ShFhS zS!+;#Vt%t0P2ciP$p20IHotINyizci%zg2B=Im{a_0VjkxmP-daQ9PnI7i%99pb!9 zLuiYTbgBs6gqi&#&9f+-qFILwz0DyZQRK_*hgerf5lxbN3eT(iH1 zGcz3)jNbR@Y^OgLch+I9d>h!?JS>C>j46^aSdVCkuPG|jEA3yM=fQMbHT{}B|C>24 z+F(0!Nhf&2$k|6wB=yP_83W(J(>v%|bee2&tkN~@-&wi(T%Y%Unc*?oV+>DS2xtEA zg$FvzSxYyE7hJ2Mo%3V<^o3`V-@cn>IxZa{Gi)?FsnC$*m1>-%_`*!=#^Yw{5bFk? zAatSdh08-tRjEDEQ;5edsM`s-^VUN&Lo~sh7_s`|@Vy@SzSLLlE|zau%H{f;oc$hF zoXlM1?31`?f{mM+uvLoGU*(+T2g8l`MB)5V3D;eA&%q*a_+YPOvm zs{Zb^re-P;uZ+W?$_I z3D0*OU+qUciFuCXv2}0M4t$!QLSj*RpjDWsFelKcX()@enN|HB726HTxc_(<-l--5 z8?if!d?42;v?GxHRT~v=wRUbt5Y2a|VK~eor-|`HB45NFlAqRve7A`fZ3mX?n}Aqd zw24+lDz9`-a+Tbsfk!={;nF?hz;#svb>G42QW_ZZTbuWyl-8g62^v(l*ch;}%xSsN zb<}NyUw?Of;{B}YBbRELqmUde=M7uCk|v+(jFO9)H&0DNV;;1)FUKZA`&`Mb$GX9s4k9(t zB(7K=jvDF;tQ!PfH!xw+E&M_qRKtXDJ8NH~Dlw1c$S~YvW0cyh`WQ)Ar$sm<-QwDZ&$g4yA`C3pMyY0<7 zbg6+(MJDN*k3+noJ2c?xMCWy#!_I z&RrJ)RxZV85Md!GE%f;N8(vfTE6jY&tAuO7FJ${a76a-$h@iTQ4Y7DaNKjJf_yk?h zebPyZ6m25wA~=D^y}fvtim!!#MfQ8LC=)7TurskdktF&(1v8QJ`YeWr#PlMC+{`XRA#33H8aGWJ5k49UCgYqlYVtQ~9KdgRX;dvD2fP|!Bn7Q7Vwa%j()Ol53= z3b$Ybv3(pfh$x7+U}NVV+ArZw@^bX=mo)z52knk$M}7{o5MbkE?>!Lza742#E^1f| zUpg&6vUpHpN}ie?8M$BfD#;?>f4=XapO5{U8zJ^vVV9?JMT9G>*zIo!f|Al6j_%*} zR||G^4N+iAlS#hAWai-|+Wbi?`D4eN`+mtJX~FlP1>ReAdFtAK~BLS`?e_XV+-5?e++On_?GO z1epf7n};Ow*@F2>*)>nJ&sPU*4Wuxr!A48{TAu}kbDGhBy-MCCnd9nt#;0vM&vOec zXyIx+rGBGj4X>TVWQK1z_)FPoOf)iQUclC(m?{fu~Y zYS=Ub2t~QI-u=fOZ9Vb2qB8qN;3lVp=*{#mGm~Ru?CEaKPF;qycT=K>Qrh zU;x+bs0L(g{Gw5SZz(kIY8GzhTzQ2d+K>=1Ca9$nKq~S11 zCdwfVA}bB#Rvgvf6!zPZdU7&Amck(oDk=9dMJfb|a712P_tt_xHOCVO;0V6t%7 z(Y7#IIUrHuaDM>!Px5Ggk`PJhqhpqm1s35*TPfh|J30?3IVstrYbs4y{3C6pWdNq$ zPZ}IZ6*)XUX&E`GANIrF*B$^m`Z566MAI9=PL$A Date: Fri, 26 Jul 2024 17:03:57 +0530 Subject: [PATCH 45/53] Update NUST doc --- .../ballerina-nust-hackathon-2024.pdf | Bin 58136 -> 57685 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/public/hackathons/ballerina-nust-hackathon-2024.pdf b/public/hackathons/ballerina-nust-hackathon-2024.pdf index 6ddf2e8a2b973c2355c47174b644fe2da0049831..c44a57945287a2edc76c7a7b71861a5f08f1928e 100644 GIT binary patch delta 12528 zcmZ9zWmH^Sur&(7JwR}`;L<<~9xTD#-3bsNNC>`>-~?;jf`s4}92yJmAp{TZ?iTEE z&iCH??mcVt7`;aAS#wp@?jL*4s!r`inf!rL1%C#QL&2d2^YcJq5Rec(KZuV<03-x~ z(1Rfm9)6I3kN~_AH4(0YB1H$~rw2U&VGw?LApst+fPer*fFAS@3?>8>5d0UXi29li z#LokU!k|JBdXT`=RuBdPL+L^M5FS202v`90gyV#dqj4bf!__)p0uUI#ptv}_o4c#E zxg)k`=7I5E1#^?*1CYIn2(XTS@c}s+silVYQH9?*t{XjQKNfaG@M(X-cygjpUS8XH zi(kYf`s28mv4%S0j0tT_{o#hV|1l|a?D6Dw;!!;0N1-b3V=}>t{^LzUyIA{OpTy(I z`BwY*nZ(19e0yaa@P)zE|6vOdyT9KtbSj?ZK^mjxaEb01ixU#G zSKAdx{K>ds#oHB+Qkz`eVi`jou4&Jt+CyGc`^#&)c`KUPIfFA+G&3Dx8dKb2?Pt%O zG|{iAkBKa#aaGK&pBwnPD$nT>J>Wli^ssR=4@lf!WK<*dpD=$! zE8^v37NV^vEF?r{Q&T;Bz{~+s6FS5Sm&Y9&Xi2ox0xVSos_w;}a_Ly-W z#t>M=T4(`??UQZPPA!q}hf;Dv_at|$S%ucAyfYVXe3@BS3sS~hh3@G$)Hro=#F5RT z0}?gp?ZNtn+{dR?DVjT?Wr!*oJp$=OnxU@ay&XwClnC-=5{dq%$Ao)rBJ2;XmU*7v zc$P%{%w4@wj6_P;sRQDbeq?@q!_1O28f-vBv!MpS9z29N{ANh%%CV79W-*XIngw8;7YMdJ*L=o=XJ3tI;^Z z@$1W&aw0;NLt~n2`4Ocg8On8OZ+v?ivM)GQ?@tJ{l-;K@Ei8l|F(k80?f-mhPL`;> zazPkH&akDeTp=aw8gzJ>P6;}}c&D*)BPatHVQaK>twUSYoX`iE zy{-JT6ndl5+Z#dKQ}bA+Xy#r-eM8^GjZF9ws+9NOOMkSR-m7v5MeLgv??yS<Cw(ijRaVE0*8~n~?B!Pjz+6=&$^0+DnCdX(s4na%9u7T+kmj~U(>@^i zl?$OgdkkBug1PpOa^@mfhZgCGWA*nbm_*5~zif;mV$V`$!8o0n)I848B{{}6rbMep zx6)5)Rxmc%DwWZ)8XvlL{m!PPO3tzFD<_J0|F)K#H7d2n{SRAxg_7o>Bs>13+yWWW z&{3JX-bw$7kkB}_qN)V@59F-e%Fh5$+G=yvy~T!g2IFpCF69*R!aKU3scM*58wR7r*u z(DIzt}5iBNwn;MBNzfa;}t_RFXO!AKXmaeW+ulkUe()O6O>% zj1UTW!$!yPE>LRMux1S~cZx%fa@;zbq-kjTq7;)mXkjSzZQK_;NuLnt7+hdNkf~92 z!vPl~r!=3kYTEOz=s{TlP!H*r5W@W2pFb>r*uTK+7M+ToM>NGyt^d}?)op57pq7=B zX&~q>hN4#It4~y?e$*K5vF&lKS-)B^QLhABze$b3F3{L~wJZ-*%NFdEgm}%=D?V z@8TgcE0anQ&W_8CFfsPsGo@wBfe1-D3b|CmM0R6NtU#D4i#Ba4w(kpGf@btx<&@~z ziJ6HIx-%R@OI~16y9_+-vt7|ymxA<}WtgLGgh%VRR+(FDLs;EQozXha>uDlIp1iCeG*t;mD;BB8ePkbC=szX3=dE07 z$sFU+NIZ7>q%n|}coP-%j1*`w@^g|ha$fK8c8-f>s=8#I;q_;4!W`0QD|~C3ReIwe zm6h1ae@qj%OPn(UkFj-pAYEZ`#fAG0O$p(o+bUM&2|)_I*Yh$^?I!=Yg-YZ;?dB4ecw^o zQtxTnWPPgkjDX9mVyl))2cPSRD>;a!B&()Mo@o-`*D?E!8j@0z*{vj%q+PT@_{=%D z(d@+<_>nNMKLYAadmUl0?_UjJ!<&rF}DGZcqPSVW{cOU!Mw6N#?9abF)$FU$)%Xpa*iPxOV4Bx0!L@`{ zuNT$A{#Gl58}kWb$P7=q(G;3T*!-I6Zc-@(_Pnvq{TEw8k{y@`vY?n{pa~)huu7~6 z1J$YiB-so07W_B7htStp6T7d3ZE_DC|FosTbr|W(Yn$y>`8BCmwTISf&M3E>R;K0K zcqgw{U(z^Nd|qAsju{MpR+V7plfXh~&?VyN(-8Z8!p7#?$l{b)Z?T;?JWI6MkJ8K! zFnVm-s0?gx`6Q$Gwc`sns(de*?PIJ|aQB>79pb7$Tlo*;s^>+~yK>Mq zWgU9Z?)8|<_=S;Pr$P$JszqA(NqW#a344_pQh;l;ooPb0MJRhO@`%{dSTnNumeo;IfWp182>~!W=F}a?$ydqI;`XGvOgjK_}WL zHCP+!LM)Xi;J$yjipZbZT8=sMceoiYNz^Z_QIPMu5mx5%k|fx$n2T127x}6DXpPzC z*3_qzdogx(KCO(^%XOAoSJ!n%yh@6c9|rM51Y4vwaww#-pN$D4lso$-S4PZ$-ikYe zqt*s*6Il;N&gYYh2eKa^>iEJ6)khQa+W|I+<>ZdeyMfh7OjFafl3VcN$*f-3nRcHr6TM;ZP5GJz)dwQpg(p@ zFg0l+ZCu28Q9wG*8YBynz(;kTVaC&l7#WcU(}B$b6tIgRGXp=2tzKKs=^QDkX3Kb~ z9@pT}&vE>{kAE$E5J-&$m^t-Pe}=}EE&bf{|5FBf{)jhQs-ITI7Ylp@*})u8lUb7z zj&z-zX5FgjK56&6p1tlG9{N?gX+&_8ov#FDR!8rH4Pp#??WFILGNUq8X83C{$zb{6 zcnatZKcLp+SgLaR<}_Yr7=Hfkxum@rkWRf2_M6hfB(xB2_d}npwO|*N9^C(3%!UKs zvb?CQL>}&YOH16<84DZ(CUNmhZbr(Cy90j=E*o zI}i39Ro_-$@N}$9GMBlra}xSp=)zX%u-np55f@oPfCcpDFC!E;@Hbedq7q+} zG~`EKS*C+tPtr|ZI4>dLZbGCrCp~C|--`E+i9VQn-QlA_$3EJ7ui@+-kllN^Rm-TK zmB#!K=wVNCMQh9G+nyKTzz?R4pd4zV6&V zxXnN6NmsIA#{eeS*n{YX5tCD?oCN^7wl}pl^8`K$B21>ay))Spa zy|D`Ec2YGKgxyFfFsfR0*g7J|D+& zn!8kwgpy8WqqVGacA`J(fs zb&RB(ya|>=r_^TXlCdu2r6Pq&16m_A%9k1_FQ!{WpqDg|iNCrbw>&`~KcYQXwzo07 zK!1GaL^+w=OC>(Z9vgYQ`=efssryx4UJyy{2{Q$vkptMlEaso zQ#ICp-|iryCyaHO8hD&N@H&;bD92nY+a=c|LqI7>A1$FhFGp^wc2&h($ zfXF4bX7EDBW>ZfJ76HbtOZ8QQL6lRA&XL2nfSG3k{7QC!ad}On2J%rQKN>y_@!%Nx z_GdZncun9doEh>h^Cy*I`v?4`HO1QkJB;krrA?G+FS4&&u9t?DJvHm=n~=pdbgDsN zK>OKRpc$&y!7Hpgu=u>TdMnlJrX_p?Kb9>qr~M4uL9tIvN84orzt-dtcVsBS_cYMV zz`$(W7vmdkM0)?+?K!R$ZeAjAiOZFYA6d`mC5GY*4R&;koFCwgxhCElkjSm>ZtAw z&B9qFm@b#sW%#qu7cY}6taF7(6WPk_rt8McrghFfDl=tCKGVQqrENoMDlBz}{#B2B z45CNW_ug_v@CGf`%j5HfH=vNz{FI)@-=5OZL=;2zi&nE;W@ndWc^n=uy|5}F0PI4J z`YpQuK3h}Q%ie*?XSyF7GT!vIX7ARw^JObn545s)m{M;X1dcuS!4y(YOZucceW z1X;wHgkWfh^+f~LAJPdtGV2Up@vMLb7x9UcXq;$qlN$cU$U zLmcG~64bs-Z7bDe^_bQygN>p0_jn(W~7dV`6?{#3i<)VSm{y^PG8m~yphoP*TX??CmJeP!=H zH#hS8DlSGFnp#4Z;|x|UTQz9_@@fjXV!iri@w{vml#{?z<`FgzW6ZZV?l7_F`n;dN zd=rgqQJl@6j`2x!j^V(PSEcY%cHYr;i@%dzKDrl$8(Oy;-xpUd;Xm(vup75xE*0yE zCJUPfYGXDBaUxZF2J~0?L;(O!-d@XH;-zn3MZ&z_ctL!t=U!KqEj^xL@{zSu)bTxm z+kkt==R5^!o+Z3G=T$gMtJue2`ZR8IGHJ#|lXBfO*^k>|Z*=y}#J9g+hWX6h+ZRmv zb)eV}r>NZqN4XM8u5#Wzl4F;JPfEvk1}or+?-~|H*+TX2Eq~BolmJxB@11dl1`UIy z7{3f;gjD4wyBaMOqavlvW&~L@bRfDixqhMIG*27Tl06I9KHXjLwbit08*YEyr!Gja zaBER3EK#DL|MOe&mGTy?%|%4%^DhXYnwBoMB)_7?NsGQtBW8uNL?hG=|QQtd!0Qd<3e<$ZHfkG_S0NCr3lgnEalHQmhLDl%&$_j$nZmr`&{Fl0y4MbY4_ zhDzxJbkm;rH~sCgiI3Z30+x0*Ihnxrgbj9Fo+0(TzJLCYz#c)NAgFL!foo9`;(YJi z(Qab@gjDl`#~M2fYakc4drqKnv-grwQZMAf{`(Hs>3cYBc=q!(kAUoL=uY)Z?{wXy zJzGr>K=zvV0R&8I9CM%u3QHKj^OL2?1GTeXd%u(mWk&9B$MF_laMd3NF{9wGw}yX8 z_aqad6>zz4%=|2MM&5cd&1o-}ZF-E&BsRBI+VA9Hn>)fPTqu39NPwv9-+}I`n%e9uWi({zcctgg$0PJE9;?h*k~cRpJj*~?hxi* zas^bZ#al$vJD!uSa2Y(pc)GPV3dap|*RT*F^j8e*py#g}0yhiuy;X!8G!|N{JzNt* z>0XUn&b{%-9WDHn5@b*+A8)fTF+)T1R#jTj<>}Yb`)xUqgn_UjwRF6Vt+G!|ZiyPO zgnBbX&HzCY24_{0fow$5`wInkF3%%`C;4R0OA60eYWxcyuC4ZWN-PNuY-BKq!jRWt ze3kyv?p5<=#Pgj}d^4_ut88&PKV-4mN(u=tEzZ<7%Zx-9w)PzIQCg&ZV!Se7tUqXDSAJCDW#W|IWgSx~rJA$@s}+aRjnT^-QG;2{;1MUAo%y{s^)yn6#U@Br-hs z6JK!@Y`cZD6+af6K{%}#7^}2Y8bCo)V)_#EE7v|Q6OqHz-RrZd=T@qdn!k=>c>!-2 zJrlb^vWajP*Tnoq83_$iC2u+GQX_`IDi{{&@yf;g9pj;FT|l^$rhZM+ncHVzF->+Q zNEm%G_xe!U(SnLUVT+B&%N( zGfT;|y3ssz%1n#vB)40AR@x@*0bsq{I&`^AO`(KNpnaM zbYDV@KC80Ju)6Weeji~kVBf^)LotP+(#f|2BCp>uUMV0YSg@9&ZW&$N1Fp8a&F&$x zv)nmhI%(O;4#6dKkcpnZzQ@r-QSw|o*cZe`@wp~Y=HpE<@w>=q5&ThiGmq45mx#YE zZo9*ZgKbhoSC-x5v%(jDRZ8A^efAOOVGj#$xZz2~!(dHTuZ37V8WnPCvV8H1lG64UAG~_@onxZjdarylC z*9bI2>DA~rxUWs&bq;?JM`o83TlEWY&mS3taNEwq7+z8RXnz1|NbrVZ1+ox>I>CZ~y^FMOWV@Tzxuf0-7mKFJNE8+bex&v&Fe6x&vG_x!t zS1q^R##>K2Wc6G2leQaPS}uDPyKYR;eEYq(Bv|14N2)9An*795ZR`HSzVuPEMw-O5 z6L-}C5c$p*&(INkD0=H8)vMoi|Lcumx76jb~+4*1eowrn+ z(P($D?qrG@^3*L$T#x7PTgS!i$1(GQTUQIR7PH=%sKkaEnOYJlYvxnN?e66GS~E&aidqE(IHF5P82XP?DO7-v@c zg7Uz?0uVuZL4l`M8wd)8S2F6uBN(I^_+a#ce1bd>L8uUz9whkGu7g4No*Hq2AQ%rH z6bym=i&SL9fg5zv00J=n|J_`htzc>(^lLZGrQ;i6EbZs$z~mFSycQa`lO&?TTn&Rg z5_~P05i&hvma7^swg3Z9l&3Vh&Jgx#$*q&&7YD)pI;J^rR!QG2*M z*y`GAzkAplx{~PYs(kceAEWq%ELzZY^ayz0Y;08On)a_Cjf;#?gpW9*h4a|b4Ov;Z z=PZ3iv0@c}Sq6yF6&}P&?C6?4TL0bcu0lZcQCT+;mo1WfqFembH0gk6`w29e3iO*{T`Sz9?P+!m|J)AM#<{V)VEqj^*i5>#k~v*X6#En z-A6mwT4?P%ZhObF4Y1h?%ViUswR5H{K6v(23yxNge<8&nPo%RcboY--DrfK6U`c!%S3{aqgKItUF;`IK;!nRWUxRHTqbQ>K$*#h0LU`B#`=6TvQtvcACg*J&!CaZzPrZq+@&KeI+vG`^-WS%O^;t$wae#B zR`yK4&48w0uzj$uf2IF6qdnkeX0vRV(46haI`m122g`z50)cZ=dQ5;_8j6-nn~gt! zU;(Lmt4eia(%2@p*ieypD6nzVcK3xJ@XYX@fIB_L~4ex8*&xD z=4~bBDA!-m2w93^N4)Y(%vNU*msJV<^iE-mDt$NqxizD#p(LbWs}A@Zw z_dL;wkt>Q5GsH(b%`EQ^>9^9uGmmlEhhsmQ-PSdiWc`BatkZGhASEa=lON~4>`1n_ zMQG;7UD=EkezxzId{YG2q~%WcIR^iw0^=9`GT7q(&d4*o*t&4`E77X zu?4-?B0EnOV{NFyOMcF1)(*SAl@K@3in58=S5}GV({sGdilghQi6W;M@cvZBJ^A8{ z3SRzQULITg3V%sZa`Ml%VCuzu0&@`hz-)vZ1m?`Up)9`pb(}X2Iyq4x(YU-xZHd&p zaFY0ZYsOcDiB=yVn@pYoC+`bJk%Se=X5lgUBah0}-51fA3}FcHUCUsMJYQMc52?#3 zf+aAKlfKm+jd3;`s#XgrQr566tQT8n^)%B%tB~@j?nexEuRSau{IY0UTU=;}LLW z9?nX2a^msy%&3eIO?=j##I38|INLFbuW>R&Y!rk!nxm5FG1u-iIc>A+Q5i?u=aWSJ z7~GtZfBz<;!jswup*@tyS+X+H*8c~O;D`}R(+te#++B~ok&q{#XucymTC~UYrjfa^X(C$E9mA`Q>!88KZhxd5 zojUZ9t`n|`1`QvTzHeyKof2CUo>(tCPrjC!+hS)ED^|=Xebt(ND>U)Sj)+rjf=^s5m%Vg3s z_amhl?nG{;@bld(t4a-2Zm2|Nn2Ps|FUqG3rce7FLCX$;(PI2)3l%S->y%l^UOek% zZ?7YP0CUL0QM_rT1K643CYgKK#%9%JKQ;5}D1C+42sJYL4Og99oTy0)?eKNtT&sE4 zLs|L++Im?W4-|#67CXMa9Q06^;0Pg`Rq8X|bEns6rE3LCB{`Mw`$%ir4b7;}%X<`bvylr}~iga5uCuY4SCP}$!@ZPDWS^F6hv z=wxAuVCcAoBF3N5DIS%z?eB?sla=`}6Jqk8NLwx@Yie0-5* zFac|^&PZDcY2NtA?^a&-qyh6TR1S_jGF%%!GP(KxAa~Ud^|?>?PbA1(CT&qpK0^&? z{MzjdBXbH__^7On{k!_7lG)pDjdI7&?UGkD@Kn#ebL9wAoH~i0A@^gK z3WO)9Npj&_GZOIunUXqEmAk z>J=kf5afxms6S&*EVQzMK4bd6DbuMoufJ1UbM=g%%2)S1r5@csw?ax>M2=84+{*BD z=-jjPs@CoTW(mP?(AImAVs8&$=i0JE0Xh{~QyNa44>TmD2Ct4jykn24O}tZ1tm_6| zf2gctqMxQn!J|&nLy!#ErwD)csck`9eKzZsuG8{I{vzJCcF^Z_jaTU8DV2rZ`Mw&- zdESeg6PeBuLF!AD-*^L~A-1NGC_fT-zz*iMQq)+3d#Z1_k?iC7(kA`26Tj!uwL?=4 z4MMTF`cLn6xh6%_nqCmFiVgMsP5)vBoT9t1bAI!c!iv|R4+?5k=G=IAm%|r_gRS{q zvvAK|l@E=Tumjt;4Xtc0^v_>q6|;AT*6*^iW5kppnJ-I=*lsDriwBEW9+b1fa;NgT zWCjen@zY);mHkDQ(X<|3ycVh%gvhHNZ_3{5mxoDw!HRo&-A6+4_tSnE5RdR70JP!^ zj@2g*c>H3=gubyb6HCeMcq}X|M3xfpxKky)f93S|XMOr5qe#$pIX(j!iV*?tH=hB! zX-iYo9_7c)IV$3V?rrS~lZnw+LyO+5D|57Sf(dE^#2@WCI61Ul>23V#a;4tRTvMa* zkw35FIDs5>O}$H(jf^j{($^)^YXD}Ro>!zgibc;kh)Sj3rCv-&iA>ID_k7`}!g1~x zGNh`YbP$>@FKVSXM=Ek6l-%x#G&-fnk#JJjbs)wQO-dF)f8^$??yU(cojrE&@h#3( zUx!leIW*2(4lf+lb?Pf%m)mDFf2z2#`1?BC1et~3z@kJOCX|iR%K6MN!wjIUc`&jM z+co^9fY(~Xr0wA-NRsqRUblRCRQx{jSnKL6{hNqd@LOa86*&#&g^Y=qM5h*g-N8yY zN@s;wy?wt#$V5!h=gQ4rSx%WaJ{&JykYBtnf8TP%PTa^_kH*nx34v3H7YyS2Kf9G| z>G?dzE@V68=Z0058=GpoT~7%}oPFUABDKalc0oJz6PD~7tf>6(vMA@*7+NXisn~P( z6Lrp6y>Cmbe?I5Qe;~|BLT?7iz9|5y_AovAvp0KC6Wg5Uk=EjBo}U~(=WAJPLy5eM z^rcVDeJD}WQyuS%s?VF<{9qZ``-`=6!t$vrOIp2G*~C1cZ&7F;tJ9(fd?q_bWLa@p zw^{6@ZS0DK^rsnPj<-qMRAxWRNydA9q66POSw8)xr!5ln?fGz_nXKbt!xmQ}&e!MV zq?u#KDT$u;^zDvHe_im271I`ocM5{p!gM1JI%2U7jUT`e+n+YA!+W6 z6|9qAR0jL7BuPB{$|KGp3c(*xnDmzFBYo~VNP_r^G59`VDRg|I(EGNT>YFQjB}j}? zWaAmCI>(rq4T|7gfzz*zqMfJi?H7d>1)e=Fy|VqB6Gb`*mmh7VJK+44Q(Po$KYMqq z+G?=(_}xOgPP(DNqw6CticPxhL^K%@-rA>P$?)c0XIOw2RId@ZBWDM(MoY0BPs}VJ6 zdDBd{pR3yso5HbKP4(R)60Rx2oo}qka8g}w)X~M}z>@=5iJOC`g*Y&GpZ!npD!-2fU|3HkfQ6mzs@%|cWIi; z7V=aSQJ5AsErQ?5{dB{RysE@b=HOt^5@B+ukVQuuhP$ ziSZp{DJ&vk4%nc7W8Bw0zac=BCHV?QS#r2XBzI9>|%vkaTowR8S>TuM{m-nq}Y+ z&f@PA?El4ErV{8FEA{c->B!hqn1U|I#dEAt9A&V8Ht4mGDy(mrUXr8y_U-~DtJpS; z*60VJzW(ot&mtv4#X)=)5tdwp+iMK5AGkZK1($R#EHPKmiasK^Pr4{up&-1!36bo* zC*`5a#Xy|n_kNFt2dKX4&>li}+h}k1C4s_qX$6YITCq=2ww!7IGY7T%&;cs~JKgW! zK~#}>&yyl_SgSsKjQ*yf$F+%8-C~`PTu&4cG--5)x1fU7NBJ%Xu^be$g1vZAANcG= z&w&oX$wfVKbB=cttBB)$k6xF^cUN zfOQP3x#7z^AUU05u8CkcaWZySSE~wMc^j&F#Bc0wvHb0hl*52=!=&-~h%ApkQ2HJH z;lFG#P`~}?n6EkS68Q{pmdeTFCr1b3=B)u6l=$Pnb@hujfga)7j(9D0^9l$;3p?_` zsSkW>3nhKL0te;W{ROd#wLe$=buE34Ud(5()H=7XsYmbYN!T^2c^lBi8voI8)UA?s zV^9|XRcW8q)b~|jOIs`O8#=bp;KdYKQ8DUsX}U?_U4Hpif>e-~kXE!hb!*#s3k9{*{Da z@c5@IRS*hvfq%W=aS&4Y280$1!Uy7kfWa_+I4+b42mB-g2?|04o=$*|Ldf9iP*Q?_ zsjzuvtljTPs7&Pe>mXA?<+At|FDXS!`a`{!m}3$(fRrRF~B)J z7;5ZXx}L$QUH+AhYP8(xpOOEc5U_c*oVA_oES;^a>G=i!g)_L5*5r9;yheunOH9{V zi1BZ(PsDqOe~F**Luwvc)lraPHENxT&zPbAX7j(O{*yYtP)&Q+A~`bO6XhHcztH~) z^#3c&)8sgf3(GSBK6v#40v@sOPn6U(iHj)6$bwHQ+FQ$&lNrpKlJH# z{x9^?oIC8lxF;o!?_2q|w|GB^a0|)T&@e2t&iH`r%_>WD9|G&XJ zDUyQ!C43tGfBG-M|MnFW;sgITV?iMZ^uK3-A$)>hw*NSTA^foaW&(zQ`Gnwut5nzm e*t{Cf&hGU5eDI@HS{#UwAQYR0MOO7S_WuL)?~hji delta 12900 zcmZX5byOSs^LBya+7>8IaJPgc1gBVWr?|VjLuk>WrNP~$xVu}6Q?zJthvLv8FZX_b zcJG_N_B3bGCod=hV6lr2?Ft<~L?fXd<)4wBY(eA0^2&K^pJ zRuD4{9yN0_2QdT`MVo<#kB<||2LZwWU?4Xq7z%>$0DwH)oFE<;p%gN2ngD6K? zqI?oVcwxLeyZ{)86AS`@ARqwGUvemvhZpgJh8?khVvV?ej*ZYp;iuwzashz=d3c_5 zfSh1nJ{~aiFGDB{1mgui#mk16dd`XjLgaKZ!XYp|ps+B&)y>7+*dEI({YdCX4E;Cz zlY63j6j{`7MihZYMxGwh;|)9bc5;EnLRt^-E;Dxx3q|+17je?mwR!zkuT#`WU*N1T z38LTbC;=Xm*n}SkMKT|*t%v-)ef~5G23y|mtUmm{JEMNQ`!kjGC_4^+>}2vc1PF=$ zgkRi^Kl=P$oa$Whr`Z6BXJWa!cM`&s2(i0BN+EpDe_Fm3)cEpgxYjQhO?FZ{XKS7&qY1r`fAtC=0-tic!~Au- z2p4{22>!+J{IiIj;e*62qUH|zHOugFxl<7S=cH)0lN9?|C`${QsJAxF(4|weU-a{R z(xELsF8E%He5U63cdj#(A2g4Jy4H4iXA(3Rxn!+3w2qx!m#c?x9L(n;FpC4zPB?Sn z%vFW*r^aB~cuPO#jzfBdJv^!;kYVK}a@)-r`_?eNNvdo&@-!OY0_l@UdbrKUSxr!z z-{F=f8TBxi75eNTf%)JW&z;XLLE^_?9H$U`my=FDPOgWy#M+s=Wvp3q#sa5GE>7uy+vN&FCkoMqj1X30EK{$zv{wu-g=_p+r8cs+ zxsIQ=xbt_H$|z^rcx2-@qM*I3E3yBT);a_|{0NiGxhE>^I89^~OeQv3rq8MRq{>## zC)w;0Asf3|B9w%e7 z%H%BNEI7~QEBn{g_sN$BxabkPG)t$EDM@S|lUOi|D1~HIE$hVIrLIK5Jw{I1t%M;n z!_sd~9Uk3!IEgHh)m&+96}Jra$F<+1IK0>cOpzwG^`Hqt$m)LZdxrYAdCL2=P72L7 zATh+8HaAzT%k5k9*T}3sEqK0PH78_7Qq^6zkP?lkCJ38x-%rw;#e*XGhte8+iP7aW zNRppr&$liNciRx4X)ZC?HB4zOst2YHfv`SW4!tf)t}adCuW^D5UGq-lWew66rn+v_ zGLEo-oYBn-LxEs8-WT@BNH2ZL34=Db485C#;>Dam|6dTfA*7}W6mroLt0RN?Y;4_Z zeuZ44p*K@KzvKfcD*fwcY`T?Rj@Ed~4ccDxy`smP%!$%o3k(LkWuI4R+`eZHWmU?h z2t@gW+hZK$kacz z)Mn2qAz*SZf9J$!jIN#Q#Gym7(qwBx@nQfR$9vu*9l`aE=7!{q#pk3+a`$J*(nRt~e_GC>kF^-mN`2ZD5zbUUz8#2dI*1kS?k%C``iNUx7FV-~J}6sY zo2f3RQsTOzz;Udb~miZAUgU6Lc%8~V-mFW;%91OuxaK1~mYsNpb_3;xI`e8K3R z*!pGXr69qb^v|oy=vq3p?^>@7e#b}y)~o543P-`y0H!gM;-S%_LVyHqTYIl!J4(2H zbZSI@(`OS-VcEnqmd^4kEME>DSf5)W3(+g3=TtYrkRW_&sKh0k?H9A&u{y4L+88EcusRGyWE(rp zbbLXB8P1R({X;*)b{vf?G9^Kd5;gpHMBd7u#Yn~c?7=;i8np;#4wftWUbi=Xl_O$2 zaatu~D!89RsEEx5p}uYXkD~NO*(|&5CoeEPR>pA2u&{iRvAmgHo?T)P*hJL#Dzwq; zTOoU>2WD(fYm#S_4mb^{z4mA!EzK-+aiP6oOotE9;al+c-xQ5J&mQdvMPf<$eZy!r zW6?b<*3M6p%WBg+-nr21K?H8xJk&pQR*7BlVyddTq?eKw0Fh%PzpeSBdNQEZO&^K`DPlJD4kd3vNMm0c5}HxxZ!u*c523qlj$yJNHC2R}PVuy{C7b6^ zmAk{IK_sn6{G*^%iONrW1=5<+rM}>CC^@{l<{erxm60X8kPTJ`dD>$7=c}$s zyW@r_rj$~_!kmkBDTAjEWUTXd z>!-xFoTCi5E9vCMuu_#peezqEPTcw6WHvO?mJOOw`-@0iye6+J^@Cb$UcenQk{#lr z{9A{dU*e7;&^?z~N4SWpGibff<}HFCgVpdFu=!-!y!~rMmK7hFa^LUFHVKO z9_4+zK^jRy9+Y12RjEa#%gSw!wFF)zKG-C{G23XqZ4M6M+elG*z3EdIoN;b~Z+E#7 zq)D>(RyS$7wNXx2s3{bDPV!mZGled{#GFyYH%KJQXDb~~w$V<@gI#Uk(i^8JO70sf-k}o1~L#_GP*@D9({BSR43agY3g5 zDhqRXVtCv-ORm3%PXtLJ0YBfhS8W9D-c)oVt$546_7*lPBJyzQm4bj8d=KdZw}_i9 zea!G)4bc|)I-`jgLTJw=qYxB67X6y(9)GKBcaB>i&moslUhH@xuC?|ohAb-xedtg7 zCMZwUB7F>tA*1L(J#Leo90Eslb_ShOgsA8^+P|S=Lv+jnG-`5SUfg zW`m-mCA#`Xpe_#jIa94B-F`PexRP??$kESRC(3|?ji?+G9!t_*D2~pl81-oYmx}}UwftH?&FTQw`r?^Ssa}r(eVhX>5BL`J&?m~Xth~^k} zFSA&Vhw<-F_OY|$T)Xuwl2*=0aFl;IwXqx#%21{8=qT!rN{=zq>+}|57yH~_C$ZN= zpM9=conWGNDVsR9PbC3UEC$Y>_AFaT*)Ql&MM;scuaR|G3cR;s+iUzoWW&bf!h9#X z8l!y$G=Mbb#Ep8xqb0;Hpk`ba=D9sy9gDm2`1mYoYe7uVR#jQ-3riNr5+*Y@d& zp|Bkn?^wbu3W?h|!!~#E@8t?hsku7s5DA0Qbb}azzKhYHU@g$WtC7H%<%k3vOu7Twq{z1o0whW*Kdptm(b7DIS&6Ao={$qdH52MQE~$e61t zijtd*M@_Yl=aPQLI2hJ=T9PrXb3Dl73%)DjD#yH(!u72F1cuv({KX)ZdDixol z*(mf?P@Em!N7!=L!r1A1fKgKQn+4gMfZ|=rQp_Lq&sNULf24@;1U`t=l9;MLsOa5a z;ePI3GO>!Y{9v2DRz&^idV5Mvu(Z@xz0U`op42?DsG&hOKF5yjVe4brZj7$PwPT3$=)mZL#4Qy9P+ge6-Qf8c-INu3}f5_hcZ24>YN<>py4hwnnt;1!% zusl<~4Bj>iO$HV1OVkuB-w}*64e=&w75?LAAm9DE51)>-L|>d2YH~fmgfnyFI_9rB z_9m1)CHky|EM)4`*PGrmil_?mZL{*zt>=LE+K;sB59ur`cUpyZ%@w0J^nzOwU;9%T zbu?ua!_(&#(&?UQx&eDl}r9HBntd9Ng3qgX^i zlJIA`ZTVBD+fC)d%SZIZKx=AZ$Mn9c1`B-84;>1a(D3-S63w(lyQp2&lhsegf07BJ zH<7#xe_C@yrQ|KODajH)i#;D%n1`jCQM7-lW?oQuA-79-umR#j^Z^SAC)3{6)?=@p zzQ5P2f8ZSCusCQ!`~ID8F=Q@R%f(HI`~=RE9`pGszRSsk^#g@(F2(~{mOYl4Em>ES zb&dAwi%{U+Nn6!|o?|S7HN0Ep9#(?$B~xw_(TFnDg^ax;FnRh`J!E#J$ON!PFMn&< z-^IQMuth?=H$ddmP zb}HiDK!cX~xorC~L5Rb8##IoJ?0X!+M+5&V%x@p zr@*k~eCFv?u5BFkbRApiGS!NQX(It!4=d8(p}N_1LPpwz1TLzuQ$*YEkRR~ifkOgN z8(VGAq{bn3iexp-JE~{bkiMogbs>IpvK?>xiu3Z(dLhNps3n~7pykCmAj1y{H|fKp zQD%dqW!y`p)u^!z!|xWgpG%8uF?~mjxCJ2Qq+~J4+Iu z`7)WHrHTgbMqz+C`YlWbce&x)4VCY3+FzCi?H0ja@K`5B2afGdllf2=i0+A`9!*rFomR6e|p-_ zRgvKyMm>{kTR7thDa*iZ^bOQquo5s~lk#Uzld!EU70fGEr^sMXl-q{C)`0D_gn-B8 zu**MaQC{1a2)xi|C@oU13)AjAe^K`V}ZHRkNBfetokAwk}4g zE`+U*5(#h(OP2M$nN$eoFFXC&(=3jfi}$LiApE*?{Bn+MJ)aQ%-4l0BdQm=VIO}wP zkW!m7)(tZ7k!>B8`Qs`+H`)V*(Vc1Mka<>@YY%--?|WWNjuZ8uTn)6GQX(=?Pyc*J z+)c=~Xx3&WaF>&+MO!#k>dU!PkD+TVgY`qnTWSHTY7iM4c_t@FJDnl)N3Hf6w;fuP z_*K_XSiAOsc4Irde|)+GW))3k1}y}yG!}>}iaCm|L^0%!It(bC% zJNJ(&^5#}4{9vVUCxQ1$b+#8;LP9gx!}ZH0$sM(MmiNhUxv?e}q)QK_*V=~4zE)9= zSRDpPp8=`{%?bi@ibutI6ZW&IpXC!1 z&sRQtT7ksHzCYDOyX0iMZ3ip=t`9b{d-&`$`gxAEJhdS?J2Dk z#G`YH+D8U*eU_#y-VH^UAv9i3Wuo~w*g4VAgw$fvha z>Lr=L&WafvSxESO?_V9(8&mEE?d50I-hA(&Ezrw9Uw-@X&F};-OSt0>C5^b3gxKtZPEMNNN zR8i|AoISJH<;r5&k%Z~HfSg9;am^~qjenXVWzyWlLHnFG4ntpN?q#{qo41G5YeNRH zp9=jAW-R;I{0`1VvWt^Heh70AVB_G9tY&?_W&LM^DrU_ZTI3%4N=~Z$9oP95O1%rw zvejn}ubxAN^~SU!XJIEB(uUkL`Z$83PyA$w-tdIrw;}b;UH%b$!-`xdasgKN(`2)f zeHQ({^>+ssqWC9OcC-1?YFN{b29Pa6axQzy5*-uvJ1b=B4yeNZ0B*cQlPs(RT+P{& zb(?|hc-^@{=4`d?eQPW{N4cRNQ6*Uxd>3p*Bit!AWpjf@i%35e$kS&9@0aKA`uM>yKt{CMWw>asb9eqygr zS^9RBq{crg;T!!D!MnJ~<01PAP1gSAPEV`&oXdoCS=lkvm>nVNIY7nM|}5fjy@DCQ-+^(OtaR|(0E6jk=ESDiFJE_ z3Ewi&iTKDOFjK;JAxH$~IL@R{7Wd}6A8IzxeZz6>j`qxBX|CNL7Gwwg{5q4&5w{lp zPDbrw^ic6V59pjfl}t^vMj>EPq5NTBSNd!qgPl=;G_#^9=e=f;2K!acyvjGZVPKGV zx$&nXJ)-jOSO$pMWypIB<;sm~>tpy4HnXyOp0cBszt0CQLxDyU4@;ZF^cqs$*#yDs z{r5uL@?LJK_I>%_Gy|KYl+}6lD}yX}o^eopB%yg@puv|RCsQ4Pyx&zZoU`X+0uk)A zJgqFnSw_O4Hp>LvwpU&^eo^RHV^zi;WP8qdznl2Qwttu!0wR7-=Iz?qd*63y@KSHY z#jssLo#*HNIJ)+PBIpy9n;<5C48nR#C>6u;(#OavA*-pr` z(ufLO^HSwhJ?n?_Hio3lm6kpt1#ia)caif)4rwQeF^tQ+OzR zgcY)^GydHF9U3VD&94KKpn(ST!`auw#c%|p8QbpTooT0maL2D(+SXR73egm8 zadyx+E`!?;5ZN|Su%wDk#$mx^%9C?LC%HUH#2>)E*DyHtd zXm`$OMF$ffrN*_%EXl=C_9tt`(X^7-&Ihd}DizWi4u$ZOWjV5B-KC6IX{-&%SPC~G z!pCJTi}&LP_K9OM6X^5qo5i3<69s#++?U2vmwFXkw4(j~4EDW=u8tOPIhywvzR!4Y z>C$U~z^|p~(UG_z(!Ej5(@mB`{lzoi(}=~qzkt1Q`(r!-R6v6-O58avW+MikBh(YG zWn4;A-S^y;G8*$i_Ehn@D`BnjHJws8Glt5M6C-yfCx;@VRB@f;>1xTd$JT3t_T!Yv z?ZBXR=K|(f(*^ZK9s@nNaAvkhL~ZMVpzEZEb*6n)>$YsL8xD^Hb4KHuXVV`u@t~ID zDrZjy`i~YQZCKTwyRU~eIzDcqa$My%38`MV_oz(NR5!{{S--doENL{$3)R|OZ#?jA zmz?f-5sdEJEw|V%km(IudhG%mFoGyxvPwj}4)v5H6CDicPe=L#n+#Ze3_;iZE;Xrx7l-aC@xl<0FE{-KwXBA|y>G0; z*M_6)hnB{a>mV_j;&|8D2PE3zR6tF@WtWzN_}LuM+1b%s%>I~9{Z$=-!WGoIaxt}0 zi=VA?vA~S&11{}HM0EjoHJgtpU{VnSEOQ65|McMy1ps*jHvo%*8^{Ud1M|TEAQ+UB z4-A6v0(g1AoKPMR1o(F&FA%_qu%*F9Gy?>vKztBRK3)(E2H@d+Y60>=xS!gDyxiQJ zKqwCs^grr{yx54+PD(fk2Kqh#>a%jD8YrRJoFhz;H z?Dcx2o)=HZpN{VXq@=KFT)RPy$Ym|hh?8Eu``*2AVuku2J zzh;%)`&AII$t4lS1sA!S`Sa<)JlrDf@2qVrP^POY-Mv!60Jhp|47|PCsftQ~? zH7ZkwM3x)r#?EMTamJh9+eqossj?(iM>DB!BurHDTn53X(>X}I(BW` z6oa|jklM)B>EYD<)wi`z$u~AzCC+sv>F`+1e5c&4XlkX_g9OpU93|l*=w~(+3Aq$L zG3xf;bXoVqV%1aeTl*pFB~kaH4Ju894yjsQXB*+Wjc7K`+Y0`kobdh4Tkzh-&f zk~(|0J!IXouTfh#ihWWM8zg6>`!dKQm1!k+amub%O@YUN!_-YvHU^nw!KiRHG#*Xi zl!Qx#B}RRoj^iR?@<#Yq?-#x6lH#9{X032nZrX2iBFhr8zvMU4UwSkI zvA+t|=Va->?QQ)ek`I5@mP#DVCx}zh!o}i<=&YGYXNyztnZNb8Q$Ew~_tS zKq#Ci$ie!o5QXqNZ7|-6`y9u<1ZpJ3i;{1)W7ABFS25{gRAD1sO0^g1&n{tb8wkDG zJO0&)X_An@kIx$4{7A@b#M+?;=yD_m>W!NcbkgXH(R~zmH95(kZx}1?q^51o9W%Fs z`+TBjGIYpx@>J#FBVq3Uc_MAiqlj8rLlW$2oX_4jG(3-eV!X^yjPuD=PJ+`b^!@n; z<hhWf>&3 zT7uf7dE=+=FxeEKM#e5^jnX#pIN%R>klP^YD$qXfK=# z2zmHUREE<0`|=TnG>)l7@Z|uf?$MW~fR5$UbhVa&?MSjynd;(>K8NbfY;7D0BFgp<|m>}|2kcopc- z)W&YG7yt==`yGb3&I<7SB>%O_-=We=r=fUllk+ng?KO8pkhV!nb!uu3*yGlZe=h%n zePmgHdtn8PLET8`3 z{LGCW^4^=SfhOKIW(=-@H_Ys!sAVbCBeb^QbHhI(W6!X_L-5C|gYPO8=f@eh8gdKK zon=&;SUp6~&2y>yykplozn1it=oel=ovlX?@Jc8<>zm}y57!E~sqR1Oq90U7)iNw$ z&&36=^nCnTJuy83Q~I30ZLw*u*UylR8RI7}#aFC%CbdcLI^4naC5DT5e!lCX>95@q zYr+#Q9rVVTkKw2mI#ShM8>1dE>+u$~O4T-red(1?bu%+9Y#))SnA`IFu6uw%Z*r_A zq{`u}-LG%5O2b!N7~gcqh)U8^WP9|Gw8+GE&9+?zic>{z5U*rdPwe)u2(NMS6qKgX>1~=zzd3*6BN|oO!*cq(rJazqgM=J+ghn?;s z-U`=O2|4`JABmM$o~3FVs+TFURVMMJ`ZQ2>Sk^Bvm$k0pXFnf0b1mjSsP|2?hT$pE ztus4aIPKK!;5P_|RG_c4ob~vG%Br*%J`Fan{7~6R#HUVp1;#ov48b-+lO!dR_TP1}H@?{(K)aEzP^CauXs%Uy;T#hR@PT_lGcg|hM#f=SZ{ zR$@}&XT4XEgH^VN-U?)Y23(_Yyk!XI2yYZDd+e+Jti05iQUMBGWuM8>n3S0na=E?I z!y*vdEPbA2;bt<8*)OU$|ADCw=`*sH>|@` z6b2guyYU%@iKctV%Yjj+l5R@ z8W9K1Wld-W8pScE)dwiV*W^*dc@uR7LWy+Z;2XE2+F!1-U5Z1%J!_^CF4UH1q3boz z)P!>aF$j|}j2!3qo8eGpl6lmw_`1?5_gbdpAhx)#So#6a%ND|xZVD}ckZT~MFswT1 zTj-S8`-ncnHAG>0>hTJ%7fBVd{!n_kq#yv18>c4n-YPW;Mkewu#E$J2bEPdj%UI|R z{wL*`svI2(>92z{AX3!QvTrtRDdPELRl$)nw7)LY>r^aOKe!h`{kL^z;Axx2I=kNSh6)88$A1(r(v*k9#c9Ae2ElZZMeyo zcYLs{=l9AO4d7lutbmGo@gt7CtEXXB)_?Em z6e1TB)ebv)Yu~`8RnnmtBTKemS{i((#&?7fcYpPRs3QWL%O=@cR3+^)NXn(-YB|sY zSNh|_RpX#&yt91`*@&{kZW|GN2PP$l?4_*#7)n%6Q6x2+!-#&KvTy4eu378R{w6pj z(mkWMAU)pYGfjJAaI#Gh=O@#?tRP>81o(Y{G*cfKkFqAA>@ql!Lw)`|o14O`_&wfE z%8eo=_iJ3J{EUu~X$vn^JT3uNvEJ7a^xZnS<$_U_IcT%4ctSu%x)Cv4r|d5KR*u?( zJs`8v{e+%fSRnE+^O#G$lW_A#3%r!KvF>3D*{FctFGC4rD9aoDD$%1^V2vE(rE>81 zx2DTS`UjqME@AJ3jC}f8m+#}o%P<#_hRReSnoQ^yHE!M3m%Zl>Xb@cC^Dhg2DyA;0RInyOye zxEBnNA8~;}?i(rmA4XUtk;`0;Ym~=t`6g*?g@IntPon5Aqp97|j1W!)WV%3jM%J+v@+;!&9H(nkT z6s8+n4-go7h9}sZ3(Pn7zhw`26P0kY>!t2!M(1chEc<3`Fkfo2@2;IJ?Ih$pS-t{I z9KIZ_Tk-qUwk>s@%tV>OxPJ*FyusajmEr~KWe4nC07JFnQrM26|1Y3BS zdKwy*cH#Eo@}~^_-f_f!{)l1Zt=ecGK6n?((E7KW{Hlr&f3*7ha zfuTvKxY)1ktO|F@wbNsf^-Eh>wI5*WPq z*&%<`satvt=PZ=z*ft^FxPkN*>V1Rgn*FK5DND+g(?kV9n-uGu^O!vcj(QzOZzEUzN6(pV1F>_}b=8 zlFh_I^h=u^vh(e=!oW-q`irlw`StWwpJt4m4~SN1nzgcdGqVlUUMBfBd^ZyLu5A?( zM$5J!4>LdTG8B?j%cJrL?ktJnR0|&e6Wr>FHWwIRCaSCHZv(>lQ zYWXW$*#+$Vt3M^pIC%s6Yz>xpOAOCTy2i}CozA*lwme(rN^<6s03W2v`IbO7cz*Wy zB<&ic?OD@%VgBMK>HQjX{kKowi`{V)U6L?KTlgA2o0NJo?9F#BP#Q*XV`cp%1p9)n zj2nDdVNbp$6<%*ztaIHx(pZ|=IqFuIEp9`dWc9v(P(S*p9i)t2**<-$^u6rEm>ceJHdzFM&$--tT8n2aFPh&wd%+V0q4L=!dimo>+@bB2*f5 zy+42KxSJE5{QhfR2LJhzCLi{*d1|iyPP~)~cmU=3Ba-2Ja{)vLa9aSt0|ambRQ0jA z#2p>n%pKfZpN6sjLa?~h++5sE-IR@8{zkd6xc+kq;DP-m7ZygWE|Ve7Kp#-R03L)6 zh>e^F@|OU>1O5Lz@*&!JsZsy7Ljb_Uh(#b40trm|lJ{>-Vd1|{lpIZLuz=hMb}%z0 z7y{$u{9A4B=FOCIa6(c3jmq^KjC0; zsXJ;oSerVUnFD~}|K$2V0YYl`-1MXnOl?F6o!0gje`oxE82J8TK!VmPwW**W!D@3l z<&f$5{;M4S$LoJp@V~u+xN8Y|R!9&Fi+_0~MvyL6y##UplNkhja?OAS;`s|k;I2?0 zXqVFeGaFyKwS*FT!ty8|A6i zh{_c@QV=)rX?CCcuOGkxfc5tUFAN6dMjWho!k-fPhlKlSwEw99|H8n3Mg9+r2LyeZ z@&6|Vh60}!7XFEGKb;`{o1L2v3jHrV`2U2&%?E=#J!JnPf&I7Q|L8p(FY^AInCEFb z;i>%pwB-fzJ(cVq7?2MN{HHCPn;XdYv|aIUMHm$HZ-*dm5cuEO@$x;D;a|4Ad|=qW z6M5R7;QMz~!Q4FDFynt2gCV?sy%Yb48VrH{^+Nv(gYo{KTjJ(oY;9-mf+Z-(rDpA8 h{`3f7aj7~wx;?FQAlTQau%RF*9~J|Hq>>cY{{w)C2P6Oh From 5c64570d26b1cf331fe552b3d4af465a406ca4ef Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Fri, 26 Jul 2024 13:08:52 +0000 Subject: [PATCH 46/53] Update ballerina standard library specifications --- public/spec/graphql/spec.md | 509 ++++++++++++++++++++++++++++++++---- spec/graphql/spec.md | 509 ++++++++++++++++++++++++++++++++---- 2 files changed, 916 insertions(+), 102 deletions(-) diff --git a/public/spec/graphql/spec.md b/public/spec/graphql/spec.md index 90fb6d8433ec..b1c94e7299ec 100644 --- a/public/spec/graphql/spec.md +++ b/public/spec/graphql/spec.md @@ -1,9 +1,9 @@ # Specification: Ballerina GraphQL Library -_Owners_: @shafreenAnfar @DimuthuMadushan @ThisaruGuruge @MohamedSabthar \ -_Reviewers_: @shafreenAnfar @ThisaruGuruge @DimuthuMadushan @ldclakmal \ +_Authors_: [@aashikam](https://github.com/aashikam) [@DimuthuMadushan](https://github.com/DimuthuMadushan) [@MohamedSabthar](https://github.com/MohamedSabthar) [@Nuvindu](https://github.com/Nuvindu) [@ThisaruGuruge](https://github.com/ThisaruGuruge) \ +_Reviewers_: [@DimuthuMadushan](https://github.com/DimuthuMadushan) [@ldclakmal](https://github.com/ldclakmal) [@MohamedSabthar](https://github.com/MohamedSabthar) [@shafreenAnfar](https://github.com/shafreenAnfar) [@ThisaruGuruge](https://github.com/ThisaruGuruge) \ _Created_: 2022/01/06 \ -_Updated_: 2024/05/02 \ +_Updated_: 2024/07/23 \ _Edition_: Swan Lake \ _GraphQL Specification_: [October 2021](https://spec.graphql.org/October2021/) @@ -108,10 +108,15 @@ The conforming implementation of the specification is released and included in t * 7.1.9.1 [The `enabled` Field](#7191-the-enabled-field) * 7.1.9.2 [The `maxAge` Field](#7192-the-maxage-field) * 7.1.9.3 [The `maxSize` Field](#7193-the-maxsize-field) + * 7.1.10 [Query Complexity Configurations](#7110-query-complexity-configurations) + * 7.1.10.1 [The `maxComplexity` Field](#71101-the-maxcomplexity-field) + * 7.1.10.2 [The `defaultFieldComplexity` Field](#71102-the-defaultfieldcomplexity-field) + * 7.1.10.3 [The `warnOnly` Field](#71103-the-warnonly-field) * 7.2 [Resource Configuration](#72-resource-configuration) * 7.2.1 [Field Interceptors](#721-field-interceptors) - * 7.2.2 [Prefetch Method Name Configuration](#722-prefetch-method-name-configuration) - * 7.2.3 [Field-level Cache Configurations](#723-field-level-cache-configuration) + * 7.2.2 [Prefetch Method Name Configurations](#722-prefetch-method-name-configurations) + * 7.2.3 [Field-level Cache Configurations](#723-field-level-cache-configurations) + * 7.2.4 [Query Complexity Configurations](#724-query-complexity-configurations) * 7.3 [Interceptor Configuration](#73-interceptor-configuration) * 7.3.1 [Scope Configuration](#731-scope-configuration) * 7.4 [ID Annotation](#74-id-annotation) @@ -215,6 +220,27 @@ The conforming implementation of the specification is released and included in t * 10.8.1.4 [Errors](#10814-errors) * 10.8.2 [Tracing](#1082-tracing) * 10.8.3 [Logging](#1083-logging) + * 10.9 [Document Validation](#109-document-validation) + * 10.9.1 [Query Complexity Validation](#1091-query-complexity-validation) + * 10.9.1.1 [Query Complexity Validation Configurations](#10911-configure-query-complexity-validation-for-a-graphql-service) + * 10.9.1.1.1 [The `maxComplexity` Field](#109111-the-maxcomplexity-field) + * 10.9.1.1.2 [The `defaultFieldComplexity` Field](#109112-the-defaultfieldcomplexity-field) + * 10.9.1.1.3 [The `warnOnly` Field](#109113-the-warnonly-field) + * 10.9.1.2 [Configure Query Complexity Validation for a Field](#10912-configure-query-complexity-validation-for-a-field) + * 10.9.1.2.1 [Record Field Complexity](#109121-record-field-complexity) + * 10.9.1.2.2 [List Field Complexity](#109122-list-field-complexity) + * 10.9.1.2.3 [Hierarchical Resource Paths Complexity](#109123-hierarchical-resource-paths-complexity) + * 10.9.1.2.4 [Interfaces and Objects Implementing Interfaces](#109124-interfaces-and-objects-implementing-interfaces) + * 10.9.1.2.5 [Introspection Query Complexities](#109125-introspection-query-complexities) + * 10.9.1.3 [Response for Invalid Document with Exceeding Max Query Complexity](#10913-response-for-invalid-document-with-exceeding-max-query-complexity) + * 10.9.2 [Query Depth Validation](#1092-query-depth-validation) + * 10.9.2.1 [Configure Query Depth Validation for a GraphQL Service](#10921-configure-query-depth-validation-for-a-graphql-service) + * 10.9.2.1.1 [The `maxDepth` Field](#109211-the-maxdepth-field) + * 10.9.2.2 [Response for Invalid Document with Exceeding Max Query Depth](#10922-response-for-invalid-document-with-exceeding-max-query-depth) + * 10.9.3 [Introspection](#1093-introspection) + * 10.9.3.1 [Response for Disabled Introspection](#10931-response-for-disabled-introspection) + * 10.9.4 [Constraint Validation](#1094-constraint-validation) + * 10.9.4.1 [Response for Invalid Document with Constraint Violation](#10941-response-for-invalid-document-with-constraint-violation) ## 1. Overview @@ -1607,7 +1633,7 @@ This annotation consists of the following fields. #### 7.1.1 Max Query Depth -The `maxQueryDepth` field is used to provide a limit on the depth of an incoming request. When this is set, every incoming request is validated by checking the depth of the query. This includes the depths of the spread fragments. If a particular GraphQL document exceeds the maximum query depth, the request is invalidated and the server will respond with an error. +The `maxQueryDepth` field is used to provide a limit on the depth of an incoming request. ###### Example: Setting Max Query Depth @@ -1620,42 +1646,6 @@ service on new graphql:Listener(9090) { } ``` -In the above example, when a document has a depth of more than 3, the request will be failed. - -###### Example: Invalid Document with Exceeding Max Query Depth - -```graphql -{ - profile { - friend { - friend { - name # Depth is 4 - } - } - } -} -``` - -This will result in the following response. - -```json -{ - "error": { - "errors": [ - { - "message": "Query has depth of 4, which exceeds max depth of 3", - "locations": [ - { - "line": 1, - "column": 1 - } - ] - } - ] - } -} -``` - #### 7.1.2 Auth Configurations The `auth` field is used to provide configurations related to authentication and authorization for the GraphQL API. The [Security](#8-security) section will explain this configuration in detail. @@ -1806,7 +1796,7 @@ service on new graphql:Listener(9090) { #### 7.1.8 Constraint Configurations -The `validation` field is used to enable or disable the validation of constraints defined on GraphQL input types. If constraint validation support is enabled, the GraphQL service verifies all constraints set on the GraphQL inputs when executing the resolver. By default, constraint validation is enabled for Ballerina GraphQL services. +The `validation` field is used to enable or disable the validation of constraints defined on GraphQL input types. ###### Example: Disable Constraint Validation Support @@ -1861,6 +1851,48 @@ The optional field `maxAge` accepts a valid `decimal` value which is considered The optional field `maxSize` accepts an int that denotes the maximum number of cache entries in the cache table. By default, it has been set to `120`. +#### 7.1.10 Query Complexity Configurations + +The `queryComplexityConfig` field is used to provide the configurations for [Query Complexity Validation](#1091-query-complexity-validation) in Ballerina GraphQL services. + +###### Example: Enable Query Complexity with Default Values + +```ballerina +@graphql:ServiceConfig { + queryComplexityConfig: {} +} +service on new graphql:Listener(9090) { + // ... +} +``` + +###### Example: Query Complexity Configurations + +```ballerina +@graphql:ServiceConfig { + queryComplexityConfig: { + maxComplexity: 100, + defaultFieldComplexity: 1, + warnOnly: true + } +} +service on new graphql:Listener(9090) { + // ... +} +``` + +##### 7.1.10.1 The `maxComplexity` Field + +The `maxComplexity` field is used to provide the maximum allowed complexity of a query. The default value is `100`. + +##### 7.1.10.2 The `defaultFieldComplexity` Field + +The `defaultFieldComplexity` field is used to provide the default complexity of a field. The default value is `1`. + +##### 7.1.10.3 The `warnOnly` Field + +The `warnOnly` field is used to provide a boolean value to denote whether to warn only when the query complexity exceeds the `maxComplexity` or to fail the request. By default, it has been set to `false`. + ### 7.2 Resource Configuration The configurations stated in the `graphql:ResourceConfig`, are used to change the behavior of a particular GraphQL resolver. These configurations are applied to the resolver functions. @@ -1880,7 +1912,7 @@ service on new graphql:Listener(9090) { interceptors: new Interceptor1() } resource function get name(int id) returns string { - // ... + // ... } } ``` @@ -1894,12 +1926,12 @@ service on new graphql:Listener(9090) { interceptors: [new Interceptor1(), new Interceptor2()] } resource function get name(int id) returns string { - // ... + // ... } } ``` -#### 7.2.2 Prefetch Method Name Configuration +#### 7.2.2 Prefetch Method Name Configurations The `prefetchMethodName` field is used to override the default prefetch method name. To know more about the prefetch method, refer to the [Define the Corresponding `prefetch` Method](#10633-define-the-corresponding-prefetch-method) section. @@ -1916,12 +1948,12 @@ service on new graphql:Listener(9090) { prefetchMethodName: "loadBooks" } resource function get books(graphql:Context ctx) returns Book[] { - // ... + // ... } } ``` -#### 7.2.3 Field-level Cache Configuration +#### 7.2.3 Field-level Cache Configurations The `cacheConfig` field is used to provide the [field-level cache](#10712-field-level-caching) configs. The fields are as same as the operation cache configs. @@ -1938,7 +1970,25 @@ service on new graphql:Listener(9090) { } } resource function get name(int id) returns string { - // ... + // ... + } +} +``` + +#### 7.2.4 Query Complexity Configurations + +The `complexity` field is used to provide the query complexity value for a given field in [Query Complexity Validation](#1091-query-complexity-validation). + +###### Example: Query Complexity Configuration + +```ballerina +service on new graphql:Listener(9090) { + + @graphql:ResourceConfig { + complexity: 10 + } + resource function get name(int id) returns string { + // ... } } ``` @@ -3630,7 +3680,7 @@ service on new graphql:Listener(9090) { To engage the DataLoader with a GraphQL field (let's assume the field name is `foo`), define a corresponding _prefetch_ method named `preFoo` in the service, where `Foo` represents the Pascal-cased name of the GraphQL field. The `preFoo` method can include some or all of the parameters from the GraphQL field and must include the `graphql:Context` parameter. Adding the parameters of the GraphQL `foo` field to the `preFoo` method is optional. However, if these parameters are added, the GraphQL Engine will make the same parameter values of the GraphQL field available to the `preFoo` method. -The GraphQL Engine guarantees the execution of the `preFoo` method before the `foo` method. By default, the GraphQL engine searches for a method named `preFoo` in the service class before executing the `foo` method. If the method name is different, the user can override the prefetch method name using the [`prefetchMethodName`](#722-prefetch-method-name-configuration) configuration of the `@graphql:ResourceConfig` annotation. +The GraphQL Engine guarantees the execution of the `preFoo` method before the `foo` method. By default, the GraphQL engine searches for a method named `preFoo` in the service class before executing the `foo` method. If the method name is different, the user can override the prefetch method name using the [`prefetchMethodName`](#722-prefetch-method-name-configurations) configuration of the `@graphql:ResourceConfig` annotation. The user is responsible for implementing the logic to collect the keys of the data to be loaded into the `DataLoader` in the `preFoo` method. Subsequently, the user can implement the logic to retrieve the data from the `DataLoader` within the `foo` method. @@ -3816,7 +3866,7 @@ Operation-level caching can be used to cache the entire operation, and this can ##### 10.7.1.2 Field-level Caching -The GraphQL field-level caching can be enabled only for a specific field. This can be done by providing the [field cache configurations](#723-field-level-cache-configuration). Once the field-level caching is enabled for a field, it will be applied to the sub-fields of that field. The field-level cache configuration can be used to override the operation-level cache configurations. +The GraphQL field-level caching can be enabled only for a specific field. This can be done by providing the [field cache configurations](#723-field-level-cache-configurations). Once the field-level caching is enabled for a field, it will be applied to the sub-fields of that field. The field-level cache configuration can be used to override the operation-level cache configurations. >**Note:** In both cases above, if the resolver returns a record that doesn't contain any optional fields, then the entire record will be cached instead of individually caching the subfields of this record. In the case of the resolver returning a record containing optional fields, all the subfields of the record will be cached individually. @@ -4038,3 +4088,360 @@ The GraphQL tracing feature provides detailed information about the execution of #### 10.8.3 Logging A Ballerina GraphQL service will log the errors that occurred during the execution of the GraphQL request. The errors will be logged at the `ERROR` level. The error message and the stack trace will be printed in the log, in the `ballerina/log` module log format. + +### 10.9 Document Validation + +The Ballerina GraphQL package provides various measures to validate incoming GraphQL documents before executing them to ensure the security and integrity of the GraphQL service. This section describes the document validation features provided by the Ballerina GraphQL package. + +#### 10.9.1 Query Complexity Validation + +The query complexity validation will evaluate the complexity of incoming GraphQL queries and help prevent performance and security issues caused by overly complex queries. + +The query complexity of a GraphQL operation can be calculated based on the complexity of its fields. The complexity of a field can be defined by the user based on the field’s type and the amount of data it retrieves. The complexity of a query is the sum of the complexities of its fields. Users can set a maximum complexity threshold for queries, and queries exceeding this threshold can be either rejected by throwing an error or logged as a warning as per the user’s configuration. + +##### 10.9.1.1 Configure Query Complexity Validation for a GraphQL Service + +This section describes the behavior of the query complexity validation configurations. See [Query Complexity Configurations](#7110-query-complexity-configurations) section for information on how to configure query complexity. + +###### 10.9.1.1.1 The `maxComplexity` Field + +This field defines the maximum allowed complexity for a GraphQL document. The default value is set to `100` and the value should be a positive integer. + +The incoming GraphQL requests are validated against the `maxComplexity` value before executing the operation. When calculating the complexity of a query, only the operation intended to execute will be considered. All the other operations will be ignored. The complexity will be accumulated per each field and the final complexity will be the sum of all the field complexities. The behavior of the scenario where the complexity exceeds the `maxComplexity` value will depend on the [`warnOnly`](#109113-the-warnonly-field) field. + +###### 10.9.1.1.2 The `defaultFieldComplexity` Field + +This field defines the default complexity value for all the fields in the GraphQL schema. The default value is set to `1` and the value should be a positive integer. + +When the query complexity analysis is enabled and a particular field has not defined a complexity value, the `defaultFieldComplexity` value will be applied to that field. + +###### 10.9.1.1.3 The `warnOnly` Field + +This field defines the behavior of the scenario where the complexity of a query exceeds the `maxComplexity` value. The default value is set to `false` and the value should be a boolean. + +1. When `warnOnly: false` + An error will be thrown without executing the query. The corresponding HTTP status code will be 400. The error message will be in the following format: + + ```none + The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: . Calculated query complexity: . + ``` + +2. When `warnOnly: true` + A warning will be logged without executing the query. The warning message will be in the following format: + + ```none + The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: . Calculated query complexity: . + ``` + +##### 10.9.1.2 Configure Query Complexity Validation for a Field + +This section describes the behavior of the query complexity validation configurations for a field. See [Field Complexity Configurations](#724-query-complexity-configurations) section for information on how to configure field complexity. + +The field complexity value is derived from either from the provided field-specific complexity value, or from the `defaultFieldComplexity` value. + +To override the `defaultFieldComplexity` value for a specific field, the user can define the field complexity value in the field configuration. The field complexity value should be a positive integer. + +There are exceptions for overriding the `defaultFieldComplexity` value, as mentioned in the following section. + +###### 10.9.1.2.1 Record Field Complexity + +The `complexity` value of a record field cannot be overriden and will always get the `defaultFieldComplexity` value set at the service level. This is because the value of a record is calculated at a single time and assigning complexity for each field does not make sense. + +###### 10.9.1.2.2 List Field Complexity + +When a GraphQL field type is a `LIST`, the complexity value will not be dependent on the number of elements in the returned list. Users are advised to consider the complexity of retrieving a list of values when assigning a complexity value to a particular field. + +###### 10.9.1.2.3 Hierarchical Resource Paths Complexity + +For hierarchical resource paths, intermediate fields get `defaultFieldComplexity` values, while leaf fields get their specific complexity values. The total complexity of the path is the sum of the complexities of all fields. + +###### 10.9.1.2.4 Interfaces and Objects Implementing Interfaces + +Due to [a limitation](https://github.com/ballerina-platform/ballerina-lang/issues/43151) in the jBallerina runtime, the field complexity value of an interface or an object implementing an interface cannot be overridden. The field complexity value will always get the `defaultFieldComplexity` value set at the service level. This will be fixed in a future release. + +###### 10.9.1.2.5 Introspection Query Complexities + +The introspection queries will have the `defaultFieldComplexity` per each field. This cannot be overridden. + +> **Note:** When the maximum query complexity value is set to a lower value, tools such as GraphiQL may fail to generate the schema from the service due the introspection query complexity exceeding the maximum query complexity value. The complexity value of the introspection query from the GrapihQL client is 23 (assuming the default field complexity value is 1). In such cases, the testings can be done by either increasing the threshold value or using the `warnOnly` mode. + +##### 10.9.1.3 Response for Invalid Document with Exceeding Max Query Complexity + +When a GraphQL document exceeds the maximum query complexity, the GraphQL service will respond with an error message. The error message will be in the following format: + +```none +The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: . Calculated query complexity: . +``` + +###### Example: Invalid Document with Exceeding Max Query Complexity + +Consider the following GraphQL service. + +```ballerina +import ballerina/graphql; + +@graphql:ServiceConfig { + queryComplexityConfig: { + maxComplexity: 10 + } +} +service on new graphql:Listener(9090) { + + @graphql:ResourceConfig { + complexity: 3 + } + resource function get profile(int id) returns Profile { + // ... + } +} +``` + +Consider the following GraphQL document. The `profile` field has a complexity value of 3 and all the other fields (`name`, `age`) have a complexity value of 1. The profile is intended to be executed three times with aliases. Therefore, the document has a combined complexity of 15. + +```graphql +{ + p1: profile(id: 1) { + name + age + } + p2: profile(id: 2) { + name + age + } + p3: profile(id: 3) { + name + age + } +} +``` + +This document will result in the following response: + +```json +{ + "errors": [ + { + "message": "The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: 10. Calculated query complexity: 15.", + "locations": [ + { + "line": 1, + "column": 1 + } + ] + } + ] +} +``` + +#### 10.9.2 Query Depth Validation + +The query depth validation will evaluate the depth of incoming GraphQL queries and help prevent performance and security issues caused by overly deep queries. + +The query depth of a GraphQL operation can be calculated based on the depth of its fields. The depth of a query is the maximum depth of its fields. Users can set a maximum depth threshold for queries, and queries exceeding this threshold will be rejected by throwing an error. + +##### 10.9.2.1 Configure Query Depth Validation for a GraphQL Service + +This section describes the behavior of the query depth validation configurations. See [Max Query Depth](#711-max-query-depth) section for information on how to configure query depth. + +###### 10.9.2.1.1 The `maxDepth` Field + +This field defines the threshold for the maximum allowed depth for a GraphQL document. The value should be a positive integer. + +When this is set, every incoming request is validated by checking the depth of the query. This includes the depths of the spread fragments. If a particular GraphQL document exceeds the maximum query depth, the request is invalidated and the server will respond with an error. + +In the above example, when a document has a depth of more than 3, the request will be failed. + +##### 10.9.2.2 Response for Invalid Document with Exceeding Max Query Depth + +When a GraphQL document exceeds the maximum query depth, the GraphQL service will respond with an error message. The error message will be in the following format: + +```none +Query has depth of , which exceeds max depth of +``` + +###### Example: Invalid Document with Exceeding Max Query Depth + +Consider the following GraphQL service. + +```ballerina +import ballerina/graphql; + +@graphql:ServiceConfig { + maxQueryDepth: 3 +} +service on new graphql:Listener(9090) { + resource function get profile() returns Profile { + // ... + } +} +``` + +The following GraphQL document has a depth of 4. + +```graphql +{ + profile { + friend { + friend { + name # Depth is 4 + } + } + } +} +``` + +This will result in the following response. + +```json +{ + "error": { + "errors": [ + { + "message": "Query has depth of 4, which exceeds max depth of 3", + "locations": [ + { + "line": 1, + "column": 1 + } + ] + } + ] + } +} +``` + +#### 10.9.3 Introspection + +The introspection queries can be either enabled or disabled for a given GraphQL service. By default, the introspection queries are enabled. See the [Introspection Configurations](#717-introspection-configurations) section for information on how to configure introspection. + +##### 10.9.3.1 Response for Disabled Introspection + +When the introspection queries are disabled, the GraphQL service will respond with an error message when an introspection query is executed. The error message will be in the following format: + +```none +GraphQL introspection is not allowed by the GraphQL Service, but the query contained . +``` + +###### Example: Disabled Introspection + +Consider the following GraphQL service. + +```ballerina +import ballerina/graphql; + +@graphql:ServiceConfig { + introspection: false +} +service on new graphql:Listener(9090) { + resource function get profile() returns Profile { + // ... + } +} +``` + +The following introspection query will result in the following response. + +```graphql +{ + __type(name: "Profile") { + kind + } +} +``` + +This will result in the following response. + +```json +{ + "errors": [ + { + "message": "GraphQL introspection is not allowed by the GraphQL Service, but the query contained __type.", + "locations": [ + { + "line": 2, + "column": 2 + } + ] + } + ] +} +``` + +#### 10.9.4 Constraint Validation + +This section describes the constraint validation features provided by the Ballerina GraphQL package. See the [Constraint Configurations](#718-constraint-configurations) section for information on how to configure constraints. + +If constraint validation support is enabled, the GraphQL service verifies all constraints set on the GraphQL inputs when executing the resolver. By default, constraint validation is enabled for Ballerina GraphQL services. + +##### 10.9.4.1 Response for Invalid Document with Constraint Violation + +When a GraphQL input violates the constraints set on it, the GraphQL service will respond with an error message. The error message will be in the following format: + +```none +Input validation failed in the field "": Validation failed for ':' constraint(s). +``` + +###### Example: Constraint Validation + +Consider the following GraphQL service. + +```ballerina +import ballerina/constraint; +import ballerina/graphql; + +type ProfileInput record {| + + @constraint:String { + minLength: 2, + maxLength: 15 + } + string name; + + @constraint:Int { + minValue: 18 + } + int age; +|}; + +service on new graphql:Listener(9090) { + resource function get profile(int id) returns Profile { + // ... + } + + remote function addProfile(ProfileInput profile) returns Profile { + // ... + } +} +``` + +The following GraphQL document has a `name` field with a length of 1 and an `age` field with a value of 17. + +```graphql +mutation { + addProfile(profile: {name: "A", age: 17}) { + id + } +} +``` + +The response will be as follows. + +```json +{ + "errors": [ + { + "message": "Input validation failed in the field \"addProfile\": Validation failed for '$.age:minValue','$.name:minLength' constraint(s).", + "locations": [ + { + "line": 2, + "column": 5 + } + ], + "path": [ + "addProfile" + ] + } + ], + "data": null +} +``` diff --git a/spec/graphql/spec.md b/spec/graphql/spec.md index 90fb6d8433ec..b1c94e7299ec 100644 --- a/spec/graphql/spec.md +++ b/spec/graphql/spec.md @@ -1,9 +1,9 @@ # Specification: Ballerina GraphQL Library -_Owners_: @shafreenAnfar @DimuthuMadushan @ThisaruGuruge @MohamedSabthar \ -_Reviewers_: @shafreenAnfar @ThisaruGuruge @DimuthuMadushan @ldclakmal \ +_Authors_: [@aashikam](https://github.com/aashikam) [@DimuthuMadushan](https://github.com/DimuthuMadushan) [@MohamedSabthar](https://github.com/MohamedSabthar) [@Nuvindu](https://github.com/Nuvindu) [@ThisaruGuruge](https://github.com/ThisaruGuruge) \ +_Reviewers_: [@DimuthuMadushan](https://github.com/DimuthuMadushan) [@ldclakmal](https://github.com/ldclakmal) [@MohamedSabthar](https://github.com/MohamedSabthar) [@shafreenAnfar](https://github.com/shafreenAnfar) [@ThisaruGuruge](https://github.com/ThisaruGuruge) \ _Created_: 2022/01/06 \ -_Updated_: 2024/05/02 \ +_Updated_: 2024/07/23 \ _Edition_: Swan Lake \ _GraphQL Specification_: [October 2021](https://spec.graphql.org/October2021/) @@ -108,10 +108,15 @@ The conforming implementation of the specification is released and included in t * 7.1.9.1 [The `enabled` Field](#7191-the-enabled-field) * 7.1.9.2 [The `maxAge` Field](#7192-the-maxage-field) * 7.1.9.3 [The `maxSize` Field](#7193-the-maxsize-field) + * 7.1.10 [Query Complexity Configurations](#7110-query-complexity-configurations) + * 7.1.10.1 [The `maxComplexity` Field](#71101-the-maxcomplexity-field) + * 7.1.10.2 [The `defaultFieldComplexity` Field](#71102-the-defaultfieldcomplexity-field) + * 7.1.10.3 [The `warnOnly` Field](#71103-the-warnonly-field) * 7.2 [Resource Configuration](#72-resource-configuration) * 7.2.1 [Field Interceptors](#721-field-interceptors) - * 7.2.2 [Prefetch Method Name Configuration](#722-prefetch-method-name-configuration) - * 7.2.3 [Field-level Cache Configurations](#723-field-level-cache-configuration) + * 7.2.2 [Prefetch Method Name Configurations](#722-prefetch-method-name-configurations) + * 7.2.3 [Field-level Cache Configurations](#723-field-level-cache-configurations) + * 7.2.4 [Query Complexity Configurations](#724-query-complexity-configurations) * 7.3 [Interceptor Configuration](#73-interceptor-configuration) * 7.3.1 [Scope Configuration](#731-scope-configuration) * 7.4 [ID Annotation](#74-id-annotation) @@ -215,6 +220,27 @@ The conforming implementation of the specification is released and included in t * 10.8.1.4 [Errors](#10814-errors) * 10.8.2 [Tracing](#1082-tracing) * 10.8.3 [Logging](#1083-logging) + * 10.9 [Document Validation](#109-document-validation) + * 10.9.1 [Query Complexity Validation](#1091-query-complexity-validation) + * 10.9.1.1 [Query Complexity Validation Configurations](#10911-configure-query-complexity-validation-for-a-graphql-service) + * 10.9.1.1.1 [The `maxComplexity` Field](#109111-the-maxcomplexity-field) + * 10.9.1.1.2 [The `defaultFieldComplexity` Field](#109112-the-defaultfieldcomplexity-field) + * 10.9.1.1.3 [The `warnOnly` Field](#109113-the-warnonly-field) + * 10.9.1.2 [Configure Query Complexity Validation for a Field](#10912-configure-query-complexity-validation-for-a-field) + * 10.9.1.2.1 [Record Field Complexity](#109121-record-field-complexity) + * 10.9.1.2.2 [List Field Complexity](#109122-list-field-complexity) + * 10.9.1.2.3 [Hierarchical Resource Paths Complexity](#109123-hierarchical-resource-paths-complexity) + * 10.9.1.2.4 [Interfaces and Objects Implementing Interfaces](#109124-interfaces-and-objects-implementing-interfaces) + * 10.9.1.2.5 [Introspection Query Complexities](#109125-introspection-query-complexities) + * 10.9.1.3 [Response for Invalid Document with Exceeding Max Query Complexity](#10913-response-for-invalid-document-with-exceeding-max-query-complexity) + * 10.9.2 [Query Depth Validation](#1092-query-depth-validation) + * 10.9.2.1 [Configure Query Depth Validation for a GraphQL Service](#10921-configure-query-depth-validation-for-a-graphql-service) + * 10.9.2.1.1 [The `maxDepth` Field](#109211-the-maxdepth-field) + * 10.9.2.2 [Response for Invalid Document with Exceeding Max Query Depth](#10922-response-for-invalid-document-with-exceeding-max-query-depth) + * 10.9.3 [Introspection](#1093-introspection) + * 10.9.3.1 [Response for Disabled Introspection](#10931-response-for-disabled-introspection) + * 10.9.4 [Constraint Validation](#1094-constraint-validation) + * 10.9.4.1 [Response for Invalid Document with Constraint Violation](#10941-response-for-invalid-document-with-constraint-violation) ## 1. Overview @@ -1607,7 +1633,7 @@ This annotation consists of the following fields. #### 7.1.1 Max Query Depth -The `maxQueryDepth` field is used to provide a limit on the depth of an incoming request. When this is set, every incoming request is validated by checking the depth of the query. This includes the depths of the spread fragments. If a particular GraphQL document exceeds the maximum query depth, the request is invalidated and the server will respond with an error. +The `maxQueryDepth` field is used to provide a limit on the depth of an incoming request. ###### Example: Setting Max Query Depth @@ -1620,42 +1646,6 @@ service on new graphql:Listener(9090) { } ``` -In the above example, when a document has a depth of more than 3, the request will be failed. - -###### Example: Invalid Document with Exceeding Max Query Depth - -```graphql -{ - profile { - friend { - friend { - name # Depth is 4 - } - } - } -} -``` - -This will result in the following response. - -```json -{ - "error": { - "errors": [ - { - "message": "Query has depth of 4, which exceeds max depth of 3", - "locations": [ - { - "line": 1, - "column": 1 - } - ] - } - ] - } -} -``` - #### 7.1.2 Auth Configurations The `auth` field is used to provide configurations related to authentication and authorization for the GraphQL API. The [Security](#8-security) section will explain this configuration in detail. @@ -1806,7 +1796,7 @@ service on new graphql:Listener(9090) { #### 7.1.8 Constraint Configurations -The `validation` field is used to enable or disable the validation of constraints defined on GraphQL input types. If constraint validation support is enabled, the GraphQL service verifies all constraints set on the GraphQL inputs when executing the resolver. By default, constraint validation is enabled for Ballerina GraphQL services. +The `validation` field is used to enable or disable the validation of constraints defined on GraphQL input types. ###### Example: Disable Constraint Validation Support @@ -1861,6 +1851,48 @@ The optional field `maxAge` accepts a valid `decimal` value which is considered The optional field `maxSize` accepts an int that denotes the maximum number of cache entries in the cache table. By default, it has been set to `120`. +#### 7.1.10 Query Complexity Configurations + +The `queryComplexityConfig` field is used to provide the configurations for [Query Complexity Validation](#1091-query-complexity-validation) in Ballerina GraphQL services. + +###### Example: Enable Query Complexity with Default Values + +```ballerina +@graphql:ServiceConfig { + queryComplexityConfig: {} +} +service on new graphql:Listener(9090) { + // ... +} +``` + +###### Example: Query Complexity Configurations + +```ballerina +@graphql:ServiceConfig { + queryComplexityConfig: { + maxComplexity: 100, + defaultFieldComplexity: 1, + warnOnly: true + } +} +service on new graphql:Listener(9090) { + // ... +} +``` + +##### 7.1.10.1 The `maxComplexity` Field + +The `maxComplexity` field is used to provide the maximum allowed complexity of a query. The default value is `100`. + +##### 7.1.10.2 The `defaultFieldComplexity` Field + +The `defaultFieldComplexity` field is used to provide the default complexity of a field. The default value is `1`. + +##### 7.1.10.3 The `warnOnly` Field + +The `warnOnly` field is used to provide a boolean value to denote whether to warn only when the query complexity exceeds the `maxComplexity` or to fail the request. By default, it has been set to `false`. + ### 7.2 Resource Configuration The configurations stated in the `graphql:ResourceConfig`, are used to change the behavior of a particular GraphQL resolver. These configurations are applied to the resolver functions. @@ -1880,7 +1912,7 @@ service on new graphql:Listener(9090) { interceptors: new Interceptor1() } resource function get name(int id) returns string { - // ... + // ... } } ``` @@ -1894,12 +1926,12 @@ service on new graphql:Listener(9090) { interceptors: [new Interceptor1(), new Interceptor2()] } resource function get name(int id) returns string { - // ... + // ... } } ``` -#### 7.2.2 Prefetch Method Name Configuration +#### 7.2.2 Prefetch Method Name Configurations The `prefetchMethodName` field is used to override the default prefetch method name. To know more about the prefetch method, refer to the [Define the Corresponding `prefetch` Method](#10633-define-the-corresponding-prefetch-method) section. @@ -1916,12 +1948,12 @@ service on new graphql:Listener(9090) { prefetchMethodName: "loadBooks" } resource function get books(graphql:Context ctx) returns Book[] { - // ... + // ... } } ``` -#### 7.2.3 Field-level Cache Configuration +#### 7.2.3 Field-level Cache Configurations The `cacheConfig` field is used to provide the [field-level cache](#10712-field-level-caching) configs. The fields are as same as the operation cache configs. @@ -1938,7 +1970,25 @@ service on new graphql:Listener(9090) { } } resource function get name(int id) returns string { - // ... + // ... + } +} +``` + +#### 7.2.4 Query Complexity Configurations + +The `complexity` field is used to provide the query complexity value for a given field in [Query Complexity Validation](#1091-query-complexity-validation). + +###### Example: Query Complexity Configuration + +```ballerina +service on new graphql:Listener(9090) { + + @graphql:ResourceConfig { + complexity: 10 + } + resource function get name(int id) returns string { + // ... } } ``` @@ -3630,7 +3680,7 @@ service on new graphql:Listener(9090) { To engage the DataLoader with a GraphQL field (let's assume the field name is `foo`), define a corresponding _prefetch_ method named `preFoo` in the service, where `Foo` represents the Pascal-cased name of the GraphQL field. The `preFoo` method can include some or all of the parameters from the GraphQL field and must include the `graphql:Context` parameter. Adding the parameters of the GraphQL `foo` field to the `preFoo` method is optional. However, if these parameters are added, the GraphQL Engine will make the same parameter values of the GraphQL field available to the `preFoo` method. -The GraphQL Engine guarantees the execution of the `preFoo` method before the `foo` method. By default, the GraphQL engine searches for a method named `preFoo` in the service class before executing the `foo` method. If the method name is different, the user can override the prefetch method name using the [`prefetchMethodName`](#722-prefetch-method-name-configuration) configuration of the `@graphql:ResourceConfig` annotation. +The GraphQL Engine guarantees the execution of the `preFoo` method before the `foo` method. By default, the GraphQL engine searches for a method named `preFoo` in the service class before executing the `foo` method. If the method name is different, the user can override the prefetch method name using the [`prefetchMethodName`](#722-prefetch-method-name-configurations) configuration of the `@graphql:ResourceConfig` annotation. The user is responsible for implementing the logic to collect the keys of the data to be loaded into the `DataLoader` in the `preFoo` method. Subsequently, the user can implement the logic to retrieve the data from the `DataLoader` within the `foo` method. @@ -3816,7 +3866,7 @@ Operation-level caching can be used to cache the entire operation, and this can ##### 10.7.1.2 Field-level Caching -The GraphQL field-level caching can be enabled only for a specific field. This can be done by providing the [field cache configurations](#723-field-level-cache-configuration). Once the field-level caching is enabled for a field, it will be applied to the sub-fields of that field. The field-level cache configuration can be used to override the operation-level cache configurations. +The GraphQL field-level caching can be enabled only for a specific field. This can be done by providing the [field cache configurations](#723-field-level-cache-configurations). Once the field-level caching is enabled for a field, it will be applied to the sub-fields of that field. The field-level cache configuration can be used to override the operation-level cache configurations. >**Note:** In both cases above, if the resolver returns a record that doesn't contain any optional fields, then the entire record will be cached instead of individually caching the subfields of this record. In the case of the resolver returning a record containing optional fields, all the subfields of the record will be cached individually. @@ -4038,3 +4088,360 @@ The GraphQL tracing feature provides detailed information about the execution of #### 10.8.3 Logging A Ballerina GraphQL service will log the errors that occurred during the execution of the GraphQL request. The errors will be logged at the `ERROR` level. The error message and the stack trace will be printed in the log, in the `ballerina/log` module log format. + +### 10.9 Document Validation + +The Ballerina GraphQL package provides various measures to validate incoming GraphQL documents before executing them to ensure the security and integrity of the GraphQL service. This section describes the document validation features provided by the Ballerina GraphQL package. + +#### 10.9.1 Query Complexity Validation + +The query complexity validation will evaluate the complexity of incoming GraphQL queries and help prevent performance and security issues caused by overly complex queries. + +The query complexity of a GraphQL operation can be calculated based on the complexity of its fields. The complexity of a field can be defined by the user based on the field’s type and the amount of data it retrieves. The complexity of a query is the sum of the complexities of its fields. Users can set a maximum complexity threshold for queries, and queries exceeding this threshold can be either rejected by throwing an error or logged as a warning as per the user’s configuration. + +##### 10.9.1.1 Configure Query Complexity Validation for a GraphQL Service + +This section describes the behavior of the query complexity validation configurations. See [Query Complexity Configurations](#7110-query-complexity-configurations) section for information on how to configure query complexity. + +###### 10.9.1.1.1 The `maxComplexity` Field + +This field defines the maximum allowed complexity for a GraphQL document. The default value is set to `100` and the value should be a positive integer. + +The incoming GraphQL requests are validated against the `maxComplexity` value before executing the operation. When calculating the complexity of a query, only the operation intended to execute will be considered. All the other operations will be ignored. The complexity will be accumulated per each field and the final complexity will be the sum of all the field complexities. The behavior of the scenario where the complexity exceeds the `maxComplexity` value will depend on the [`warnOnly`](#109113-the-warnonly-field) field. + +###### 10.9.1.1.2 The `defaultFieldComplexity` Field + +This field defines the default complexity value for all the fields in the GraphQL schema. The default value is set to `1` and the value should be a positive integer. + +When the query complexity analysis is enabled and a particular field has not defined a complexity value, the `defaultFieldComplexity` value will be applied to that field. + +###### 10.9.1.1.3 The `warnOnly` Field + +This field defines the behavior of the scenario where the complexity of a query exceeds the `maxComplexity` value. The default value is set to `false` and the value should be a boolean. + +1. When `warnOnly: false` + An error will be thrown without executing the query. The corresponding HTTP status code will be 400. The error message will be in the following format: + + ```none + The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: . Calculated query complexity: . + ``` + +2. When `warnOnly: true` + A warning will be logged without executing the query. The warning message will be in the following format: + + ```none + The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: . Calculated query complexity: . + ``` + +##### 10.9.1.2 Configure Query Complexity Validation for a Field + +This section describes the behavior of the query complexity validation configurations for a field. See [Field Complexity Configurations](#724-query-complexity-configurations) section for information on how to configure field complexity. + +The field complexity value is derived from either from the provided field-specific complexity value, or from the `defaultFieldComplexity` value. + +To override the `defaultFieldComplexity` value for a specific field, the user can define the field complexity value in the field configuration. The field complexity value should be a positive integer. + +There are exceptions for overriding the `defaultFieldComplexity` value, as mentioned in the following section. + +###### 10.9.1.2.1 Record Field Complexity + +The `complexity` value of a record field cannot be overriden and will always get the `defaultFieldComplexity` value set at the service level. This is because the value of a record is calculated at a single time and assigning complexity for each field does not make sense. + +###### 10.9.1.2.2 List Field Complexity + +When a GraphQL field type is a `LIST`, the complexity value will not be dependent on the number of elements in the returned list. Users are advised to consider the complexity of retrieving a list of values when assigning a complexity value to a particular field. + +###### 10.9.1.2.3 Hierarchical Resource Paths Complexity + +For hierarchical resource paths, intermediate fields get `defaultFieldComplexity` values, while leaf fields get their specific complexity values. The total complexity of the path is the sum of the complexities of all fields. + +###### 10.9.1.2.4 Interfaces and Objects Implementing Interfaces + +Due to [a limitation](https://github.com/ballerina-platform/ballerina-lang/issues/43151) in the jBallerina runtime, the field complexity value of an interface or an object implementing an interface cannot be overridden. The field complexity value will always get the `defaultFieldComplexity` value set at the service level. This will be fixed in a future release. + +###### 10.9.1.2.5 Introspection Query Complexities + +The introspection queries will have the `defaultFieldComplexity` per each field. This cannot be overridden. + +> **Note:** When the maximum query complexity value is set to a lower value, tools such as GraphiQL may fail to generate the schema from the service due the introspection query complexity exceeding the maximum query complexity value. The complexity value of the introspection query from the GrapihQL client is 23 (assuming the default field complexity value is 1). In such cases, the testings can be done by either increasing the threshold value or using the `warnOnly` mode. + +##### 10.9.1.3 Response for Invalid Document with Exceeding Max Query Complexity + +When a GraphQL document exceeds the maximum query complexity, the GraphQL service will respond with an error message. The error message will be in the following format: + +```none +The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: . Calculated query complexity: . +``` + +###### Example: Invalid Document with Exceeding Max Query Complexity + +Consider the following GraphQL service. + +```ballerina +import ballerina/graphql; + +@graphql:ServiceConfig { + queryComplexityConfig: { + maxComplexity: 10 + } +} +service on new graphql:Listener(9090) { + + @graphql:ResourceConfig { + complexity: 3 + } + resource function get profile(int id) returns Profile { + // ... + } +} +``` + +Consider the following GraphQL document. The `profile` field has a complexity value of 3 and all the other fields (`name`, `age`) have a complexity value of 1. The profile is intended to be executed three times with aliases. Therefore, the document has a combined complexity of 15. + +```graphql +{ + p1: profile(id: 1) { + name + age + } + p2: profile(id: 2) { + name + age + } + p3: profile(id: 3) { + name + age + } +} +``` + +This document will result in the following response: + +```json +{ + "errors": [ + { + "message": "The operation exceeds the maximum query complexity threshold. Maximum allowed complexity: 10. Calculated query complexity: 15.", + "locations": [ + { + "line": 1, + "column": 1 + } + ] + } + ] +} +``` + +#### 10.9.2 Query Depth Validation + +The query depth validation will evaluate the depth of incoming GraphQL queries and help prevent performance and security issues caused by overly deep queries. + +The query depth of a GraphQL operation can be calculated based on the depth of its fields. The depth of a query is the maximum depth of its fields. Users can set a maximum depth threshold for queries, and queries exceeding this threshold will be rejected by throwing an error. + +##### 10.9.2.1 Configure Query Depth Validation for a GraphQL Service + +This section describes the behavior of the query depth validation configurations. See [Max Query Depth](#711-max-query-depth) section for information on how to configure query depth. + +###### 10.9.2.1.1 The `maxDepth` Field + +This field defines the threshold for the maximum allowed depth for a GraphQL document. The value should be a positive integer. + +When this is set, every incoming request is validated by checking the depth of the query. This includes the depths of the spread fragments. If a particular GraphQL document exceeds the maximum query depth, the request is invalidated and the server will respond with an error. + +In the above example, when a document has a depth of more than 3, the request will be failed. + +##### 10.9.2.2 Response for Invalid Document with Exceeding Max Query Depth + +When a GraphQL document exceeds the maximum query depth, the GraphQL service will respond with an error message. The error message will be in the following format: + +```none +Query has depth of , which exceeds max depth of +``` + +###### Example: Invalid Document with Exceeding Max Query Depth + +Consider the following GraphQL service. + +```ballerina +import ballerina/graphql; + +@graphql:ServiceConfig { + maxQueryDepth: 3 +} +service on new graphql:Listener(9090) { + resource function get profile() returns Profile { + // ... + } +} +``` + +The following GraphQL document has a depth of 4. + +```graphql +{ + profile { + friend { + friend { + name # Depth is 4 + } + } + } +} +``` + +This will result in the following response. + +```json +{ + "error": { + "errors": [ + { + "message": "Query has depth of 4, which exceeds max depth of 3", + "locations": [ + { + "line": 1, + "column": 1 + } + ] + } + ] + } +} +``` + +#### 10.9.3 Introspection + +The introspection queries can be either enabled or disabled for a given GraphQL service. By default, the introspection queries are enabled. See the [Introspection Configurations](#717-introspection-configurations) section for information on how to configure introspection. + +##### 10.9.3.1 Response for Disabled Introspection + +When the introspection queries are disabled, the GraphQL service will respond with an error message when an introspection query is executed. The error message will be in the following format: + +```none +GraphQL introspection is not allowed by the GraphQL Service, but the query contained . +``` + +###### Example: Disabled Introspection + +Consider the following GraphQL service. + +```ballerina +import ballerina/graphql; + +@graphql:ServiceConfig { + introspection: false +} +service on new graphql:Listener(9090) { + resource function get profile() returns Profile { + // ... + } +} +``` + +The following introspection query will result in the following response. + +```graphql +{ + __type(name: "Profile") { + kind + } +} +``` + +This will result in the following response. + +```json +{ + "errors": [ + { + "message": "GraphQL introspection is not allowed by the GraphQL Service, but the query contained __type.", + "locations": [ + { + "line": 2, + "column": 2 + } + ] + } + ] +} +``` + +#### 10.9.4 Constraint Validation + +This section describes the constraint validation features provided by the Ballerina GraphQL package. See the [Constraint Configurations](#718-constraint-configurations) section for information on how to configure constraints. + +If constraint validation support is enabled, the GraphQL service verifies all constraints set on the GraphQL inputs when executing the resolver. By default, constraint validation is enabled for Ballerina GraphQL services. + +##### 10.9.4.1 Response for Invalid Document with Constraint Violation + +When a GraphQL input violates the constraints set on it, the GraphQL service will respond with an error message. The error message will be in the following format: + +```none +Input validation failed in the field "": Validation failed for ':' constraint(s). +``` + +###### Example: Constraint Validation + +Consider the following GraphQL service. + +```ballerina +import ballerina/constraint; +import ballerina/graphql; + +type ProfileInput record {| + + @constraint:String { + minLength: 2, + maxLength: 15 + } + string name; + + @constraint:Int { + minValue: 18 + } + int age; +|}; + +service on new graphql:Listener(9090) { + resource function get profile(int id) returns Profile { + // ... + } + + remote function addProfile(ProfileInput profile) returns Profile { + // ... + } +} +``` + +The following GraphQL document has a `name` field with a length of 1 and an `age` field with a value of 17. + +```graphql +mutation { + addProfile(profile: {name: "A", age: 17}) { + id + } +} +``` + +The response will be as follows. + +```json +{ + "errors": [ + { + "message": "Input validation failed in the field \"addProfile\": Validation failed for '$.age:minValue','$.name:minLength' constraint(s).", + "locations": [ + { + "line": 2, + "column": 5 + } + ], + "path": [ + "addProfile" + ] + } + ], + "data": null +} +``` From b39835aae01d15fe94379a83bbb3f4565fe492ac Mon Sep 17 00:00:00 2001 From: Sarani Mendis Date: Mon, 29 Jul 2024 14:18:00 +0530 Subject: [PATCH 47/53] Update H1 in microservice page --- _data/use-cases.json | 2 +- pages/use-cases/microservices/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_data/use-cases.json b/_data/use-cases.json index 2b23b5bed1f3..34269702a45d 100644 --- a/_data/use-cases.json +++ b/_data/use-cases.json @@ -59,7 +59,7 @@ { "slug": "microservices", "frontmatter": { - "title": "Ballerina: The ultimate toolset for seamless microservices development", + "title": "Ballerina for microservices", "description": "The ultimate toolset for seamless microservices development.", "logo": "/images/msa-intro.png" } diff --git a/pages/use-cases/microservices/index.js b/pages/use-cases/microservices/index.js index acb50a87284c..9265ee6f4580 100644 --- a/pages/use-cases/microservices/index.js +++ b/pages/use-cases/microservices/index.js @@ -160,7 +160,7 @@ export default function Integrations({ samples }) { -

Ballerina: The ultimate toolset for seamless microservices development

+

Ballerina for microservices

From 6178a2d03da4f036ce48f85878081d1930267573 Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Tue, 30 Jul 2024 03:33:10 +0000 Subject: [PATCH 48/53] Update ballerina standard library specifications --- public/spec/websocket/spec.md | 14 ++++++++++++-- spec/websocket/spec.md | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/public/spec/websocket/spec.md b/public/spec/websocket/spec.md index b3381378b331..5dea9b243b93 100644 --- a/public/spec/websocket/spec.md +++ b/public/spec/websocket/spec.md @@ -214,11 +214,16 @@ When writing the service, following configurations can be provided, # + maxFrameSize - The maximum payload size of a WebSocket frame in bytes. # If this is not set or is negative or zero, the default frame size which is 65536 will be used. # + auth - Listener authenticaton configurations +# + dispatcherKey - The key which is going to be used for dispatching to custom remote functions. +# + dispatcherStreamId - The identifier used to distinguish between requests and their corresponding responses in a multiplexing scenario. public type WSServiceConfig record {| string[] subProtocols = []; decimal idleTimeout = 0; int maxFrameSize = 65536; ListenerAuthConfig[] auth?; + boolean validation = true; + string dispatcherKey?; + string dispatcherStreamId?; |}; ``` @@ -353,16 +358,21 @@ For example, if the message is `{"event": "heartbeat"}` it will get dispatched t 1. The user can configure the field name(key) to identify the messages and the allowed values as message types. The `dispatcherKey` is used to identify the event type of the incoming message by its value. +The `dispatcherStreamId` is used to distinguish between requests and their corresponding responses in a multiplexing scenario. + +```ballerina Ex: -incoming message = ` {"event": "heartbeat"}` +incoming message = ` {"event": "heartbeat", "id": "1"}` dispatcherKey = "event" +dispatcherStreamId = "id" event/message type = "heartbeat" dispatching to remote function = "onHeartbeat" ```ballerina @websocket:ServiceConfig { - dispatcherKey: "event" + dispatcherKey: "event", + dispatcherStreamId: "id" } service / on new websocket:Listener(9090) {} ``` diff --git a/spec/websocket/spec.md b/spec/websocket/spec.md index b3381378b331..5dea9b243b93 100644 --- a/spec/websocket/spec.md +++ b/spec/websocket/spec.md @@ -214,11 +214,16 @@ When writing the service, following configurations can be provided, # + maxFrameSize - The maximum payload size of a WebSocket frame in bytes. # If this is not set or is negative or zero, the default frame size which is 65536 will be used. # + auth - Listener authenticaton configurations +# + dispatcherKey - The key which is going to be used for dispatching to custom remote functions. +# + dispatcherStreamId - The identifier used to distinguish between requests and their corresponding responses in a multiplexing scenario. public type WSServiceConfig record {| string[] subProtocols = []; decimal idleTimeout = 0; int maxFrameSize = 65536; ListenerAuthConfig[] auth?; + boolean validation = true; + string dispatcherKey?; + string dispatcherStreamId?; |}; ``` @@ -353,16 +358,21 @@ For example, if the message is `{"event": "heartbeat"}` it will get dispatched t 1. The user can configure the field name(key) to identify the messages and the allowed values as message types. The `dispatcherKey` is used to identify the event type of the incoming message by its value. +The `dispatcherStreamId` is used to distinguish between requests and their corresponding responses in a multiplexing scenario. + +```ballerina Ex: -incoming message = ` {"event": "heartbeat"}` +incoming message = ` {"event": "heartbeat", "id": "1"}` dispatcherKey = "event" +dispatcherStreamId = "id" event/message type = "heartbeat" dispatching to remote function = "onHeartbeat" ```ballerina @websocket:ServiceConfig { - dispatcherKey: "event" + dispatcherKey: "event", + dispatcherStreamId: "id" } service / on new websocket:Listener(9090) {} ``` From 3483beeeccbe15be83b71cbc2aa814b23b9b4797 Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Wed, 31 Jul 2024 05:33:06 +0000 Subject: [PATCH 49/53] Update ballerina standard library specifications --- public/spec/http/spec.md | 101 ++++++++++++++++++++++----------------- spec/http/spec.md | 101 ++++++++++++++++++++++----------------- 2 files changed, 116 insertions(+), 86 deletions(-) diff --git a/public/spec/http/spec.md b/public/spec/http/spec.md index 33503cb35698..8a4ad81bf6b5 100644 --- a/public/spec/http/spec.md +++ b/public/spec/http/spec.md @@ -827,13 +827,13 @@ service /headerparamservice on HeaderBindingIdealEP { #### 2.3.5. Return types -The resource method supports anydata, error?, http:Response and http:StatusCodeResponse as return types. +The resource method supports `anydata`, `error?`, `http:Response`, `http:StatusCodeResponse` and `stream` as return types. Whenever user returns a particular output, that will result in an HTTP response to the caller who initiated the call. Therefore, user does not necessarily depend on the `http:Caller` and its remote methods to proceed with the response. ```ballerina -resource function XXX NAME_TEMPLATE () returns @http:Payload anydata|http:Response|http:StatusCodeResponse|http:Error? { +resource function XXX NAME_TEMPLATE () returns @http:Payload anydata|http:Response|http:StatusCodeResponse|stream|http:Error? { } ``` @@ -857,6 +857,7 @@ Based on the return types respective header value is added as the `Content-type` | int, float, decimal, boolean | application/json | | map\, table>, map\[], table>)[] | application/json | | http:StatusCodeResponse | derived from the body field | +| stream | text/event-stream | ##### 2.3.5.1. Status Code Response @@ -933,7 +934,19 @@ Return nil from the resource has few meanings. } ``` -##### 2.3.5.3. Default response status codes +##### 2.3.5.3. Return stream + +When an `http:SseEvent` stream is returned from the service, it's considered a server-sent event. By default, the service will add the following headers: + +- For HTTP 2.0: + - `Content-Type: text/event-stream` + - `Cache-Control: no-cache` + +- For HTTP 1.1, in addition to the previously mentioned headers, the following headers will also be included in the response: + - `Transfer-Encoding: chunked` + - `Connection: keep-alive` + +##### 2.3.5.4. Default response status codes To improve the developer experience for RESTful API development, following default status codes will be used in outbound response when returning `anydata` directly from a resource method. @@ -1494,50 +1507,52 @@ infer the expected payload type from the LHS variable type. This is called as cl inbound response payload is accessed and parse to the expected type in the method signature. It is easy to access the payload directly rather manipulation `http:Response` using its support methods such as `getTextPayload()`, ..etc. -Client data binding supports `anydata` where the payload is deserialized based on the media type before binding it +Client data binding supports `anydata` and `stream` where the payload is deserialized based on the media type before binding it to the required type. Similar to the service data binding following table explains the compatible `anydata` types with each common media type. In the absence of a standard media type, the binding type is inferred by the payload parameter type itself. If the type is not compatible with the media type, error is returned. -| Ballerina Type | Structure | "text" | "xml" | "json" | "x-www-form-urlencoded" | "octet-stream" | -|----------------|-------------------------|:------:|:-----:|:------:|:-----------------------:|:--------------:| -| boolean | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | boolean[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| int | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | int[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| float | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | float[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| decimal | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | decimal[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| byte[] | | ✅ | ❌ | ✅ | ❌ | ✅ | -| | byte[][] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| string | | ✅ | ❌ | ✅ | ✅ | ❌ | -| | string[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ✅ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| xml | | ❌ | ✅ | ❌ | ❌ | ❌ | -| json | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | json[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| map | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| record | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | record[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\ | ❌ | ❌ | ✅ | ❌ | ❌ | +| Ballerina Type | Structure | "text" | "xml" | "json" | "x-www-form-urlencoded" | "octet-stream" | "event-stream" | +|----------------|-------------------------|:------:|:-----:|:------:|:-----------------------:|:--------------:|:--------------: +| boolean | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | boolean[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| int | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | int[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| float | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | float[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| decimal | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | decimal[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| byte[] | | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ +| | byte[][] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| string | | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | +| | string[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| xml | | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | +| json | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | json[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| map | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| record | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | record[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| stream | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| |stream| ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ```ballerina http:Client httpClient = check new ("https://person.free.beeceptor.com"); diff --git a/spec/http/spec.md b/spec/http/spec.md index 33503cb35698..8a4ad81bf6b5 100644 --- a/spec/http/spec.md +++ b/spec/http/spec.md @@ -827,13 +827,13 @@ service /headerparamservice on HeaderBindingIdealEP { #### 2.3.5. Return types -The resource method supports anydata, error?, http:Response and http:StatusCodeResponse as return types. +The resource method supports `anydata`, `error?`, `http:Response`, `http:StatusCodeResponse` and `stream` as return types. Whenever user returns a particular output, that will result in an HTTP response to the caller who initiated the call. Therefore, user does not necessarily depend on the `http:Caller` and its remote methods to proceed with the response. ```ballerina -resource function XXX NAME_TEMPLATE () returns @http:Payload anydata|http:Response|http:StatusCodeResponse|http:Error? { +resource function XXX NAME_TEMPLATE () returns @http:Payload anydata|http:Response|http:StatusCodeResponse|stream|http:Error? { } ``` @@ -857,6 +857,7 @@ Based on the return types respective header value is added as the `Content-type` | int, float, decimal, boolean | application/json | | map\, table>, map\[], table>)[] | application/json | | http:StatusCodeResponse | derived from the body field | +| stream | text/event-stream | ##### 2.3.5.1. Status Code Response @@ -933,7 +934,19 @@ Return nil from the resource has few meanings. } ``` -##### 2.3.5.3. Default response status codes +##### 2.3.5.3. Return stream + +When an `http:SseEvent` stream is returned from the service, it's considered a server-sent event. By default, the service will add the following headers: + +- For HTTP 2.0: + - `Content-Type: text/event-stream` + - `Cache-Control: no-cache` + +- For HTTP 1.1, in addition to the previously mentioned headers, the following headers will also be included in the response: + - `Transfer-Encoding: chunked` + - `Connection: keep-alive` + +##### 2.3.5.4. Default response status codes To improve the developer experience for RESTful API development, following default status codes will be used in outbound response when returning `anydata` directly from a resource method. @@ -1494,50 +1507,52 @@ infer the expected payload type from the LHS variable type. This is called as cl inbound response payload is accessed and parse to the expected type in the method signature. It is easy to access the payload directly rather manipulation `http:Response` using its support methods such as `getTextPayload()`, ..etc. -Client data binding supports `anydata` where the payload is deserialized based on the media type before binding it +Client data binding supports `anydata` and `stream` where the payload is deserialized based on the media type before binding it to the required type. Similar to the service data binding following table explains the compatible `anydata` types with each common media type. In the absence of a standard media type, the binding type is inferred by the payload parameter type itself. If the type is not compatible with the media type, error is returned. -| Ballerina Type | Structure | "text" | "xml" | "json" | "x-www-form-urlencoded" | "octet-stream" | -|----------------|-------------------------|:------:|:-----:|:------:|:-----------------------:|:--------------:| -| boolean | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | boolean[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| int | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | int[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| float | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | float[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| decimal | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | decimal[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| byte[] | | ✅ | ❌ | ✅ | ❌ | ✅ | -| | byte[][] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| string | | ✅ | ❌ | ✅ | ✅ | ❌ | -| | string[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ✅ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| xml | | ❌ | ✅ | ❌ | ❌ | ❌ | -| json | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | json[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| map | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | -| record | | ❌ | ❌ | ✅ | ❌ | ❌ | -| | record[] | ❌ | ❌ | ✅ | ❌ | ❌ | -| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | -| | table\ | ❌ | ❌ | ✅ | ❌ | ❌ | +| Ballerina Type | Structure | "text" | "xml" | "json" | "x-www-form-urlencoded" | "octet-stream" | "event-stream" | +|----------------|-------------------------|:------:|:-----:|:------:|:-----------------------:|:--------------:|:--------------: +| boolean | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | boolean[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| int | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | int[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| float | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | float[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| decimal | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | decimal[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| byte[] | | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ +| | byte[][] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| string | | ✅ | ❌ | ✅ | ✅ | ❌ | ❌ | +| | string[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ✅ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| xml | | ❌ | ✅ | ❌ | ❌ | ❌ | ❌ | +| json | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | json[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| map | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\\> | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| record | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | record[] | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | map\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| | table\ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| stream | | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | +| |stream| ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ```ballerina http:Client httpClient = check new ("https://person.free.beeceptor.com"); From 68d12ba3ce89c0d9c49b21e3023e760fc88ce73b Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Wed, 31 Jul 2024 13:19:28 +0000 Subject: [PATCH 50/53] Update ballerina standard library specifications --- public/spec/graphql/spec.md | 2 +- spec/graphql/spec.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/spec/graphql/spec.md b/public/spec/graphql/spec.md index b1c94e7299ec..c490914b407b 100644 --- a/public/spec/graphql/spec.md +++ b/public/spec/graphql/spec.md @@ -4163,7 +4163,7 @@ Due to [a limitation](https://github.com/ballerina-platform/ballerina-lang/issue The introspection queries will have the `defaultFieldComplexity` per each field. This cannot be overridden. -> **Note:** When the maximum query complexity value is set to a lower value, tools such as GraphiQL may fail to generate the schema from the service due the introspection query complexity exceeding the maximum query complexity value. The complexity value of the introspection query from the GrapihQL client is 23 (assuming the default field complexity value is 1). In such cases, the testings can be done by either increasing the threshold value or using the `warnOnly` mode. +> **Note:** When the maximum query complexity value is set to a lower value, tools such as GraphiQL may fail to generate the schema from the service due the introspection query complexity exceeding the maximum query complexity value. The complexity value of the introspection query from the GraphiQL client is 23 (assuming the default field complexity value is 1). In such cases, the testings can be done by either increasing the threshold value or using the `warnOnly` mode. ##### 10.9.1.3 Response for Invalid Document with Exceeding Max Query Complexity diff --git a/spec/graphql/spec.md b/spec/graphql/spec.md index b1c94e7299ec..c490914b407b 100644 --- a/spec/graphql/spec.md +++ b/spec/graphql/spec.md @@ -4163,7 +4163,7 @@ Due to [a limitation](https://github.com/ballerina-platform/ballerina-lang/issue The introspection queries will have the `defaultFieldComplexity` per each field. This cannot be overridden. -> **Note:** When the maximum query complexity value is set to a lower value, tools such as GraphiQL may fail to generate the schema from the service due the introspection query complexity exceeding the maximum query complexity value. The complexity value of the introspection query from the GrapihQL client is 23 (assuming the default field complexity value is 1). In such cases, the testings can be done by either increasing the threshold value or using the `warnOnly` mode. +> **Note:** When the maximum query complexity value is set to a lower value, tools such as GraphiQL may fail to generate the schema from the service due the introspection query complexity exceeding the maximum query complexity value. The complexity value of the introspection query from the GraphiQL client is 23 (assuming the default field complexity value is 1). In such cases, the testings can be done by either increasing the threshold value or using the `warnOnly` mode. ##### 10.9.1.3 Response for Invalid Document with Exceeding Max Query Complexity From d313acffc388604682b70bebfa6ef8b4204b54ed Mon Sep 17 00:00:00 2001 From: RDPerera Date: Fri, 2 Aug 2024 08:27:15 +0530 Subject: [PATCH 51/53] Add improvements on EDI LibGen --- swan-lake/integration-tools/edi-tool.md | 135 ++++++++++++++++-------- 1 file changed, 93 insertions(+), 42 deletions(-) diff --git a/swan-lake/integration-tools/edi-tool.md b/swan-lake/integration-tools/edi-tool.md index 1a67ce86641a..2506713cc333 100644 --- a/swan-lake/integration-tools/edi-tool.md +++ b/swan-lake/integration-tools/edi-tool.md @@ -179,7 +179,7 @@ Usually, organizations have to work with many EDI formats, and integration devel The below command can be used to generate Ballerina records, parser and util functions, and a REST connector for a given collection of EDI schemas organized into a Ballerina package: ``` -$ bal edi libgen -p -i -o +$ bal edi libgen -p -i -o ``` The Ballerina package will be generated in the output folder. This package can be built and published by issuing `bal pack` and `bal push` commands from the output folder. Then, the generated package can be imported into any Ballerina project, and the generated utility functions of the package can be invoked to parse EDI messages into Ballerina records. @@ -263,62 +263,113 @@ public function main() returns error? { It is quite common for different trading partners to use variations of standard EDI formats. In such cases, it is possible to create partner-specific schemas and generate a partner-specific Ballerina package for processing interactions with the particular partner. -#### Using generated EDI libraries as standalone REST services +### Using generated EDI libraries as standalone REST services EDI libraries generated in the previous step can also be compiled into a jar file (using the `bal build` command) and executed (using the `bal run` command) as a standalone Ballerina service that processes EDI files via a REST interface. This is useful for microservice environments where the EDI processing functionality can be deployed as a separate microservice. -For example, the citymart package generated in the above step can be built and executed as a jar file. Once executed, it will expose a REST service to work with X12 850, 810, 820, and 855 files. The conversion of X12 850 EDI text to JSON using the REST service is shown below: +For example, the "citymart" package generated in the above step can be built and executed as a jar file. Once executed, it will expose a REST service to work with X12 850, 810, 820, and 855 files. + +#### Converting of X12 850 EDI text to JSON using the REST service + +The below REST call can be used to convert an X12 850 EDI text to JSON using the REST service generated from the "citymart" package: ``` -$ curl --request POST \ - --url http://localhost:9090/porderParser/edis/850 \ - --header 'Content-Type: text/plain' \ - --data 'ST*834*12345*005010X220A1~ -BGN*00*12456*20020601*1200****~ -REF*38*ABCD012354~ -AMT*cc payment*467.34*~ -N1*P5**FI*999888777~ -N1*IN**FI*654456654~ -INS*Y*18*025**A***FT~ -REF*0F*202443307~ -REF*1L*123456001~ -NM1*IL*1*SMITH*WILLIAM****ZZ*202443307~ -HD*025**DEN~ -DTP*348*D8*20020701~ -SE*12*12345~' +curl --location 'http://localhost:9090/porderParser/edis/850' \ +--header 'Content-Type: text/plain' \ +--data-raw 'GS*PO*SENDERID*RECEIVERID*20240802*1705*1*X*004010~ +ST*850*0001~ +BEG*00*NE*4500012345**20240802~ +REF*DP*038~ +PER*BD*John Doe*TE*1234567890*EM*john.doe@example.com~ +FOB*CC~ +ITD*01*3*2**30**31~ +DTM*002*20240902~ +N1*ST*SHIP TO NAME*92*SHIP TO CODE~ +N3*123 SHIP TO ADDRESS~ +N4*CITY*STATE*12345*US~ +PO1*1*10*EA*15.00**BP*123456789012*VP*9876543210*UP*123456789012~ +PID*F****PRODUCT DESCRIPTION~ +PO4*1*CA*20*LB~ +CTT*1~ +SE*16*0001~ +GE*1*1~ +IEA*1*000000001~' ``` The above REST call will return a JSON response like the below: ``` { - "Transaction_Set_Header": { - "Transaction_Set_Identifier_Code": "834", - "Transaction_Set_Control_Number": "12345", - "Implementation_Convention_Reference": "005010X220A1" - }, - "Beginning_Segment": { - "Transaction_Set_Purpose_Code": "00", - "Reference_Identification": "12456", - "Date": "20020601", - "Time": "1200" - }, - "Reference_Information": [ - { - "Reference_Identification_Qualifier": "38", - "Reference_Identification": "ABCD012354" - } - ], - "Date_or_Time_or_Period": [], - "Monetary_Amount_Information": [ - { - "Amount_Qualifier_Code": "cc payment", - "Monetary_Amount": 467.34 + "X12_FunctionalGroup": { + "FunctionalGroupHeader": { + "code": "GS", + "GS01__FunctionalIdentifierCode": "PO", + "GS02__ApplicationSendersCode": "SENDERID", + "GS03__ApplicationReceiversCode": "RECEIVERID", + ... // Other fields } - ],... + ... // Other fields + }, + "InterchangeControlTrailer": { + "code": "IEA", + "IEA01__NumberofIncludedFunctionalGroups": 1.0, + "IEA02__InterchangeControlNumber": 1.0 + } } ``` +#### Converting of JSON to X12 850 EDI text using the REST service + +The below REST call can be used to convert a JSON to X12 850 EDI text using the REST service generated from the "citymart" package: + +``` +curl --location 'http://localhost:9090/ediParser/objects/850' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "X12_FunctionalGroup": { + "FunctionalGroupHeader": { + "code": "GS", + "GS01__FunctionalIdentifierCode": "PO", + "GS02__ApplicationSendersCode": "SENDERID", + "GS03__ApplicationReceiversCode": "RECEIVERID", + "GS04__Date": "20240802", + "GS05__Time": "1705", + "GS06__GroupControlNumber": 1.0, + ... // Other fields + }, + ... // Other fields + }, + "InterchangeControlTrailer": { + "code": "IEA", + "IEA01__NumberofIncludedFunctionalGroups": 1.0, + "IEA02__InterchangeControlNumber": 1.0 + } +}' +``` + +The above REST call will return an X12 850 EDI text response like the below: + +``` +GS*PO*SENDERID*RECEIVERID*20240802*1705*1*X*004010~ +ST*850*0001~ +BEG*00*NE*4500012345**20240802~ +REF*DP*038~ +PER*BD*John Doe*TE*1234567890*EM*john.doe@example.com~ +FOB*CC~ +ITD*01*3*2**30**31~ +DTM*002*20240902~ +N1*ST*SHIP TO NAME*92*SHIP TO CODE~ +N3*123 SHIP TO ADDRESS~ +N4*CITY*STATE*12345*US~ +PO1*1*10*EA*15.00**BP*123456789012*VP*9876543210*UP*123456789012~ +PID*F****PRODUCT DESCRIPTION~ +PO4*1*CA*20*LB~ +CTT*1~ +SE*16*0001~ +GE*1*1~ +IEA*1*1~ +``` + ## Schema conversion Instead of writing the Ballerina EDI schema from scratch, the Ballerina EDI tool also supports converting various EDI schema formats to the Ballerina EDI schema format. From bb87714589fc2eafcbaefa5f466e06c744c159cc Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Fri, 2 Aug 2024 03:57:59 +0000 Subject: [PATCH 52/53] Update ballerina standard library specifications --- public/spec/jwt/spec.md | 4 ++-- spec/jwt/spec.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/spec/jwt/spec.md b/public/spec/jwt/spec.md index 80b4bcc9d7a8..f0e58d14b3eb 100644 --- a/public/spec/jwt/spec.md +++ b/public/spec/jwt/spec.md @@ -1,9 +1,9 @@ # Specification: Ballerina JWT Library -_Owners_: @ldclakmal @shafreenAnfar +_Authors_: @ldclakmal @shafreenAnfar @ayeshLK _Reviewers_: @shafreenAnfar _Created_: 2021/10/01 -_Updated_: 2022/02/17 +_Updated_: 2024/06/15 _Edition_: Swan Lake ## Introduction diff --git a/spec/jwt/spec.md b/spec/jwt/spec.md index 80b4bcc9d7a8..f0e58d14b3eb 100644 --- a/spec/jwt/spec.md +++ b/spec/jwt/spec.md @@ -1,9 +1,9 @@ # Specification: Ballerina JWT Library -_Owners_: @ldclakmal @shafreenAnfar +_Authors_: @ldclakmal @shafreenAnfar @ayeshLK _Reviewers_: @shafreenAnfar _Created_: 2021/10/01 -_Updated_: 2022/02/17 +_Updated_: 2024/06/15 _Edition_: Swan Lake ## Introduction From a20a16d64d923af646ffb839b8293b05244378e8 Mon Sep 17 00:00:00 2001 From: ballerina-bot Date: Fri, 2 Aug 2024 15:15:10 +0000 Subject: [PATCH 53/53] Update Ballerina Swan Lake by Examples --- _data/ballerina-by-example-nav.yml | 16 +- .../access-json-elements/content.jsx | 2 +- .../access-optional-json-elements/content.jsx | 2 +- swan-lake/by-example/aggregation/content.jsx | 2 +- swan-lake/by-example/all-bbes.json | 16 +- .../by-example/alternate-wait/content.jsx | 2 +- swan-lake/by-example/annotations/content.jsx | 2 +- .../by-example/anonymous-function/content.jsx | 2 +- swan-lake/by-example/any-type/content.jsx | 2 +- swan-lake/by-example/anydata-type/content.jsx | 2 +- .../by-example/array-map-symmetry/content.jsx | 2 +- swan-lake/by-example/arrays/content.jsx | 2 +- .../asynchronize-message-passing/content.jsx | 2 +- .../asynchronous-function-calls/content.jsx | 2 +- swan-lake/by-example/avro-serdes/content.jsx | 2 +- .../aws-lambda-dynamodb-trigger/content.jsx | 2 +- .../aws-lambda-execution-context/content.jsx | 2 +- .../aws-lambda-hello-world/content.jsx | 2 +- .../aws-lambda-s3-trigger/content.jsx | 2 +- .../content.jsx | 2 +- .../azure-functions-hello-world/content.jsx | 2 +- .../content.jsx | 2 +- .../azure-functions-timer-trigger/content.jsx | 2 +- .../by-example/backtick-templates/content.jsx | 2 +- swan-lake/by-example/binary-data/content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/binding-patterns/content.jsx | 2 +- swan-lake/by-example/boolean/content.jsx | 2 +- .../by-example/break-statement/content.jsx | 2 +- .../built-in-integer-subtypes/content.jsx | 2 +- .../built-in-string-subtype/content.jsx | 2 +- swan-lake/by-example/cache-basics/content.jsx | 2 +- .../by-example/cache-invalidation/content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/check-expression/content.jsx | 2 +- .../by-example/check-semantics/content.jsx | 2 +- swan-lake/by-example/client-class/content.jsx | 2 +- .../content.jsx | 2 +- .../commit-rollback-handlers/content.jsx | 2 +- .../by-example/computed-field-key/content.jsx | 2 +- .../by-example/conditional-send/content.jsx | 284 ++++++++++++++++++ .../by-example/conditional-send/liquid.json | 17 ++ .../configurable-variables/content.jsx | 2 +- .../configuring-via-cli/content.jsx | 2 +- .../configuring-via-toml/content.jsx | 2 +- .../by-example/const-and-final/content.jsx | 2 +- .../constraint-validations/content.jsx | 2 +- .../by-example/consuming-services/content.jsx | 2 +- .../by-example/continue-statement/content.jsx | 2 +- .../controlling-openness/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/counter-metrics/content.jsx | 2 +- swan-lake/by-example/covariance/content.jsx | 2 +- .../create-maps-with-query/content.jsx | 2 +- .../create-streams-with-query/content.jsx | 2 +- .../create-tables-with-query/content.jsx | 2 +- .../custom-prefetch-methods/content.jsx | 4 +- swan-lake/by-example/decimal-type/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/defining-classes/content.jsx | 2 +- .../by-example/dependent-types/content.jsx | 2 +- .../content.jsx | 2 +- swan-lake/by-example/directories/content.jsx | 2 +- .../by-example/directory-listener/content.jsx | 2 +- .../distinct-object-types/content.jsx | 2 +- .../by-example/docker-hello-world/content.jsx | 4 +- .../by-example/documentation/content.jsx | 2 +- .../by-example/dynamic-listener/content.jsx | 2 +- .../by-example/edi-to-record/content.jsx | 8 +- .../email-client-ssl-tls/content.jsx | 2 +- .../email-service-ssl-tls/content.jsx | 2 +- .../ensureType-function/content.jsx | 2 +- swan-lake/by-example/enumerations/content.jsx | 2 +- .../environment-variables/content.jsx | 2 +- .../content.jsx | 2 +- .../error-binding-pattern/content.jsx | 2 +- swan-lake/by-example/error-cause/content.jsx | 2 +- swan-lake/by-example/error-detail/content.jsx | 2 +- .../by-example/error-handling/content.jsx | 2 +- .../by-example/error-reporting/content.jsx | 2 +- .../by-example/error-subtyping/content.jsx | 2 +- .../error-type-intersection/content.jsx | 2 +- .../expression-oriented-style/content.jsx | 2 +- swan-lake/by-example/filepaths/content.jsx | 2 +- swan-lake/by-example/files/content.jsx | 2 +- .../filler-values-of-a-list/content.jsx | 2 +- .../floating-point-numbers/content.jsx | 2 +- swan-lake/by-example/flush/content.jsx | 2 +- .../by-example/foreach-statement/content.jsx | 2 +- swan-lake/by-example/fork/content.jsx | 2 +- .../ftp-client-receive-file/content.jsx | 2 +- .../ftp-client-send-file/content.jsx | 2 +- .../ftp-service-receive-file/content.jsx | 2 +- .../ftp-service-send-file/content.jsx | 2 +- .../by-example/function-closure/content.jsx | 2 +- .../by-example/function-pointers/content.jsx | 2 +- .../by-example/function-types/content.jsx | 2 +- .../by-example/function-values/content.jsx | 2 +- swan-lake/by-example/functions/content.jsx | 2 +- .../by-example/gauge-metrics/content.jsx | 2 +- .../graphql-client-error-handling/content.jsx | 2 +- .../content.jsx | 2 +- .../graphql-client-query-endpoint/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/graphql-context/content.jsx | 4 +- .../by-example/graphql-dataloader/content.jsx | 4 +- .../by-example/graphql-directives/content.jsx | 8 +- .../graphql-documentation/content.jsx | 4 +- .../graphql-field-interceptors/content.jsx | 4 +- .../graphql-file-upload/content.jsx | 2 +- .../by-example/graphql-graphiql/content.jsx | 2 +- .../graphql-hello-world/content.jsx | 4 +- .../content.jsx | 4 +- .../graphql-id-scalar-type/content.jsx | 4 +- .../content.jsx | 4 +- .../graphql-input-objects/content.jsx | 4 +- .../graphql-input-types/content.jsx | 4 +- .../content.jsx | 4 +- .../content.jsx | 4 +- .../by-example/graphql-interfaces/content.jsx | 4 +- .../by-example/graphql-mutations/content.jsx | 4 +- .../content.jsx | 4 +- .../content.jsx | 4 +- .../content.jsx | 4 +- .../content.jsx | 2 +- .../content.jsx | 4 +- .../content.jsx | 6 +- .../content.jsx | 4 +- .../graphql-service-field-object/content.jsx | 6 +- .../graphql-service-interceptors/content.jsx | 4 +- .../graphql-service-jwt-auth/content.jsx | 2 +- .../graphql-service-mutual-ssl/content.jsx | 2 +- .../graphql-service-oauth2/content.jsx | 2 +- .../content.jsx | 4 +- .../graphql-service-ssl-tls/content.jsx | 2 +- .../graphql-service-union-types/content.jsx | 4 +- .../graphql-subscriptions/content.jsx | 4 +- .../grpc-client-basic-auth/content.jsx | 2 +- .../grpc-client-bearer-token-auth/content.jsx | 2 +- .../content.jsx | 6 +- .../grpc-client-client-streaming/content.jsx | 4 +- .../grpc-client-headers/content.jsx | 2 +- .../grpc-client-mutual-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../grpc-client-server-streaming/content.jsx | 4 +- .../grpc-client-set-deadline/content.jsx | 2 +- .../by-example/grpc-client-simple/content.jsx | 4 +- .../grpc-client-ssl-tls/content.jsx | 2 +- .../grpc-server-reflection/content.jsx | 2 +- .../content.jsx | 4 +- .../content.jsx | 2 +- .../content.jsx | 6 +- .../grpc-service-check-deadline/content.jsx | 2 +- .../grpc-service-client-streaming/content.jsx | 4 +- .../grpc-service-headers/content.jsx | 2 +- .../grpc-service-jwt-auth/content.jsx | 2 +- .../grpc-service-mutual-ssl/content.jsx | 2 +- .../grpc-service-oauth2/content.jsx | 2 +- .../grpc-service-server-streaming/content.jsx | 4 +- .../grpc-service-simple/content.jsx | 4 +- .../grpc-service-ssl-tls/content.jsx | 2 +- .../hello-world-service/content.jsx | 2 +- swan-lake/by-example/hello-world/content.jsx | 2 +- .../hierarchical-resources/content.jsx | 2 +- .../by-example/http-100-continue/content.jsx | 2 +- .../http-2-0-client-server-push/content.jsx | 2 +- .../http-2-0-server-push/content.jsx | 2 +- .../http-2-prior-knowledge-client/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/http-access-logs/content.jsx | 4 +- .../http-basic-rest-service/content.jsx | 2 +- .../http-caching-client/content.jsx | 2 +- swan-lake/by-example/http-caller/content.jsx | 2 +- .../http-circuit-breaker/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../http-client-chunking/content.jsx | 2 +- .../http-client-data-binding/content.jsx | 2 +- .../http-client-file-upload/content.jsx | 2 +- .../http-client-header-parameter/content.jsx | 4 +- .../http-client-mutual-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../http-client-path-parameter/content.jsx | 2 +- .../content.jsx | 2 +- .../http-client-query-parameter/content.jsx | 4 +- .../http-client-redirects/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../http-client-ssl-tls/content.jsx | 2 +- .../by-example/http-compression/content.jsx | 2 +- .../http-cookies-client/content.jsx | 2 +- .../http-cookies-service/content.jsx | 2 +- swan-lake/by-example/http-cors/content.jsx | 2 +- .../http-default-error-handling/content.jsx | 2 +- .../http-default-resource/content.jsx | 2 +- .../http-error-handling/content.jsx | 2 +- .../by-example/http-failover/content.jsx | 2 +- .../by-example/http-header-param/content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/http-load-balancer/content.jsx | 2 +- .../by-example/http-matrix-param/content.jsx | 2 +- .../by-example/http-passthrough/content.jsx | 2 +- .../by-example/http-path-param/content.jsx | 2 +- .../http-query-parameter/content.jsx | 2 +- .../http-request-interceptor/content.jsx | 2 +- .../http-request-response/content.jsx | 2 +- .../http-request-with-multiparts/content.jsx | 2 +- .../http-response-interceptor/content.jsx | 2 +- .../http-response-with-multiparts/content.jsx | 2 +- .../http-restrict-by-media-type/content.jsx | 2 +- swan-lake/by-example/http-retry/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/http-send-header/content.jsx | 2 +- .../by-example/http-send-response/content.jsx | 2 +- .../content.jsx | 10 +- .../content.jsx | 4 +- .../content.jsx | 2 +- .../http-service-cache-response/content.jsx | 2 +- .../http-service-chunking/content.jsx | 2 +- .../http-service-data-binding/content.jsx | 2 +- .../http-service-file-upload/content.jsx | 2 +- .../content.jsx | 2 +- .../http-service-mutual-ssl/content.jsx | 2 +- .../http-service-oauth2/content.jsx | 2 +- .../content.jsx | 2 +- .../http-service-redirects/content.jsx | 2 +- .../http-service-ssl-tls/content.jsx | 2 +- swan-lake/by-example/http-timeout/content.jsx | 2 +- .../by-example/http-trace-logs/content.jsx | 4 +- swan-lake/by-example/identifiers/content.jsx | 2 +- swan-lake/by-example/identity/content.jsx | 2 +- swan-lake/by-example/if-statement/content.jsx | 2 +- .../content.jsx | 2 +- swan-lake/by-example/immutability/content.jsx | 2 +- .../included-record-parameters/content.jsx | 2 +- swan-lake/by-example/index.jsx | 12 + .../by-example/inferring-isolated/content.jsx | 2 +- .../by-example/init-function/content.jsx | 2 +- .../by-example/init-return-type/content.jsx | 2 +- swan-lake/by-example/int-range/content.jsx | 2 +- swan-lake/by-example/integers/content.jsx | 2 +- .../content.jsx | 14 +- .../inter-worker-message-passing/content.jsx | 8 +- .../interface-to-external-code/content.jsx | 2 +- swan-lake/by-example/io-bytes/content.jsx | 2 +- .../by-example/io-csv-datamapping/content.jsx | 2 +- swan-lake/by-example/io-csv/content.jsx | 2 +- swan-lake/by-example/io-json/content.jsx | 2 +- swan-lake/by-example/io-strings/content.jsx | 2 +- swan-lake/by-example/io-xml/content.jsx | 2 +- .../by-example/isolated-functions/content.jsx | 2 +- .../by-example/isolated-methods/content.jsx | 2 +- .../by-example/isolated-objects/content.jsx | 2 +- .../by-example/isolated-variables/content.jsx | 2 +- .../iterating-over-xml-with-query/content.jsx | 2 +- .../content.jsx | 2 +- .../jms-consumer-acknowledgement/content.jsx | 2 +- .../jms-consumer-consume-message/content.jsx | 2 +- .../jms-producer-produce-message/content.jsx | 2 +- .../jms-producer-transaction/content.jsx | 2 +- .../jms-service-consume-message/content.jsx | 2 +- .../joining-iterable-objects/content.jsx | 2 +- swan-lake/by-example/json-numbers/content.jsx | 2 +- .../content.jsx | 43 +-- .../by-example/json-to-record/content.jsx | 2 +- swan-lake/by-example/json-type/content.jsx | 2 +- .../jsonpath-expressions/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../kafka-consumer-sasl/content.jsx | 2 +- .../by-example/kafka-consumer-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../kafka-producer-sasl/content.jsx | 2 +- .../by-example/kafka-producer-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../kafka-service-consume-message/content.jsx | 2 +- .../kafka-service-error-handling/content.jsx | 2 +- .../by-example/kafka-service-sasl/content.jsx | 2 +- .../by-example/kafka-service-ssl/content.jsx | 2 +- .../kubernetes-hello-world/content.jsx | 4 +- .../by-example/langlib-functions/content.jsx | 2 +- swan-lake/by-example/let-clause/content.jsx | 2 +- swan-lake/by-example/limit-clause/content.jsx | 2 +- .../content.jsx | 2 +- .../list-binding-pattern/content.jsx | 2 +- .../by-example/list-equality/content.jsx | 2 +- .../by-example/list-subtyping/content.jsx | 2 +- .../by-example/lock-statement/content.jsx | 2 +- .../logging-configuration/content.jsx | 2 +- .../logging-with-context/content.jsx | 2 +- swan-lake/by-example/logging/content.jsx | 2 +- .../by-example/main-function/content.jsx | 2 +- .../manage-scheduled-jobs/content.jsx | 2 +- .../content.jsx | 2 +- .../mapping-binding-pattern/content.jsx | 2 +- swan-lake/by-example/maps/content.jsx | 2 +- .../content.jsx | 2 +- .../match-statement-with-maps/content.jsx | 2 +- .../by-example/match-statement/content.jsx | 2 +- .../by-example/module-lifecycle/content.jsx | 2 +- .../content.jsx | 2 +- .../mqtt-client-publish-message/content.jsx | 2 +- .../by-example/mqtt-client-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/mqtt-service-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../multiple-key-fields/content.jsx | 2 +- .../by-example/multiple-wait/content.jsx | 2 +- .../mysql-atomic-transaction/content.jsx | 4 +- .../mysql-batch-execute-operation/content.jsx | 2 +- .../mysql-call-stored-procedures/content.jsx | 2 +- .../mysql-execute-operation/content.jsx | 2 +- .../mysql-query-column-mapping/content.jsx | 2 +- .../mysql-query-operation/content.jsx | 2 +- .../mysql-query-row-operation/content.jsx | 2 +- .../named-worker-return-values/content.jsx | 2 +- .../content.jsx | 268 +++++++++++++++++ .../liquid.json | 18 ++ .../named-workers-and-futures/content.jsx | 2 +- .../by-example/named-workers/content.jsx | 2 +- .../by-example/nats-basic-pub/content.jsx | 2 +- .../by-example/nats-basic-reply/content.jsx | 2 +- .../by-example/nats-basic-request/content.jsx | 2 +- .../by-example/nats-basic-sub/content.jsx | 2 +- .../nats-client-basic-auth/content.jsx | 2 +- .../nats-client-secure-connection/content.jsx | 2 +- .../by-example/nats-jetstream-pub/content.jsx | 2 +- .../by-example/nats-jetstream-sub/content.jsx | 2 +- .../nats-service-basic-auth/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/nested-arrays/content.jsx | 2 +- .../nested-query-expressions/content.jsx | 2 +- swan-lake/by-example/never-type/content.jsx | 2 +- swan-lake/by-example/nil/content.jsx | 2 +- .../by-example/object-closure/content.jsx | 2 +- .../by-example/object-constructor/content.jsx | 2 +- .../object-type-inclusion/content.jsx | 2 +- swan-lake/by-example/object-types/content.jsx | 2 +- .../content.jsx | 2 +- swan-lake/by-example/object/content.jsx | 2 +- .../by-example/on-conflict-clause/content.jsx | 2 +- swan-lake/by-example/open-records/content.jsx | 2 +- .../by-example/optional-fields/content.jsx | 2 +- .../by-example/outer-join-clause/content.jsx | 2 +- swan-lake/by-example/panics/content.jsx | 2 +- .../by-example/persist-create/content.jsx | 4 +- .../by-example/persist-delete/content.jsx | 4 +- .../by-example/persist-filtering/content.jsx | 4 +- .../by-example/persist-get-all/content.jsx | 4 +- .../by-example/persist-get-by-key/content.jsx | 4 +- .../persist-relation-queries/content.jsx | 4 +- .../persist-select-fields/content.jsx | 4 +- .../by-example/persist-update/content.jsx | 4 +- .../programs-and-modules/content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/providing-services/content.jsx | 2 +- .../by-example/query-actions/content.jsx | 2 +- .../by-example/query-expressions/content.jsx | 2 +- .../by-example/querying-tables/content.jsx | 2 +- .../querying-with-streams/content.jsx | 2 +- .../rabbitmq-client-basic-auth/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/rabbitmq-consumer/content.jsx | 2 +- .../by-example/rabbitmq-producer/content.jsx | 2 +- .../rabbitmq-queue-declare/content.jsx | 2 +- .../rabbitmq-service-basic-auth/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../rabbitmq-sync-consumer/content.jsx | 2 +- .../rabbitmq-transaction-consumer/content.jsx | 2 +- .../rabbitmq-transaction-producer/content.jsx | 2 +- .../by-example/random-numbers/content.jsx | 2 +- .../by-example/raw-templates/content.jsx | 4 +- .../readonly-and-isolated/content.jsx | 2 +- .../readonly-objects-and-classes/content.jsx | 2 +- .../by-example/readonly-type/content.jsx | 2 +- .../receive-email-using-client/content.jsx | 2 +- .../receive-email-using-service/content.jsx | 2 +- .../by-example/record-to-edi/content.jsx | 6 +- swan-lake/by-example/records/content.jsx | 2 +- .../by-example/regexp-operations/content.jsx | 2 +- swan-lake/by-example/regexp-type/content.jsx | 2 +- .../resource-method-typing/content.jsx | 2 +- .../by-example/resource-methods/content.jsx | 2 +- .../resource-path-parameters/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/rest-parameters/content.jsx | 2 +- .../rest-type-in-tuples/content.jsx | 2 +- .../retry-transaction-statement/content.jsx | 2 +- swan-lake/by-example/rollback/content.jsx | 2 +- .../content.jsx | 2 +- .../by-example/security-crypto/content.jsx | 2 +- .../security-jwt-issue-validate/content.jsx | 2 +- swan-lake/by-example/send-email/content.jsx | 2 +- .../by-example/sequence-diagrams/content.jsx | 2 +- .../service-declaration/content.jsx | 2 +- .../sftp-client-receive-file/content.jsx | 2 +- .../sftp-client-send-file/content.jsx | 2 +- .../sftp-service-receive-file/content.jsx | 2 +- .../sftp-service-send-file/content.jsx | 2 +- .../single-use-of-typed-binding/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../soap-client-security-ssl-tsl/content.jsx | 2 +- .../soap-client-send-receive/content.jsx | 2 +- .../sort-iterable-objects/content.jsx | 2 +- .../content.jsx | 2 +- swan-lake/by-example/stop-handler/content.jsx | 2 +- swan-lake/by-example/strands/content.jsx | 2 +- swan-lake/by-example/stream-type/content.jsx | 2 +- swan-lake/by-example/strings/content.jsx | 2 +- .../by-example/structural-typing/content.jsx | 2 +- .../by-example/structured-keys/content.jsx | 2 +- .../synchronize-message-passing/content.jsx | 8 +- swan-lake/by-example/table-types/content.jsx | 2 +- swan-lake/by-example/table/content.jsx | 2 +- .../task-frequency-job-execution/content.jsx | 2 +- .../task-one-time-job-execution/content.jsx | 2 +- .../by-example/tcp-client-ssl-tls/content.jsx | 2 +- swan-lake/by-example/tcp-client/content.jsx | 2 +- swan-lake/by-example/tcp-listener/content.jsx | 2 +- .../tcp-service-ssl-tls/content.jsx | 2 +- .../temp-files-directories/content.jsx | 2 +- .../testerina-assertions/content.jsx | 26 +- .../content.jsx | 16 +- .../content.jsx | 14 +- .../content.jsx | 18 +- .../content.jsx | 2 +- .../testerina-data-driven-tests/content.jsx | 2 +- .../testerina-group-tests/content.jsx | 14 +- .../content.jsx | 14 +- .../testerina-mocking-functions/content.jsx | 18 +- .../testerina-mocking-objects/content.jsx | 26 +- .../time-formatting-and-parsing/content.jsx | 2 +- .../by-example/time-utc-and-civil/content.jsx | 2 +- swan-lake/by-example/time-utc/content.jsx | 2 +- swan-lake/by-example/tracing/content.jsx | 2 +- .../transaction-statement/content.jsx | 2 +- .../transactional-named-workers/content.jsx | 2 +- .../transactional-qualifier/content.jsx | 2 +- swan-lake/by-example/tuples/content.jsx | 2 +- .../by-example/type-definitions/content.jsx | 2 +- .../type-inclusion-for-records/content.jsx | 2 +- .../by-example/type-inference/content.jsx | 2 +- .../typed-binding-pattern/content.jsx | 2 +- .../by-example/typedesc-type/content.jsx | 2 +- swan-lake/by-example/udp-client/content.jsx | 2 +- .../by-example/udp-connect-client/content.jsx | 2 +- swan-lake/by-example/udp-listener/content.jsx | 2 +- swan-lake/by-example/unions/content.jsx | 2 +- .../by-example/url-encode-decode/content.jsx | 2 +- .../by-example/uuid-generation/content.jsx | 2 +- .../by-example/uuid-operations/content.jsx | 2 +- .../variables-and-types/content.jsx | 2 +- .../content.jsx | 2 +- .../waiting-for-workers/content.jsx | 2 +- .../websocket-basic-sample/content.jsx | 2 +- .../websocket-client-basic-auth/content.jsx | 2 +- .../content.jsx | 2 +- .../websocket-client-mutual-ssl/content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../websocket-client-ssl-tls/content.jsx | 2 +- .../by-example/websocket-client/content.jsx | 2 +- .../websocket-retry-client/content.jsx | 2 +- .../content.jsx | 4 +- .../content.jsx | 2 +- .../content.jsx | 2 +- .../websocket-service-jwt-auth/content.jsx | 2 +- .../websocket-service-mutual-ssl/content.jsx | 2 +- .../websocket-service-oauth2/content.jsx | 2 +- .../content.jsx | 2 +- .../websocket-service-ssl-tls/content.jsx | 2 +- .../websocket-timeout-client/content.jsx | 2 +- .../websub-webhook-sample/content.jsx | 2 +- .../by-example/while-statement/content.jsx | 2 +- .../wildcard-binding-pattern/content.jsx | 2 +- swan-lake/by-example/xml-access/content.jsx | 2 +- .../by-example/xml-data-model/content.jsx | 2 +- .../xml-from-json-conversion/content.jsx | 2 +- .../xml-from-record-conversion/content.jsx | 2 +- .../by-example/xml-iteration/content.jsx | 2 +- swan-lake/by-example/xml-mutation/content.jsx | 2 +- .../by-example/xml-namespaces/content.jsx | 2 +- .../by-example/xml-navigation/content.jsx | 2 +- .../by-example/xml-operations/content.jsx | 2 +- .../by-example/xml-subtyping/content.jsx | 2 +- .../xml-templates-and-query/content.jsx | 2 +- .../by-example/xml-templates/content.jsx | 2 +- .../xml-to-json-conversion/content.jsx | 2 +- .../xml-to-record-conversion/content.jsx | 2 +- .../xml-to-record-with-projection/content.jsx | 44 +-- .../by-example/xml-to-record/content.jsx | 2 +- .../by-example/xmlns-declarations/content.jsx | 2 +- .../xslt-transformation/content.jsx | 2 +- 522 files changed, 1302 insertions(+), 734 deletions(-) create mode 100644 swan-lake/by-example/conditional-send/content.jsx create mode 100644 swan-lake/by-example/conditional-send/liquid.json create mode 100644 swan-lake/by-example/named-worker-with-on-fail-clause/content.jsx create mode 100644 swan-lake/by-example/named-worker-with-on-fail-clause/liquid.json diff --git a/_data/ballerina-by-example-nav.yml b/_data/ballerina-by-example-nav.yml index cfee31419fcf..13c89b971484 100644 --- a/_data/ballerina-by-example-nav.yml +++ b/_data/ballerina-by-example-nav.yml @@ -628,20 +628,26 @@ sublinks: - title: Inter-worker message passing id: 10 url: inter-worker-message-passing - - title: Inter-worker failure propagation + - title: Conditional send id: 11 + url: conditional-send + - title: Inter-worker failure propagation + id: 12 url: inter-worker-failure-propagation + - title: Named worker with on fail clause + id: 13 + url: named-worker-with-on-fail-clause - title: Synchronize message passing - id: 12 + id: 14 url: synchronize-message-passing - title: Asynchronize message passing - id: 13 + id: 15 url: asynchronize-message-passing - title: Flush - id: 14 + id: 16 url: flush - title: Fork - id: 15 + id: 17 url: fork - title: Transactions id: 31 diff --git a/swan-lake/by-example/access-json-elements/content.jsx b/swan-lake/by-example/access-json-elements/content.jsx index f0f8810af700..46bb5240bb28 100644 --- a/swan-lake/by-example/access-json-elements/content.jsx +++ b/swan-lake/by-example/access-json-elements/content.jsx @@ -88,7 +88,7 @@ export function AccessJsonElements({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/access-json-elements", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/access-json-elements", "_blank", ); }} diff --git a/swan-lake/by-example/access-optional-json-elements/content.jsx b/swan-lake/by-example/access-optional-json-elements/content.jsx index 8ce47cf9ae5a..476c80f360d0 100644 --- a/swan-lake/by-example/access-optional-json-elements/content.jsx +++ b/swan-lake/by-example/access-optional-json-elements/content.jsx @@ -62,7 +62,7 @@ export function AccessOptionalJsonElements({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/access-optional-json-elements", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/access-optional-json-elements", "_blank", ); }} diff --git a/swan-lake/by-example/aggregation/content.jsx b/swan-lake/by-example/aggregation/content.jsx index c9767a9a3466..c800c2600b07 100644 --- a/swan-lake/by-example/aggregation/content.jsx +++ b/swan-lake/by-example/aggregation/content.jsx @@ -84,7 +84,7 @@ export function Aggregation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/aggregation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/aggregation", "_blank", ); }} diff --git a/swan-lake/by-example/all-bbes.json b/swan-lake/by-example/all-bbes.json index 5b8d74ced3d4..6d0913ac28c6 100644 --- a/swan-lake/by-example/all-bbes.json +++ b/swan-lake/by-example/all-bbes.json @@ -1475,6 +1475,13 @@ "verifyOutput": true, "isLearnByExample": true }, + { + "name": "Conditional send", + "url": "conditional-send", + "verifyBuild": true, + "verifyOutput": true, + "isLearnByExample": true + }, { "name": "Inter-worker failure propagation", "url": "inter-worker-failure-propagation", @@ -1482,6 +1489,13 @@ "verifyOutput": true, "isLearnByExample": true }, + { + "name": "Named worker with on fail clause", + "url": "named-worker-with-on-fail-clause", + "verifyBuild": true, + "verifyOutput": true, + "isLearnByExample": true + }, { "name": "Synchronize message passing", "url": "synchronize-message-passing", @@ -3535,7 +3549,7 @@ "name": "Send/Receive", "url": "soap-client-send-receive", "verifyBuild": true, - "verifyOutput": true, + "verifyOutput": false, "disablePlayground": true, "isLearnByExample": false } diff --git a/swan-lake/by-example/alternate-wait/content.jsx b/swan-lake/by-example/alternate-wait/content.jsx index 2bf1c61c3117..acaec1c97178 100644 --- a/swan-lake/by-example/alternate-wait/content.jsx +++ b/swan-lake/by-example/alternate-wait/content.jsx @@ -68,7 +68,7 @@ export function AlternateWait({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/alternate-wait", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/alternate-wait", "_blank", ); }} diff --git a/swan-lake/by-example/annotations/content.jsx b/swan-lake/by-example/annotations/content.jsx index b16d2082c106..0dce76cc8724 100644 --- a/swan-lake/by-example/annotations/content.jsx +++ b/swan-lake/by-example/annotations/content.jsx @@ -72,7 +72,7 @@ export function Annotations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/annotations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/annotations", "_blank", ); }} diff --git a/swan-lake/by-example/anonymous-function/content.jsx b/swan-lake/by-example/anonymous-function/content.jsx index eabb9b87d31a..0978d5c5e813 100644 --- a/swan-lake/by-example/anonymous-function/content.jsx +++ b/swan-lake/by-example/anonymous-function/content.jsx @@ -62,7 +62,7 @@ export function AnonymousFunction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/anonymous-function", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/anonymous-function", "_blank", ); }} diff --git a/swan-lake/by-example/any-type/content.jsx b/swan-lake/by-example/any-type/content.jsx index 1f92ed3a1cd6..3d3ac44c11e2 100644 --- a/swan-lake/by-example/any-type/content.jsx +++ b/swan-lake/by-example/any-type/content.jsx @@ -60,7 +60,7 @@ export function AnyType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/any-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/any-type", "_blank", ); }} diff --git a/swan-lake/by-example/anydata-type/content.jsx b/swan-lake/by-example/anydata-type/content.jsx index e3d42ff2a1b6..13e9a176cf9b 100644 --- a/swan-lake/by-example/anydata-type/content.jsx +++ b/swan-lake/by-example/anydata-type/content.jsx @@ -58,7 +58,7 @@ export function AnydataType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/anydata-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/anydata-type", "_blank", ); }} diff --git a/swan-lake/by-example/array-map-symmetry/content.jsx b/swan-lake/by-example/array-map-symmetry/content.jsx index 638632c645a9..09312ae49cf0 100644 --- a/swan-lake/by-example/array-map-symmetry/content.jsx +++ b/swan-lake/by-example/array-map-symmetry/content.jsx @@ -120,7 +120,7 @@ export function ArrayMapSymmetry({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/array-map-symmetry", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/array-map-symmetry", "_blank", ); }} diff --git a/swan-lake/by-example/arrays/content.jsx b/swan-lake/by-example/arrays/content.jsx index ce0da820d0d6..61704ab6572f 100644 --- a/swan-lake/by-example/arrays/content.jsx +++ b/swan-lake/by-example/arrays/content.jsx @@ -99,7 +99,7 @@ export function Arrays({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/arrays", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/arrays", "_blank", ); }} diff --git a/swan-lake/by-example/asynchronize-message-passing/content.jsx b/swan-lake/by-example/asynchronize-message-passing/content.jsx index ebc7bf777d5a..5c1a49ba5f8e 100644 --- a/swan-lake/by-example/asynchronize-message-passing/content.jsx +++ b/swan-lake/by-example/asynchronize-message-passing/content.jsx @@ -63,7 +63,7 @@ export function AsynchronizeMessagePassing({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/asynchronize-message-passing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/asynchronize-message-passing", "_blank", ); }} diff --git a/swan-lake/by-example/asynchronous-function-calls/content.jsx b/swan-lake/by-example/asynchronous-function-calls/content.jsx index f09f449790a7..9db652a8ea8b 100644 --- a/swan-lake/by-example/asynchronous-function-calls/content.jsx +++ b/swan-lake/by-example/asynchronous-function-calls/content.jsx @@ -58,7 +58,7 @@ export function AsynchronousFunctionCalls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/asynchronous-function-calls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/asynchronous-function-calls", "_blank", ); }} diff --git a/swan-lake/by-example/avro-serdes/content.jsx b/swan-lake/by-example/avro-serdes/content.jsx index a2f6000d4687..bc4f8d30cd60 100644 --- a/swan-lake/by-example/avro-serdes/content.jsx +++ b/swan-lake/by-example/avro-serdes/content.jsx @@ -90,7 +90,7 @@ export function AvroSerdes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/avro-serdes", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/avro-serdes", "_blank", ); }} diff --git a/swan-lake/by-example/aws-lambda-dynamodb-trigger/content.jsx b/swan-lake/by-example/aws-lambda-dynamodb-trigger/content.jsx index f7b5e97cb53b..22a12f2bf218 100644 --- a/swan-lake/by-example/aws-lambda-dynamodb-trigger/content.jsx +++ b/swan-lake/by-example/aws-lambda-dynamodb-trigger/content.jsx @@ -150,7 +150,7 @@ export function AwsLambdaDynamodbTrigger({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/aws-lambda-dynamodb-trigger", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/aws-lambda-dynamodb-trigger", "_blank", ); }} diff --git a/swan-lake/by-example/aws-lambda-execution-context/content.jsx b/swan-lake/by-example/aws-lambda-execution-context/content.jsx index bb119e86a1c5..eaf5608f354a 100644 --- a/swan-lake/by-example/aws-lambda-execution-context/content.jsx +++ b/swan-lake/by-example/aws-lambda-execution-context/content.jsx @@ -155,7 +155,7 @@ export function AwsLambdaExecutionContext({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/aws-lambda-execution-context", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/aws-lambda-execution-context", "_blank", ); }} diff --git a/swan-lake/by-example/aws-lambda-hello-world/content.jsx b/swan-lake/by-example/aws-lambda-hello-world/content.jsx index d3c45e24ffc3..2bae8841a27a 100644 --- a/swan-lake/by-example/aws-lambda-hello-world/content.jsx +++ b/swan-lake/by-example/aws-lambda-hello-world/content.jsx @@ -151,7 +151,7 @@ export function AwsLambdaHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/aws-lambda-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/aws-lambda-hello-world", "_blank", ); }} diff --git a/swan-lake/by-example/aws-lambda-s3-trigger/content.jsx b/swan-lake/by-example/aws-lambda-s3-trigger/content.jsx index 064226055001..7d9aefdc7887 100644 --- a/swan-lake/by-example/aws-lambda-s3-trigger/content.jsx +++ b/swan-lake/by-example/aws-lambda-s3-trigger/content.jsx @@ -149,7 +149,7 @@ export function AwsLambdaS3Trigger({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/aws-lambda-s3-trigger", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/aws-lambda-s3-trigger", "_blank", ); }} diff --git a/swan-lake/by-example/azure-functions-cosmosdb-trigger/content.jsx b/swan-lake/by-example/azure-functions-cosmosdb-trigger/content.jsx index 36b84244082e..78d37eb17cfc 100644 --- a/swan-lake/by-example/azure-functions-cosmosdb-trigger/content.jsx +++ b/swan-lake/by-example/azure-functions-cosmosdb-trigger/content.jsx @@ -296,7 +296,7 @@ export function AzureFunctionsCosmosdbTrigger({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/azure-functions-cosmosdb-trigger", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/azure-functions-cosmosdb-trigger", "_blank", ); }} diff --git a/swan-lake/by-example/azure-functions-hello-world/content.jsx b/swan-lake/by-example/azure-functions-hello-world/content.jsx index 828b94f81298..6d7ae4cede91 100644 --- a/swan-lake/by-example/azure-functions-hello-world/content.jsx +++ b/swan-lake/by-example/azure-functions-hello-world/content.jsx @@ -178,7 +178,7 @@ export function AzureFunctionsHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/azure-functions-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/azure-functions-hello-world", "_blank", ); }} diff --git a/swan-lake/by-example/azure-functions-http-trigger-with-queue/content.jsx b/swan-lake/by-example/azure-functions-http-trigger-with-queue/content.jsx index 4f2cc67f7ee1..78831f41113e 100644 --- a/swan-lake/by-example/azure-functions-http-trigger-with-queue/content.jsx +++ b/swan-lake/by-example/azure-functions-http-trigger-with-queue/content.jsx @@ -210,7 +210,7 @@ export function AzureFunctionsHttpTriggerWithQueue({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/azure-functions-http-trigger-with-queue", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/azure-functions-http-trigger-with-queue", "_blank", ); }} diff --git a/swan-lake/by-example/azure-functions-timer-trigger/content.jsx b/swan-lake/by-example/azure-functions-timer-trigger/content.jsx index 439236c1ac79..bed2e965b077 100644 --- a/swan-lake/by-example/azure-functions-timer-trigger/content.jsx +++ b/swan-lake/by-example/azure-functions-timer-trigger/content.jsx @@ -155,7 +155,7 @@ export function AzureFunctionsTimerTrigger({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/azure-functions-timer-trigger", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/azure-functions-timer-trigger", "_blank", ); }} diff --git a/swan-lake/by-example/backtick-templates/content.jsx b/swan-lake/by-example/backtick-templates/content.jsx index 8eee0ab7bf55..a834e7b21c4e 100644 --- a/swan-lake/by-example/backtick-templates/content.jsx +++ b/swan-lake/by-example/backtick-templates/content.jsx @@ -73,7 +73,7 @@ export function BacktickTemplates({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/backtick-templates", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/backtick-templates", "_blank", ); }} diff --git a/swan-lake/by-example/binary-data/content.jsx b/swan-lake/by-example/binary-data/content.jsx index fe0e1a7a2e44..2d7405f744d9 100644 --- a/swan-lake/by-example/binary-data/content.jsx +++ b/swan-lake/by-example/binary-data/content.jsx @@ -50,7 +50,7 @@ export function BinaryData({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/binary-data", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/binary-data", "_blank", ); }} diff --git a/swan-lake/by-example/binding-patterns-in-match-statement/content.jsx b/swan-lake/by-example/binding-patterns-in-match-statement/content.jsx index a20f1c4e84c5..7cf027e8377c 100644 --- a/swan-lake/by-example/binding-patterns-in-match-statement/content.jsx +++ b/swan-lake/by-example/binding-patterns-in-match-statement/content.jsx @@ -97,7 +97,7 @@ export function BindingPatternsInMatchStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/binding-patterns-in-match-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/binding-patterns-in-match-statement", "_blank", ); }} diff --git a/swan-lake/by-example/binding-patterns/content.jsx b/swan-lake/by-example/binding-patterns/content.jsx index f233a44af65f..b2154f16c32b 100644 --- a/swan-lake/by-example/binding-patterns/content.jsx +++ b/swan-lake/by-example/binding-patterns/content.jsx @@ -55,7 +55,7 @@ export function BindingPatterns({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/binding-patterns", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/binding-patterns", "_blank", ); }} diff --git a/swan-lake/by-example/boolean/content.jsx b/swan-lake/by-example/boolean/content.jsx index ff2db87d0f8f..763945637036 100644 --- a/swan-lake/by-example/boolean/content.jsx +++ b/swan-lake/by-example/boolean/content.jsx @@ -51,7 +51,7 @@ export function Boolean({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/boolean", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/boolean", "_blank", ); }} diff --git a/swan-lake/by-example/break-statement/content.jsx b/swan-lake/by-example/break-statement/content.jsx index cfe4472e1108..378902b8efb6 100644 --- a/swan-lake/by-example/break-statement/content.jsx +++ b/swan-lake/by-example/break-statement/content.jsx @@ -59,7 +59,7 @@ export function BreakStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/break-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/break-statement", "_blank", ); }} diff --git a/swan-lake/by-example/built-in-integer-subtypes/content.jsx b/swan-lake/by-example/built-in-integer-subtypes/content.jsx index ed076eeafcca..4d29319a4916 100644 --- a/swan-lake/by-example/built-in-integer-subtypes/content.jsx +++ b/swan-lake/by-example/built-in-integer-subtypes/content.jsx @@ -138,7 +138,7 @@ export function BuiltInIntegerSubtypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/built-in-integer-subtypes", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/built-in-integer-subtypes", "_blank", ); }} diff --git a/swan-lake/by-example/built-in-string-subtype/content.jsx b/swan-lake/by-example/built-in-string-subtype/content.jsx index 50dbbe809c0f..332d0fa3646b 100644 --- a/swan-lake/by-example/built-in-string-subtype/content.jsx +++ b/swan-lake/by-example/built-in-string-subtype/content.jsx @@ -59,7 +59,7 @@ export function BuiltInStringSubtype({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/built-in-string-subtype", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/built-in-string-subtype", "_blank", ); }} diff --git a/swan-lake/by-example/cache-basics/content.jsx b/swan-lake/by-example/cache-basics/content.jsx index c450da77ae15..ba979508089c 100644 --- a/swan-lake/by-example/cache-basics/content.jsx +++ b/swan-lake/by-example/cache-basics/content.jsx @@ -74,7 +74,7 @@ export function CacheBasics({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/cache-basics", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/cache-basics", "_blank", ); }} diff --git a/swan-lake/by-example/cache-invalidation/content.jsx b/swan-lake/by-example/cache-invalidation/content.jsx index 509ee23f3aeb..06cc0b79b161 100644 --- a/swan-lake/by-example/cache-invalidation/content.jsx +++ b/swan-lake/by-example/cache-invalidation/content.jsx @@ -86,7 +86,7 @@ export function CacheInvalidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/cache-invalidation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/cache-invalidation", "_blank", ); }} diff --git a/swan-lake/by-example/casting-json-to-user-defined-type/content.jsx b/swan-lake/by-example/casting-json-to-user-defined-type/content.jsx index cb976a6baa58..f79f2c9384c7 100644 --- a/swan-lake/by-example/casting-json-to-user-defined-type/content.jsx +++ b/swan-lake/by-example/casting-json-to-user-defined-type/content.jsx @@ -73,7 +73,7 @@ export function CastingJsonToUserDefinedType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/casting-json-to-user-defined-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/casting-json-to-user-defined-type", "_blank", ); }} diff --git a/swan-lake/by-example/check-expression/content.jsx b/swan-lake/by-example/check-expression/content.jsx index f9e8f047569b..0ef70670fa04 100644 --- a/swan-lake/by-example/check-expression/content.jsx +++ b/swan-lake/by-example/check-expression/content.jsx @@ -60,7 +60,7 @@ export function CheckExpression({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/check-expression", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/check-expression", "_blank", ); }} diff --git a/swan-lake/by-example/check-semantics/content.jsx b/swan-lake/by-example/check-semantics/content.jsx index 78a8ab7e6f5a..5aa439d06d38 100644 --- a/swan-lake/by-example/check-semantics/content.jsx +++ b/swan-lake/by-example/check-semantics/content.jsx @@ -83,7 +83,7 @@ export function CheckSemantics({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/check-semantics", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/check-semantics", "_blank", ); }} diff --git a/swan-lake/by-example/client-class/content.jsx b/swan-lake/by-example/client-class/content.jsx index 46d1478b675c..8677ef060adb 100644 --- a/swan-lake/by-example/client-class/content.jsx +++ b/swan-lake/by-example/client-class/content.jsx @@ -97,7 +97,7 @@ export function ClientClass({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/client-class", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/client-class", "_blank", ); }} diff --git a/swan-lake/by-example/combining-isolated-functions-and-lock/content.jsx b/swan-lake/by-example/combining-isolated-functions-and-lock/content.jsx index fc81f62cb126..92f774700182 100644 --- a/swan-lake/by-example/combining-isolated-functions-and-lock/content.jsx +++ b/swan-lake/by-example/combining-isolated-functions-and-lock/content.jsx @@ -101,7 +101,7 @@ export function CombiningIsolatedFunctionsAndLock({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/combining-isolated-functions-and-lock", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/combining-isolated-functions-and-lock", "_blank", ); }} diff --git a/swan-lake/by-example/commit-rollback-handlers/content.jsx b/swan-lake/by-example/commit-rollback-handlers/content.jsx index 07f3af7d05ae..9998259b03ad 100644 --- a/swan-lake/by-example/commit-rollback-handlers/content.jsx +++ b/swan-lake/by-example/commit-rollback-handlers/content.jsx @@ -74,7 +74,7 @@ export function CommitRollbackHandlers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/commit-rollback-handlers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/commit-rollback-handlers", "_blank", ); }} diff --git a/swan-lake/by-example/computed-field-key/content.jsx b/swan-lake/by-example/computed-field-key/content.jsx index 6c42bcb423fd..f8c4f328c8c9 100644 --- a/swan-lake/by-example/computed-field-key/content.jsx +++ b/swan-lake/by-example/computed-field-key/content.jsx @@ -62,7 +62,7 @@ export function ComputedFieldKey({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/computed-field-key", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/computed-field-key", "_blank", ); }} diff --git a/swan-lake/by-example/conditional-send/content.jsx b/swan-lake/by-example/conditional-send/content.jsx new file mode 100644 index 000000000000..07cfd635eb47 --- /dev/null +++ b/swan-lake/by-example/conditional-send/content.jsx @@ -0,0 +1,284 @@ +import React, { useState, createRef } from "react"; +import { Container, Row, Col } from "react-bootstrap"; +import DOMPurify from "dompurify"; +import { copyToClipboard, extractOutput } from "../../../utils/bbe"; +import Link from "next/link"; + +export const codeSnippetData = [ + `import ballerina/io; + +public function main() { + boolean isDataReady = true; + + worker w1 { + // A send action can be used in a conditional context. + if isDataReady { + 10 -> function; + } + } + worker w2 { + if isDataReady { + 1 -> function; + } else { + 0 -> function; + } + } + + // The send action corresponding to this receive action is conditionally executed. + // Thus, there is a possibility that the send action may not get executed. + // Therefore, the static type of the receive includes the \`error:NoMessage\` type + // indicating the absence of a message in such cases. + int|error:NoMessage w1Message = <- w1; + io:println(w1Message); + + // Two different conditional send actions exist within the worker \`w3\`. + // Therefore, an alternate receive action can be used to receive them. + int|error:NoMessage w2Message = <- w2 | w2; + io:println(w2Message); +} +`, +]; + +export function ConditionalSend({ codeSnippets }) { + const [codeClick1, updateCodeClick1] = useState(false); + + const [outputClick1, updateOutputClick1] = useState(false); + const ref1 = createRef(); + + const [btnHover, updateBtnHover] = useState([false, false]); + + return ( + +

Conditional send

+ +

+ The send action in workers can be used in a conditional context, + allowing for more flexible and dynamic inter-worker communication based + on specific conditions. The receiver side in a conditional send might + not always receive a message. Thus, to handle such scenarios, the static + type of the receive action includes the error:NoMessage{" "} + type. +

+ + + + + {codeClick1 ? ( + + ) : ( + + )} + + + {codeSnippets[0] != undefined && ( +
+ )} + + + + + + {outputClick1 ? ( + + ) : ( + + )} + + +
+            
+              {`\$ bal run conditional_send.bal`}
+              {`10`}
+              {`1`}
+            
+          
+ +
+ + + + +
+ updateBtnHover([true, false])} + onMouseOut={() => updateBtnHover([false, false])} + > + + +
+ Previous + updateBtnHover([true, false])} + onMouseOut={() => updateBtnHover([false, false])} + > + Inter-worker message passing + +
+
+ + + + +
+
+ Next + updateBtnHover([false, true])} + onMouseOut={() => updateBtnHover([false, false])} + > + Inter-worker failure propagation + +
+ updateBtnHover([false, true])} + onMouseOut={() => updateBtnHover([false, false])} + > + + +
+ + +
+ + ); +} diff --git a/swan-lake/by-example/conditional-send/liquid.json b/swan-lake/by-example/conditional-send/liquid.json new file mode 100644 index 000000000000..4bc484b0686e --- /dev/null +++ b/swan-lake/by-example/conditional-send/liquid.json @@ -0,0 +1,17 @@ +{ + "title": "Conditional send", + "description": "This BBE demonstrates the use of conditional send within workers in Ballerina", + "keywords": [ + "ballerina", + "ballerina by example", + "bbe", + "workers", + "conditional send" + ], + "permalink": "/learn/by-example/conditional-send", + "active": "conditional-send", + "redirect_from": [ + "/swan-lake/learn/by-example/conditional-send", + "/swan-lake/learn/by-example/conditional-send.html" + ] +} diff --git a/swan-lake/by-example/configurable-variables/content.jsx b/swan-lake/by-example/configurable-variables/content.jsx index 60d374a6057b..5ddf2147a5f3 100644 --- a/swan-lake/by-example/configurable-variables/content.jsx +++ b/swan-lake/by-example/configurable-variables/content.jsx @@ -51,7 +51,7 @@ export function ConfigurableVariables({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/configurable-variables", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/configurable-variables", "_blank", ); }} diff --git a/swan-lake/by-example/configuring-via-cli/content.jsx b/swan-lake/by-example/configuring-via-cli/content.jsx index 0dbed9cee9c8..5e70f55eb454 100644 --- a/swan-lake/by-example/configuring-via-cli/content.jsx +++ b/swan-lake/by-example/configuring-via-cli/content.jsx @@ -75,7 +75,7 @@ export function ConfiguringViaCli({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/configuring-via-cli", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/configuring-via-cli", "_blank", ); }} diff --git a/swan-lake/by-example/configuring-via-toml/content.jsx b/swan-lake/by-example/configuring-via-toml/content.jsx index f53efc5beea6..19df8d23f7ec 100644 --- a/swan-lake/by-example/configuring-via-toml/content.jsx +++ b/swan-lake/by-example/configuring-via-toml/content.jsx @@ -87,7 +87,7 @@ export function ConfiguringViaToml({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/configuring-via-toml", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/configuring-via-toml", "_blank", ); }} diff --git a/swan-lake/by-example/const-and-final/content.jsx b/swan-lake/by-example/const-and-final/content.jsx index 46d7aed8acb5..e5479e092ad2 100644 --- a/swan-lake/by-example/const-and-final/content.jsx +++ b/swan-lake/by-example/const-and-final/content.jsx @@ -62,7 +62,7 @@ export function ConstAndFinal({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/const-and-final", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/const-and-final", "_blank", ); }} diff --git a/swan-lake/by-example/constraint-validations/content.jsx b/swan-lake/by-example/constraint-validations/content.jsx index d3a686d8c07f..29dc88503046 100644 --- a/swan-lake/by-example/constraint-validations/content.jsx +++ b/swan-lake/by-example/constraint-validations/content.jsx @@ -93,7 +93,7 @@ export function ConstraintValidations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/constraint-validations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/constraint-validations", "_blank", ); }} diff --git a/swan-lake/by-example/consuming-services/content.jsx b/swan-lake/by-example/consuming-services/content.jsx index 0508ff96b666..6c304bd2e01c 100644 --- a/swan-lake/by-example/consuming-services/content.jsx +++ b/swan-lake/by-example/consuming-services/content.jsx @@ -54,7 +54,7 @@ export function ConsumingServices({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/consuming-services", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/consuming-services", "_blank", ); }} diff --git a/swan-lake/by-example/continue-statement/content.jsx b/swan-lake/by-example/continue-statement/content.jsx index 3aa0a2e0d228..80304629daa3 100644 --- a/swan-lake/by-example/continue-statement/content.jsx +++ b/swan-lake/by-example/continue-statement/content.jsx @@ -60,7 +60,7 @@ export function ContinueStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/continue-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/continue-statement", "_blank", ); }} diff --git a/swan-lake/by-example/controlling-openness/content.jsx b/swan-lake/by-example/controlling-openness/content.jsx index dbb80a0e8025..a04359dc2c67 100644 --- a/swan-lake/by-example/controlling-openness/content.jsx +++ b/swan-lake/by-example/controlling-openness/content.jsx @@ -75,7 +75,7 @@ export function ControllingOpenness({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/controlling-openness", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/controlling-openness", "_blank", ); }} diff --git a/swan-lake/by-example/convert-from-json-to-user-defined-type/content.jsx b/swan-lake/by-example/convert-from-json-to-user-defined-type/content.jsx index 341d00d7713c..faae1bee324c 100644 --- a/swan-lake/by-example/convert-from-json-to-user-defined-type/content.jsx +++ b/swan-lake/by-example/convert-from-json-to-user-defined-type/content.jsx @@ -82,7 +82,7 @@ export function ConvertFromJsonToUserDefinedType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/convert-from-json-to-user-defined-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/convert-from-json-to-user-defined-type", "_blank", ); }} diff --git a/swan-lake/by-example/converting-from-table-and-xml-to-json/content.jsx b/swan-lake/by-example/converting-from-table-and-xml-to-json/content.jsx index 99029a70c02f..cc7dd0a6d64c 100644 --- a/swan-lake/by-example/converting-from-table-and-xml-to-json/content.jsx +++ b/swan-lake/by-example/converting-from-table-and-xml-to-json/content.jsx @@ -53,7 +53,7 @@ export function ConvertingFromTableAndXmlToJson({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/converting-from-table-and-xml-to-json", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/converting-from-table-and-xml-to-json", "_blank", ); }} diff --git a/swan-lake/by-example/converting-from-user-defined-type-to-json/content.jsx b/swan-lake/by-example/converting-from-user-defined-type-to-json/content.jsx index 8d3615f1cf3e..ec637b770d2b 100644 --- a/swan-lake/by-example/converting-from-user-defined-type-to-json/content.jsx +++ b/swan-lake/by-example/converting-from-user-defined-type-to-json/content.jsx @@ -72,7 +72,7 @@ export function ConvertingFromUserDefinedTypeToJson({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/converting-from-user-defined-type-to-json", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/converting-from-user-defined-type-to-json", "_blank", ); }} diff --git a/swan-lake/by-example/counter-metrics/content.jsx b/swan-lake/by-example/counter-metrics/content.jsx index 83ad88a35280..676a829a5eaa 100644 --- a/swan-lake/by-example/counter-metrics/content.jsx +++ b/swan-lake/by-example/counter-metrics/content.jsx @@ -117,7 +117,7 @@ export function CounterMetrics({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/counter-metrics", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/counter-metrics", "_blank", ); }} diff --git a/swan-lake/by-example/covariance/content.jsx b/swan-lake/by-example/covariance/content.jsx index 5591f4cd90b1..631220f148ad 100644 --- a/swan-lake/by-example/covariance/content.jsx +++ b/swan-lake/by-example/covariance/content.jsx @@ -53,7 +53,7 @@ export function Covariance({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/covariance", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/covariance", "_blank", ); }} diff --git a/swan-lake/by-example/create-maps-with-query/content.jsx b/swan-lake/by-example/create-maps-with-query/content.jsx index e893e9f22a65..1c94fe0007f4 100644 --- a/swan-lake/by-example/create-maps-with-query/content.jsx +++ b/swan-lake/by-example/create-maps-with-query/content.jsx @@ -66,7 +66,7 @@ export function CreateMapsWithQuery({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/create-maps-with-query", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/create-maps-with-query", "_blank", ); }} diff --git a/swan-lake/by-example/create-streams-with-query/content.jsx b/swan-lake/by-example/create-streams-with-query/content.jsx index 7b48e5287850..0d8e996dab3c 100644 --- a/swan-lake/by-example/create-streams-with-query/content.jsx +++ b/swan-lake/by-example/create-streams-with-query/content.jsx @@ -69,7 +69,7 @@ export function CreateStreamsWithQuery({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/create-streams-with-query", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/create-streams-with-query", "_blank", ); }} diff --git a/swan-lake/by-example/create-tables-with-query/content.jsx b/swan-lake/by-example/create-tables-with-query/content.jsx index c7b8cfb7405f..9d62600dda88 100644 --- a/swan-lake/by-example/create-tables-with-query/content.jsx +++ b/swan-lake/by-example/create-tables-with-query/content.jsx @@ -69,7 +69,7 @@ export function CreateTablesWithQuery({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/create-tables-with-query", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/create-tables-with-query", "_blank", ); }} diff --git a/swan-lake/by-example/custom-prefetch-methods/content.jsx b/swan-lake/by-example/custom-prefetch-methods/content.jsx index fbc547681135..b9cad66160be 100644 --- a/swan-lake/by-example/custom-prefetch-methods/content.jsx +++ b/swan-lake/by-example/custom-prefetch-methods/content.jsx @@ -149,7 +149,7 @@ export function CustomPrefetchMethods({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/custom-prefetch-methods", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/custom-prefetch-methods", "_blank", ); }} @@ -298,7 +298,7 @@ export function CustomPrefetchMethods({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/custom-prefetch-methods", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/custom-prefetch-methods", "_blank", ); }} diff --git a/swan-lake/by-example/decimal-type/content.jsx b/swan-lake/by-example/decimal-type/content.jsx index 332ba80c49c7..000605c78123 100644 --- a/swan-lake/by-example/decimal-type/content.jsx +++ b/swan-lake/by-example/decimal-type/content.jsx @@ -63,7 +63,7 @@ export function DecimalType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/decimal-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/decimal-type", "_blank", ); }} diff --git a/swan-lake/by-example/default-values-for-function-parameters/content.jsx b/swan-lake/by-example/default-values-for-function-parameters/content.jsx index 5d51329da2e6..9676811a1b56 100644 --- a/swan-lake/by-example/default-values-for-function-parameters/content.jsx +++ b/swan-lake/by-example/default-values-for-function-parameters/content.jsx @@ -54,7 +54,7 @@ export function DefaultValuesForFunctionParameters({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/default-values-for-function-parameters", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/default-values-for-function-parameters", "_blank", ); }} diff --git a/swan-lake/by-example/default-values-for-record-fields/content.jsx b/swan-lake/by-example/default-values-for-record-fields/content.jsx index 4d6226c4b60e..1722715e0d7b 100644 --- a/swan-lake/by-example/default-values-for-record-fields/content.jsx +++ b/swan-lake/by-example/default-values-for-record-fields/content.jsx @@ -70,7 +70,7 @@ export function DefaultValuesForRecordFields({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/default-values-for-record-fields", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/default-values-for-record-fields", "_blank", ); }} diff --git a/swan-lake/by-example/defining-classes/content.jsx b/swan-lake/by-example/defining-classes/content.jsx index de34737dc527..8d3437f89f4b 100644 --- a/swan-lake/by-example/defining-classes/content.jsx +++ b/swan-lake/by-example/defining-classes/content.jsx @@ -76,7 +76,7 @@ export function DefiningClasses({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/defining-classes", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/defining-classes", "_blank", ); }} diff --git a/swan-lake/by-example/dependent-types/content.jsx b/swan-lake/by-example/dependent-types/content.jsx index 12f9ae32f6fd..5a84e257b881 100644 --- a/swan-lake/by-example/dependent-types/content.jsx +++ b/swan-lake/by-example/dependent-types/content.jsx @@ -58,7 +58,7 @@ export function DependentTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/dependent-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/dependent-types", "_blank", ); }} diff --git a/swan-lake/by-example/destructure-records-using-query/content.jsx b/swan-lake/by-example/destructure-records-using-query/content.jsx index 410c182b323d..04b9856dad19 100644 --- a/swan-lake/by-example/destructure-records-using-query/content.jsx +++ b/swan-lake/by-example/destructure-records-using-query/content.jsx @@ -73,7 +73,7 @@ export function DestructureRecordsUsingQuery({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/destructure-records-using-query", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/destructure-records-using-query", "_blank", ); }} diff --git a/swan-lake/by-example/directories/content.jsx b/swan-lake/by-example/directories/content.jsx index 786d82bbc1c6..70afeebd60a8 100644 --- a/swan-lake/by-example/directories/content.jsx +++ b/swan-lake/by-example/directories/content.jsx @@ -79,7 +79,7 @@ export function Directories({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/directories", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/directories", "_blank", ); }} diff --git a/swan-lake/by-example/directory-listener/content.jsx b/swan-lake/by-example/directory-listener/content.jsx index 935c945d86f2..86d37ed7c5d6 100644 --- a/swan-lake/by-example/directory-listener/content.jsx +++ b/swan-lake/by-example/directory-listener/content.jsx @@ -86,7 +86,7 @@ export function DirectoryListener({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/directory-listener", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/directory-listener", "_blank", ); }} diff --git a/swan-lake/by-example/distinct-object-types/content.jsx b/swan-lake/by-example/distinct-object-types/content.jsx index 45a64be780e4..b9bafb7a53bd 100644 --- a/swan-lake/by-example/distinct-object-types/content.jsx +++ b/swan-lake/by-example/distinct-object-types/content.jsx @@ -74,7 +74,7 @@ export function DistinctObjectTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/distinct-object-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/distinct-object-types", "_blank", ); }} diff --git a/swan-lake/by-example/docker-hello-world/content.jsx b/swan-lake/by-example/docker-hello-world/content.jsx index 20e3e8a1c280..74860c61c5a8 100644 --- a/swan-lake/by-example/docker-hello-world/content.jsx +++ b/swan-lake/by-example/docker-hello-world/content.jsx @@ -67,7 +67,7 @@ export function DockerHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/docker-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/docker-hello-world", "_blank", ); }} @@ -166,7 +166,7 @@ export function DockerHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/docker-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/docker-hello-world", "_blank", ); }} diff --git a/swan-lake/by-example/documentation/content.jsx b/swan-lake/by-example/documentation/content.jsx index 7feefa7ff50a..6ac338335551 100644 --- a/swan-lake/by-example/documentation/content.jsx +++ b/swan-lake/by-example/documentation/content.jsx @@ -47,7 +47,7 @@ export function Documentation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/documentation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/documentation", "_blank", ); }} diff --git a/swan-lake/by-example/dynamic-listener/content.jsx b/swan-lake/by-example/dynamic-listener/content.jsx index 38fd988724c1..a7dc233ef8f9 100644 --- a/swan-lake/by-example/dynamic-listener/content.jsx +++ b/swan-lake/by-example/dynamic-listener/content.jsx @@ -70,7 +70,7 @@ export function DynamicListener({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/dynamic-listener", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/dynamic-listener", "_blank", ); }} diff --git a/swan-lake/by-example/edi-to-record/content.jsx b/swan-lake/by-example/edi-to-record/content.jsx index 884e7c0e8d2f..ad91899ff16f 100644 --- a/swan-lake/by-example/edi-to-record/content.jsx +++ b/swan-lake/by-example/edi-to-record/content.jsx @@ -101,7 +101,7 @@ export function EdiToRecord({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/edi-to-record", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/edi-to-record", "_blank", ); }} @@ -189,7 +189,7 @@ export function EdiToRecord({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/edi-to-record", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/edi-to-record", "_blank", ); }} @@ -279,7 +279,7 @@ export function EdiToRecord({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/edi-to-record", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/edi-to-record", "_blank", ); }} @@ -579,7 +579,7 @@ export function EdiToRecord({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/edi-to-record", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/edi-to-record", "_blank", ); }} diff --git a/swan-lake/by-example/email-client-ssl-tls/content.jsx b/swan-lake/by-example/email-client-ssl-tls/content.jsx index 457352c56b64..baf38743671f 100644 --- a/swan-lake/by-example/email-client-ssl-tls/content.jsx +++ b/swan-lake/by-example/email-client-ssl-tls/content.jsx @@ -74,7 +74,7 @@ export function EmailClientSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/email-client-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/email-client-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/email-service-ssl-tls/content.jsx b/swan-lake/by-example/email-service-ssl-tls/content.jsx index 4c4c9722d5f9..ba22b3b441cb 100644 --- a/swan-lake/by-example/email-service-ssl-tls/content.jsx +++ b/swan-lake/by-example/email-service-ssl-tls/content.jsx @@ -80,7 +80,7 @@ export function EmailServiceSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/email-service-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/email-service-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/ensureType-function/content.jsx b/swan-lake/by-example/ensureType-function/content.jsx index 873d954725c9..59f0f7078356 100644 --- a/swan-lake/by-example/ensureType-function/content.jsx +++ b/swan-lake/by-example/ensureType-function/content.jsx @@ -54,7 +54,7 @@ export function EnsureTypeFunction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/ensureType-function", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/ensureType-function", "_blank", ); }} diff --git a/swan-lake/by-example/enumerations/content.jsx b/swan-lake/by-example/enumerations/content.jsx index 8f45db9ecbb8..4efd396fd8a2 100644 --- a/swan-lake/by-example/enumerations/content.jsx +++ b/swan-lake/by-example/enumerations/content.jsx @@ -61,7 +61,7 @@ export function Enumerations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/enumerations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/enumerations", "_blank", ); }} diff --git a/swan-lake/by-example/environment-variables/content.jsx b/swan-lake/by-example/environment-variables/content.jsx index db53dd3176e4..2cb8d75dd241 100644 --- a/swan-lake/by-example/environment-variables/content.jsx +++ b/swan-lake/by-example/environment-variables/content.jsx @@ -59,7 +59,7 @@ export function EnvironmentVariables({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/environment-variables", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/environment-variables", "_blank", ); }} diff --git a/swan-lake/by-example/error-binding-pattern-in-match-statement/content.jsx b/swan-lake/by-example/error-binding-pattern-in-match-statement/content.jsx index efa1a6543770..cb3e5ce7d07e 100644 --- a/swan-lake/by-example/error-binding-pattern-in-match-statement/content.jsx +++ b/swan-lake/by-example/error-binding-pattern-in-match-statement/content.jsx @@ -88,7 +88,7 @@ export function ErrorBindingPatternInMatchStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-binding-pattern-in-match-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-binding-pattern-in-match-statement", "_blank", ); }} diff --git a/swan-lake/by-example/error-binding-pattern/content.jsx b/swan-lake/by-example/error-binding-pattern/content.jsx index 35605f9fe17f..96fd9a100894 100644 --- a/swan-lake/by-example/error-binding-pattern/content.jsx +++ b/swan-lake/by-example/error-binding-pattern/content.jsx @@ -75,7 +75,7 @@ export function ErrorBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/error-cause/content.jsx b/swan-lake/by-example/error-cause/content.jsx index 18d3c7dbb8bf..d8d2200d59fa 100644 --- a/swan-lake/by-example/error-cause/content.jsx +++ b/swan-lake/by-example/error-cause/content.jsx @@ -60,7 +60,7 @@ export function ErrorCause({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-cause", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-cause", "_blank", ); }} diff --git a/swan-lake/by-example/error-detail/content.jsx b/swan-lake/by-example/error-detail/content.jsx index 903acd0c78f2..2bfad8363e3a 100644 --- a/swan-lake/by-example/error-detail/content.jsx +++ b/swan-lake/by-example/error-detail/content.jsx @@ -60,7 +60,7 @@ export function ErrorDetail({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-detail", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-detail", "_blank", ); }} diff --git a/swan-lake/by-example/error-handling/content.jsx b/swan-lake/by-example/error-handling/content.jsx index 571063c2d631..64f8ce57a8d5 100644 --- a/swan-lake/by-example/error-handling/content.jsx +++ b/swan-lake/by-example/error-handling/content.jsx @@ -64,7 +64,7 @@ export function ErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/error-reporting/content.jsx b/swan-lake/by-example/error-reporting/content.jsx index 5dd45b93ade4..6e685d7a0907 100644 --- a/swan-lake/by-example/error-reporting/content.jsx +++ b/swan-lake/by-example/error-reporting/content.jsx @@ -79,7 +79,7 @@ export function ErrorReporting({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-reporting", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-reporting", "_blank", ); }} diff --git a/swan-lake/by-example/error-subtyping/content.jsx b/swan-lake/by-example/error-subtyping/content.jsx index abbeebae5182..f9a754e97826 100644 --- a/swan-lake/by-example/error-subtyping/content.jsx +++ b/swan-lake/by-example/error-subtyping/content.jsx @@ -64,7 +64,7 @@ export function ErrorSubtyping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-subtyping", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-subtyping", "_blank", ); }} diff --git a/swan-lake/by-example/error-type-intersection/content.jsx b/swan-lake/by-example/error-type-intersection/content.jsx index 2a73c354f0a9..539a5df1f851 100644 --- a/swan-lake/by-example/error-type-intersection/content.jsx +++ b/swan-lake/by-example/error-type-intersection/content.jsx @@ -69,7 +69,7 @@ export function ErrorTypeIntersection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/error-type-intersection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/error-type-intersection", "_blank", ); }} diff --git a/swan-lake/by-example/expression-oriented-style/content.jsx b/swan-lake/by-example/expression-oriented-style/content.jsx index 3cfbcc1662df..1fbff3ca1bf5 100644 --- a/swan-lake/by-example/expression-oriented-style/content.jsx +++ b/swan-lake/by-example/expression-oriented-style/content.jsx @@ -72,7 +72,7 @@ export function ExpressionOrientedStyle({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/expression-oriented-style", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/expression-oriented-style", "_blank", ); }} diff --git a/swan-lake/by-example/filepaths/content.jsx b/swan-lake/by-example/filepaths/content.jsx index 4dfb10034500..fa7e30097806 100644 --- a/swan-lake/by-example/filepaths/content.jsx +++ b/swan-lake/by-example/filepaths/content.jsx @@ -79,7 +79,7 @@ export function Filepaths({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/filepaths", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/filepaths", "_blank", ); }} diff --git a/swan-lake/by-example/files/content.jsx b/swan-lake/by-example/files/content.jsx index f12ed1e6f2b2..2bdbde83f7c9 100644 --- a/swan-lake/by-example/files/content.jsx +++ b/swan-lake/by-example/files/content.jsx @@ -83,7 +83,7 @@ export function Files({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/files", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/files", "_blank", ); }} diff --git a/swan-lake/by-example/filler-values-of-a-list/content.jsx b/swan-lake/by-example/filler-values-of-a-list/content.jsx index e7d7a7127a23..2f56ecb36fe3 100644 --- a/swan-lake/by-example/filler-values-of-a-list/content.jsx +++ b/swan-lake/by-example/filler-values-of-a-list/content.jsx @@ -60,7 +60,7 @@ export function FillerValuesOfAList({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/filler-values-of-a-list", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/filler-values-of-a-list", "_blank", ); }} diff --git a/swan-lake/by-example/floating-point-numbers/content.jsx b/swan-lake/by-example/floating-point-numbers/content.jsx index 4ca70dce405d..1390717c8db9 100644 --- a/swan-lake/by-example/floating-point-numbers/content.jsx +++ b/swan-lake/by-example/floating-point-numbers/content.jsx @@ -54,7 +54,7 @@ export function FloatingPointNumbers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/floating-point-numbers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/floating-point-numbers", "_blank", ); }} diff --git a/swan-lake/by-example/flush/content.jsx b/swan-lake/by-example/flush/content.jsx index 9417d3d67c85..421588038420 100644 --- a/swan-lake/by-example/flush/content.jsx +++ b/swan-lake/by-example/flush/content.jsx @@ -67,7 +67,7 @@ export function Flush({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/flush", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/flush", "_blank", ); }} diff --git a/swan-lake/by-example/foreach-statement/content.jsx b/swan-lake/by-example/foreach-statement/content.jsx index d3ed0beafe14..725bd194853d 100644 --- a/swan-lake/by-example/foreach-statement/content.jsx +++ b/swan-lake/by-example/foreach-statement/content.jsx @@ -73,7 +73,7 @@ export function ForeachStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/foreach-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/foreach-statement", "_blank", ); }} diff --git a/swan-lake/by-example/fork/content.jsx b/swan-lake/by-example/fork/content.jsx index a81197f7caac..3c96af437539 100644 --- a/swan-lake/by-example/fork/content.jsx +++ b/swan-lake/by-example/fork/content.jsx @@ -63,7 +63,7 @@ export function Fork({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/fork", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/fork", "_blank", ); }} diff --git a/swan-lake/by-example/ftp-client-receive-file/content.jsx b/swan-lake/by-example/ftp-client-receive-file/content.jsx index f726c00e82ca..1fa46863bca8 100644 --- a/swan-lake/by-example/ftp-client-receive-file/content.jsx +++ b/swan-lake/by-example/ftp-client-receive-file/content.jsx @@ -65,7 +65,7 @@ export function FtpClientReceiveFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/ftp-client-receive-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/ftp-client-receive-file", "_blank", ); }} diff --git a/swan-lake/by-example/ftp-client-send-file/content.jsx b/swan-lake/by-example/ftp-client-send-file/content.jsx index 1da488d70c5f..907877338b80 100644 --- a/swan-lake/by-example/ftp-client-send-file/content.jsx +++ b/swan-lake/by-example/ftp-client-send-file/content.jsx @@ -64,7 +64,7 @@ export function FtpClientSendFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/ftp-client-send-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/ftp-client-send-file", "_blank", ); }} diff --git a/swan-lake/by-example/ftp-service-receive-file/content.jsx b/swan-lake/by-example/ftp-service-receive-file/content.jsx index 542b974110bc..4e8693afcb8b 100644 --- a/swan-lake/by-example/ftp-service-receive-file/content.jsx +++ b/swan-lake/by-example/ftp-service-receive-file/content.jsx @@ -80,7 +80,7 @@ export function FtpServiceReceiveFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/ftp-service-receive-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/ftp-service-receive-file", "_blank", ); }} diff --git a/swan-lake/by-example/ftp-service-send-file/content.jsx b/swan-lake/by-example/ftp-service-send-file/content.jsx index bf07bd776f06..beb1d0bd93e3 100644 --- a/swan-lake/by-example/ftp-service-send-file/content.jsx +++ b/swan-lake/by-example/ftp-service-send-file/content.jsx @@ -75,7 +75,7 @@ export function FtpServiceSendFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/ftp-service-send-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/ftp-service-send-file", "_blank", ); }} diff --git a/swan-lake/by-example/function-closure/content.jsx b/swan-lake/by-example/function-closure/content.jsx index 93af2474cebe..f613e6527e29 100644 --- a/swan-lake/by-example/function-closure/content.jsx +++ b/swan-lake/by-example/function-closure/content.jsx @@ -51,7 +51,7 @@ export function FunctionClosure({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/function-closure", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/function-closure", "_blank", ); }} diff --git a/swan-lake/by-example/function-pointers/content.jsx b/swan-lake/by-example/function-pointers/content.jsx index 9b2c94c6c368..a5b47a09067c 100644 --- a/swan-lake/by-example/function-pointers/content.jsx +++ b/swan-lake/by-example/function-pointers/content.jsx @@ -64,7 +64,7 @@ export function FunctionPointers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/function-pointers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/function-pointers", "_blank", ); }} diff --git a/swan-lake/by-example/function-types/content.jsx b/swan-lake/by-example/function-types/content.jsx index 84d1e06ad085..44d6d8a5b1b9 100644 --- a/swan-lake/by-example/function-types/content.jsx +++ b/swan-lake/by-example/function-types/content.jsx @@ -76,7 +76,7 @@ export function FunctionTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/function-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/function-types", "_blank", ); }} diff --git a/swan-lake/by-example/function-values/content.jsx b/swan-lake/by-example/function-values/content.jsx index 1e9408d5b84a..ce90ccf0201e 100644 --- a/swan-lake/by-example/function-values/content.jsx +++ b/swan-lake/by-example/function-values/content.jsx @@ -52,7 +52,7 @@ export function FunctionValues({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/function-values", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/function-values", "_blank", ); }} diff --git a/swan-lake/by-example/functions/content.jsx b/swan-lake/by-example/functions/content.jsx index 5ff0934aa29d..0e5549a45563 100644 --- a/swan-lake/by-example/functions/content.jsx +++ b/swan-lake/by-example/functions/content.jsx @@ -77,7 +77,7 @@ export function Functions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/functions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/functions", "_blank", ); }} diff --git a/swan-lake/by-example/gauge-metrics/content.jsx b/swan-lake/by-example/gauge-metrics/content.jsx index 681081a9d54d..6941067d04e2 100644 --- a/swan-lake/by-example/gauge-metrics/content.jsx +++ b/swan-lake/by-example/gauge-metrics/content.jsx @@ -171,7 +171,7 @@ export function GaugeMetrics({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/gauge-metrics", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/gauge-metrics", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-error-handling/content.jsx b/swan-lake/by-example/graphql-client-error-handling/content.jsx index 1b0445a99f95..ed337dfc9b2f 100644 --- a/swan-lake/by-example/graphql-client-error-handling/content.jsx +++ b/swan-lake/by-example/graphql-client-error-handling/content.jsx @@ -83,7 +83,7 @@ export function GraphqlClientErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-handle-partial-response/content.jsx b/swan-lake/by-example/graphql-client-handle-partial-response/content.jsx index c3ab3d71c600..b843000f338f 100644 --- a/swan-lake/by-example/graphql-client-handle-partial-response/content.jsx +++ b/swan-lake/by-example/graphql-client-handle-partial-response/content.jsx @@ -82,7 +82,7 @@ export function GraphqlClientHandlePartialResponse({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-handle-partial-response", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-handle-partial-response", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-query-endpoint/content.jsx b/swan-lake/by-example/graphql-client-query-endpoint/content.jsx index cc64dd39a929..4d63811e0259 100644 --- a/swan-lake/by-example/graphql-client-query-endpoint/content.jsx +++ b/swan-lake/by-example/graphql-client-query-endpoint/content.jsx @@ -70,7 +70,7 @@ export function GraphqlClientQueryEndpoint({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-query-endpoint", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-query-endpoint", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-security-basic-auth/content.jsx b/swan-lake/by-example/graphql-client-security-basic-auth/content.jsx index b5a6355c41a3..f56f2bc7fc43 100644 --- a/swan-lake/by-example/graphql-client-security-basic-auth/content.jsx +++ b/swan-lake/by-example/graphql-client-security-basic-auth/content.jsx @@ -73,7 +73,7 @@ export function GraphqlClientSecurityBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-security-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-security-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-security-mutual-ssl/content.jsx b/swan-lake/by-example/graphql-client-security-mutual-ssl/content.jsx index ce8afecedcbc..a3ab95224e6e 100644 --- a/swan-lake/by-example/graphql-client-security-mutual-ssl/content.jsx +++ b/swan-lake/by-example/graphql-client-security-mutual-ssl/content.jsx @@ -77,7 +77,7 @@ export function GraphqlClientSecurityMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-security-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-security-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-security-oauth2-password-grant-type/content.jsx b/swan-lake/by-example/graphql-client-security-oauth2-password-grant-type/content.jsx index 09a838e21c6a..00726c37441c 100644 --- a/swan-lake/by-example/graphql-client-security-oauth2-password-grant-type/content.jsx +++ b/swan-lake/by-example/graphql-client-security-oauth2-password-grant-type/content.jsx @@ -84,7 +84,7 @@ export function GraphqlClientSecurityOauth2PasswordGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-security-oauth2-password-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-security-oauth2-password-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-security-self-signed-jwt-authentication/content.jsx b/swan-lake/by-example/graphql-client-security-self-signed-jwt-authentication/content.jsx index d408dcd0de02..6b3174502bc8 100644 --- a/swan-lake/by-example/graphql-client-security-self-signed-jwt-authentication/content.jsx +++ b/swan-lake/by-example/graphql-client-security-self-signed-jwt-authentication/content.jsx @@ -85,7 +85,7 @@ export function GraphqlClientSecuritySelfSignedJwtAuthentication({ className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-security-self-signed-jwt-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-security-self-signed-jwt-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-client-security-ssl-tls/content.jsx b/swan-lake/by-example/graphql-client-security-ssl-tls/content.jsx index fda40c143b80..1af977b89a20 100644 --- a/swan-lake/by-example/graphql-client-security-ssl-tls/content.jsx +++ b/swan-lake/by-example/graphql-client-security-ssl-tls/content.jsx @@ -67,7 +67,7 @@ export function GraphqlClientSecuritySslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-client-security-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-client-security-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-context/content.jsx b/swan-lake/by-example/graphql-context/content.jsx index 264b280d93f4..4fa58e8173c3 100644 --- a/swan-lake/by-example/graphql-context/content.jsx +++ b/swan-lake/by-example/graphql-context/content.jsx @@ -122,7 +122,7 @@ export function GraphqlContext({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-context", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-context", "_blank", ); }} @@ -271,7 +271,7 @@ export function GraphqlContext({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-context", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-context", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-dataloader/content.jsx b/swan-lake/by-example/graphql-dataloader/content.jsx index 7ed92a94db07..89152e923e32 100644 --- a/swan-lake/by-example/graphql-dataloader/content.jsx +++ b/swan-lake/by-example/graphql-dataloader/content.jsx @@ -156,7 +156,7 @@ export function GraphqlDataloader({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-dataloader", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-dataloader", "_blank", ); }} @@ -306,7 +306,7 @@ export function GraphqlDataloader({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-dataloader", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-dataloader", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-directives/content.jsx b/swan-lake/by-example/graphql-directives/content.jsx index 99896b559380..98402dd15f1e 100644 --- a/swan-lake/by-example/graphql-directives/content.jsx +++ b/swan-lake/by-example/graphql-directives/content.jsx @@ -143,7 +143,7 @@ export function GraphqlDirectives({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-directives", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-directives", "_blank", ); }} @@ -299,7 +299,7 @@ export function GraphqlDirectives({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-directives", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-directives", "_blank", ); }} @@ -453,7 +453,7 @@ export function GraphqlDirectives({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-directives", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-directives", "_blank", ); }} @@ -604,7 +604,7 @@ export function GraphqlDirectives({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-directives", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-directives", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-documentation/content.jsx b/swan-lake/by-example/graphql-documentation/content.jsx index 76298c25128d..06035098a412 100644 --- a/swan-lake/by-example/graphql-documentation/content.jsx +++ b/swan-lake/by-example/graphql-documentation/content.jsx @@ -92,7 +92,7 @@ export function GraphqlDocumentation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-documentation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-documentation", "_blank", ); }} @@ -242,7 +242,7 @@ export function GraphqlDocumentation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-documentation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-documentation", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-field-interceptors/content.jsx b/swan-lake/by-example/graphql-field-interceptors/content.jsx index f31e1e476615..f9074f78c5ed 100644 --- a/swan-lake/by-example/graphql-field-interceptors/content.jsx +++ b/swan-lake/by-example/graphql-field-interceptors/content.jsx @@ -100,7 +100,7 @@ export function GraphqlFieldInterceptors({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-field-interceptors", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-field-interceptors", "_blank", ); }} @@ -253,7 +253,7 @@ export function GraphqlFieldInterceptors({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-field-interceptors", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-field-interceptors", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-file-upload/content.jsx b/swan-lake/by-example/graphql-file-upload/content.jsx index 8527aec607cd..692df79a2364 100644 --- a/swan-lake/by-example/graphql-file-upload/content.jsx +++ b/swan-lake/by-example/graphql-file-upload/content.jsx @@ -73,7 +73,7 @@ export function GraphqlFileUpload({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-file-upload", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-file-upload", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-graphiql/content.jsx b/swan-lake/by-example/graphql-graphiql/content.jsx index 99df0983f63e..5420ae76cf65 100644 --- a/swan-lake/by-example/graphql-graphiql/content.jsx +++ b/swan-lake/by-example/graphql-graphiql/content.jsx @@ -59,7 +59,7 @@ export function GraphqlGraphiql({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-graphiql", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-graphiql", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-hello-world/content.jsx b/swan-lake/by-example/graphql-hello-world/content.jsx index 90ddc76ec4d3..104dd7f8b4a8 100644 --- a/swan-lake/by-example/graphql-hello-world/content.jsx +++ b/swan-lake/by-example/graphql-hello-world/content.jsx @@ -67,7 +67,7 @@ export function GraphqlHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-hello-world", "_blank", ); }} @@ -216,7 +216,7 @@ export function GraphqlHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-hello-world", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-hierarchical-resource-paths/content.jsx b/swan-lake/by-example/graphql-hierarchical-resource-paths/content.jsx index 4783524e0c74..7e817dccdec7 100644 --- a/swan-lake/by-example/graphql-hierarchical-resource-paths/content.jsx +++ b/swan-lake/by-example/graphql-hierarchical-resource-paths/content.jsx @@ -79,7 +79,7 @@ export function GraphqlHierarchicalResourcePaths({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-hierarchical-resource-paths", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-hierarchical-resource-paths", "_blank", ); }} @@ -228,7 +228,7 @@ export function GraphqlHierarchicalResourcePaths({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-hierarchical-resource-paths", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-hierarchical-resource-paths", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-id-scalar-type/content.jsx b/swan-lake/by-example/graphql-id-scalar-type/content.jsx index 2467927a76ca..c03a4db940ea 100644 --- a/swan-lake/by-example/graphql-id-scalar-type/content.jsx +++ b/swan-lake/by-example/graphql-id-scalar-type/content.jsx @@ -77,7 +77,7 @@ export function GraphqlIdScalarType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-id-scalar-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-id-scalar-type", "_blank", ); }} @@ -226,7 +226,7 @@ export function GraphqlIdScalarType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-id-scalar-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-id-scalar-type", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-input-constraint-validation/content.jsx b/swan-lake/by-example/graphql-input-constraint-validation/content.jsx index 317399b0ed8f..3cd0fe84d428 100644 --- a/swan-lake/by-example/graphql-input-constraint-validation/content.jsx +++ b/swan-lake/by-example/graphql-input-constraint-validation/content.jsx @@ -75,7 +75,7 @@ export function GraphqlInputConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-input-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-input-constraint-validation", "_blank", ); }} @@ -224,7 +224,7 @@ export function GraphqlInputConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-input-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-input-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-input-objects/content.jsx b/swan-lake/by-example/graphql-input-objects/content.jsx index 4b50bd2a418f..0627957e9fac 100644 --- a/swan-lake/by-example/graphql-input-objects/content.jsx +++ b/swan-lake/by-example/graphql-input-objects/content.jsx @@ -83,7 +83,7 @@ export function GraphqlInputObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-input-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-input-objects", "_blank", ); }} @@ -232,7 +232,7 @@ export function GraphqlInputObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-input-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-input-objects", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-input-types/content.jsx b/swan-lake/by-example/graphql-input-types/content.jsx index 4613bc470bee..82956f4bc2b8 100644 --- a/swan-lake/by-example/graphql-input-types/content.jsx +++ b/swan-lake/by-example/graphql-input-types/content.jsx @@ -55,7 +55,7 @@ export function GraphqlInputTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-input-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-input-types", "_blank", ); }} @@ -204,7 +204,7 @@ export function GraphqlInputTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-input-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-input-types", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-interceptor-configurations/content.jsx b/swan-lake/by-example/graphql-interceptor-configurations/content.jsx index ea686be44361..4556e57ad470 100644 --- a/swan-lake/by-example/graphql-interceptor-configurations/content.jsx +++ b/swan-lake/by-example/graphql-interceptor-configurations/content.jsx @@ -136,7 +136,7 @@ export function GraphqlInterceptorConfigurations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-interceptor-configurations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-interceptor-configurations", "_blank", ); }} @@ -287,7 +287,7 @@ export function GraphqlInterceptorConfigurations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-interceptor-configurations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-interceptor-configurations", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-interfaces-implementing-interfaces/content.jsx b/swan-lake/by-example/graphql-interfaces-implementing-interfaces/content.jsx index 93dc85b348e0..18881cf43851 100644 --- a/swan-lake/by-example/graphql-interfaces-implementing-interfaces/content.jsx +++ b/swan-lake/by-example/graphql-interfaces-implementing-interfaces/content.jsx @@ -115,7 +115,7 @@ export function GraphqlInterfacesImplementingInterfaces({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-interfaces-implementing-interfaces", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-interfaces-implementing-interfaces", "_blank", ); }} @@ -264,7 +264,7 @@ export function GraphqlInterfacesImplementingInterfaces({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-interfaces-implementing-interfaces", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-interfaces-implementing-interfaces", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-interfaces/content.jsx b/swan-lake/by-example/graphql-interfaces/content.jsx index 0a1003782d01..da5116411655 100644 --- a/swan-lake/by-example/graphql-interfaces/content.jsx +++ b/swan-lake/by-example/graphql-interfaces/content.jsx @@ -112,7 +112,7 @@ export function GraphqlInterfaces({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-interfaces", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-interfaces", "_blank", ); }} @@ -261,7 +261,7 @@ export function GraphqlInterfaces({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-interfaces", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-interfaces", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-mutations/content.jsx b/swan-lake/by-example/graphql-mutations/content.jsx index e883dc017dea..226ea77c8d74 100644 --- a/swan-lake/by-example/graphql-mutations/content.jsx +++ b/swan-lake/by-example/graphql-mutations/content.jsx @@ -103,7 +103,7 @@ export function GraphqlMutations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-mutations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-mutations", "_blank", ); }} @@ -250,7 +250,7 @@ export function GraphqlMutations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-mutations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-mutations", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-returning-record-values/content.jsx b/swan-lake/by-example/graphql-returning-record-values/content.jsx index 50c9b3afee12..669ac51b150e 100644 --- a/swan-lake/by-example/graphql-returning-record-values/content.jsx +++ b/swan-lake/by-example/graphql-returning-record-values/content.jsx @@ -87,7 +87,7 @@ export function GraphqlReturningRecordValues({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-returning-record-values", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-returning-record-values", "_blank", ); }} @@ -236,7 +236,7 @@ export function GraphqlReturningRecordValues({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-returning-record-values", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-returning-record-values", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-returning-service-objects/content.jsx b/swan-lake/by-example/graphql-returning-service-objects/content.jsx index ab56d2c0d3ea..fdc9ceff6e9c 100644 --- a/swan-lake/by-example/graphql-returning-service-objects/content.jsx +++ b/swan-lake/by-example/graphql-returning-service-objects/content.jsx @@ -89,7 +89,7 @@ export function GraphqlReturningServiceObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-returning-service-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-returning-service-objects", "_blank", ); }} @@ -238,7 +238,7 @@ export function GraphqlReturningServiceObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-returning-service-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-returning-service-objects", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-basic-auth-file-user-store/content.jsx b/swan-lake/by-example/graphql-service-basic-auth-file-user-store/content.jsx index 4c0df49e2c0c..64118d34329d 100644 --- a/swan-lake/by-example/graphql-service-basic-auth-file-user-store/content.jsx +++ b/swan-lake/by-example/graphql-service-basic-auth-file-user-store/content.jsx @@ -102,7 +102,7 @@ export function GraphqlServiceBasicAuthFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-basic-auth-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-basic-auth-file-user-store", "_blank", ); }} @@ -194,7 +194,7 @@ export function GraphqlServiceBasicAuthFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-basic-auth-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-basic-auth-file-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-basic-auth-ldap-user-store/content.jsx b/swan-lake/by-example/graphql-service-basic-auth-ldap-user-store/content.jsx index e9337faf176c..7bced6cb3d8d 100644 --- a/swan-lake/by-example/graphql-service-basic-auth-ldap-user-store/content.jsx +++ b/swan-lake/by-example/graphql-service-basic-auth-ldap-user-store/content.jsx @@ -105,7 +105,7 @@ export function GraphqlServiceBasicAuthLdapUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-basic-auth-ldap-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-basic-auth-ldap-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-cache-invalidation/content.jsx b/swan-lake/by-example/graphql-service-cache-invalidation/content.jsx index 298fec59885c..051bb5291d8a 100644 --- a/swan-lake/by-example/graphql-service-cache-invalidation/content.jsx +++ b/swan-lake/by-example/graphql-service-cache-invalidation/content.jsx @@ -113,7 +113,7 @@ export function GraphqlServiceCacheInvalidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-cache-invalidation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-cache-invalidation", "_blank", ); }} @@ -260,7 +260,7 @@ export function GraphqlServiceCacheInvalidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-cache-invalidation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-cache-invalidation", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-error-handling/content.jsx b/swan-lake/by-example/graphql-service-error-handling/content.jsx index 4208c4c756af..c2f1194ba858 100644 --- a/swan-lake/by-example/graphql-service-error-handling/content.jsx +++ b/swan-lake/by-example/graphql-service-error-handling/content.jsx @@ -115,7 +115,7 @@ export function GraphqlServiceErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-error-handling", "_blank", ); }} @@ -264,7 +264,7 @@ export function GraphqlServiceErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-error-handling", "_blank", ); }} @@ -420,7 +420,7 @@ export function GraphqlServiceErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-field-level-caching/content.jsx b/swan-lake/by-example/graphql-service-field-level-caching/content.jsx index b3cca4597b93..f85cbad74983 100644 --- a/swan-lake/by-example/graphql-service-field-level-caching/content.jsx +++ b/swan-lake/by-example/graphql-service-field-level-caching/content.jsx @@ -78,7 +78,7 @@ export function GraphqlServiceFieldLevelCaching({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-field-level-caching", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-field-level-caching", "_blank", ); }} @@ -227,7 +227,7 @@ export function GraphqlServiceFieldLevelCaching({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-field-level-caching", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-field-level-caching", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-field-object/content.jsx b/swan-lake/by-example/graphql-service-field-object/content.jsx index 1103ba1866dc..8ef4e9609e4f 100644 --- a/swan-lake/by-example/graphql-service-field-object/content.jsx +++ b/swan-lake/by-example/graphql-service-field-object/content.jsx @@ -138,7 +138,7 @@ export function GraphqlServiceFieldObject({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-field-object", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-field-object", "_blank", ); }} @@ -287,7 +287,7 @@ export function GraphqlServiceFieldObject({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-field-object", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-field-object", "_blank", ); }} @@ -506,7 +506,7 @@ export function GraphqlServiceFieldObject({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-field-object", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-field-object", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-interceptors/content.jsx b/swan-lake/by-example/graphql-service-interceptors/content.jsx index fe2d23f75486..b75b1fcf4ac5 100644 --- a/swan-lake/by-example/graphql-service-interceptors/content.jsx +++ b/swan-lake/by-example/graphql-service-interceptors/content.jsx @@ -105,7 +105,7 @@ export function GraphqlServiceInterceptors({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-interceptors", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-interceptors", "_blank", ); }} @@ -258,7 +258,7 @@ export function GraphqlServiceInterceptors({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-interceptors", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-interceptors", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-jwt-auth/content.jsx b/swan-lake/by-example/graphql-service-jwt-auth/content.jsx index 2c4480447928..d7aa389f6f53 100644 --- a/swan-lake/by-example/graphql-service-jwt-auth/content.jsx +++ b/swan-lake/by-example/graphql-service-jwt-auth/content.jsx @@ -87,7 +87,7 @@ export function GraphqlServiceJwtAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-jwt-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-jwt-auth", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-mutual-ssl/content.jsx b/swan-lake/by-example/graphql-service-mutual-ssl/content.jsx index fdb42059793d..78377ba29dd1 100644 --- a/swan-lake/by-example/graphql-service-mutual-ssl/content.jsx +++ b/swan-lake/by-example/graphql-service-mutual-ssl/content.jsx @@ -77,7 +77,7 @@ export function GraphqlServiceMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-oauth2/content.jsx b/swan-lake/by-example/graphql-service-oauth2/content.jsx index 8b8041c6e8ab..a8ba4b25ed60 100644 --- a/swan-lake/by-example/graphql-service-oauth2/content.jsx +++ b/swan-lake/by-example/graphql-service-oauth2/content.jsx @@ -92,7 +92,7 @@ export function GraphqlServiceOauth2({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-oauth2", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-oauth2", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-operation-level-caching/content.jsx b/swan-lake/by-example/graphql-service-operation-level-caching/content.jsx index 6626ae03294d..b20653c25b41 100644 --- a/swan-lake/by-example/graphql-service-operation-level-caching/content.jsx +++ b/swan-lake/by-example/graphql-service-operation-level-caching/content.jsx @@ -106,7 +106,7 @@ export function GraphqlServiceOperationLevelCaching({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-operation-level-caching", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-operation-level-caching", "_blank", ); }} @@ -255,7 +255,7 @@ export function GraphqlServiceOperationLevelCaching({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-operation-level-caching", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-operation-level-caching", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-ssl-tls/content.jsx b/swan-lake/by-example/graphql-service-ssl-tls/content.jsx index 86f10874315b..5ba0015acf03 100644 --- a/swan-lake/by-example/graphql-service-ssl-tls/content.jsx +++ b/swan-lake/by-example/graphql-service-ssl-tls/content.jsx @@ -64,7 +64,7 @@ export function GraphqlServiceSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-service-union-types/content.jsx b/swan-lake/by-example/graphql-service-union-types/content.jsx index 123cc238d3f0..e7d0c20721bd 100644 --- a/swan-lake/by-example/graphql-service-union-types/content.jsx +++ b/swan-lake/by-example/graphql-service-union-types/content.jsx @@ -116,7 +116,7 @@ export function GraphqlServiceUnionTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-union-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-union-types", "_blank", ); }} @@ -265,7 +265,7 @@ export function GraphqlServiceUnionTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-service-union-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-service-union-types", "_blank", ); }} diff --git a/swan-lake/by-example/graphql-subscriptions/content.jsx b/swan-lake/by-example/graphql-subscriptions/content.jsx index 641b21cfdb1e..e311ac7fdefa 100644 --- a/swan-lake/by-example/graphql-subscriptions/content.jsx +++ b/swan-lake/by-example/graphql-subscriptions/content.jsx @@ -109,7 +109,7 @@ export function GraphqlSubscriptions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-subscriptions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-subscriptions", "_blank", ); }} @@ -259,7 +259,7 @@ export function GraphqlSubscriptions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/graphql-subscriptions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/graphql-subscriptions", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-basic-auth/content.jsx b/swan-lake/by-example/grpc-client-basic-auth/content.jsx index b880586c2113..d3ed2e4868ca 100644 --- a/swan-lake/by-example/grpc-client-basic-auth/content.jsx +++ b/swan-lake/by-example/grpc-client-basic-auth/content.jsx @@ -55,7 +55,7 @@ export function GrpcClientBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-bearer-token-auth/content.jsx b/swan-lake/by-example/grpc-client-bearer-token-auth/content.jsx index f52dd3bcffe9..02760a067da3 100644 --- a/swan-lake/by-example/grpc-client-bearer-token-auth/content.jsx +++ b/swan-lake/by-example/grpc-client-bearer-token-auth/content.jsx @@ -54,7 +54,7 @@ export function GrpcClientBearerTokenAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-bearer-token-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-bearer-token-auth", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-bidirectional-streaming/content.jsx b/swan-lake/by-example/grpc-client-bidirectional-streaming/content.jsx index ff6466648a37..ecac02d0d4ce 100644 --- a/swan-lake/by-example/grpc-client-bidirectional-streaming/content.jsx +++ b/swan-lake/by-example/grpc-client-bidirectional-streaming/content.jsx @@ -104,7 +104,7 @@ export function GrpcClientBidirectionalStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-bidirectional-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-bidirectional-streaming", "_blank", ); }} @@ -198,7 +198,7 @@ export function GrpcClientBidirectionalStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-bidirectional-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-bidirectional-streaming", "_blank", ); }} @@ -338,7 +338,7 @@ export function GrpcClientBidirectionalStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-bidirectional-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-bidirectional-streaming", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-client-streaming/content.jsx b/swan-lake/by-example/grpc-client-client-streaming/content.jsx index 9a070392714c..1eabdbeaf598 100644 --- a/swan-lake/by-example/grpc-client-client-streaming/content.jsx +++ b/swan-lake/by-example/grpc-client-client-streaming/content.jsx @@ -87,7 +87,7 @@ export function GrpcClientClientStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-client-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-client-streaming", "_blank", ); }} @@ -295,7 +295,7 @@ export function GrpcClientClientStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-client-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-client-streaming", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-headers/content.jsx b/swan-lake/by-example/grpc-client-headers/content.jsx index 01df0e70931d..739eb4550d82 100644 --- a/swan-lake/by-example/grpc-client-headers/content.jsx +++ b/swan-lake/by-example/grpc-client-headers/content.jsx @@ -68,7 +68,7 @@ export function GrpcClientHeaders({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-headers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-headers", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-mutual-ssl/content.jsx b/swan-lake/by-example/grpc-client-mutual-ssl/content.jsx index 5bce088a6ae6..6f0c0610aad7 100644 --- a/swan-lake/by-example/grpc-client-mutual-ssl/content.jsx +++ b/swan-lake/by-example/grpc-client-mutual-ssl/content.jsx @@ -61,7 +61,7 @@ export function GrpcClientMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-oauth2-client-credentials-grant-type/content.jsx b/swan-lake/by-example/grpc-client-oauth2-client-credentials-grant-type/content.jsx index e871ce5543ea..df0e5aa9bcdc 100644 --- a/swan-lake/by-example/grpc-client-oauth2-client-credentials-grant-type/content.jsx +++ b/swan-lake/by-example/grpc-client-oauth2-client-credentials-grant-type/content.jsx @@ -62,7 +62,7 @@ export function GrpcClientOauth2ClientCredentialsGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-oauth2-client-credentials-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-oauth2-client-credentials-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-oauth2-jwt-bearer-grant-type/content.jsx b/swan-lake/by-example/grpc-client-oauth2-jwt-bearer-grant-type/content.jsx index 18e33ebff608..c8187f6e0d1d 100644 --- a/swan-lake/by-example/grpc-client-oauth2-jwt-bearer-grant-type/content.jsx +++ b/swan-lake/by-example/grpc-client-oauth2-jwt-bearer-grant-type/content.jsx @@ -63,7 +63,7 @@ export function GrpcClientOauth2JwtBearerGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-oauth2-jwt-bearer-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-oauth2-jwt-bearer-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-oauth2-password-grant-type/content.jsx b/swan-lake/by-example/grpc-client-oauth2-password-grant-type/content.jsx index 6f625c66f3f7..6c328f36d7f9 100644 --- a/swan-lake/by-example/grpc-client-oauth2-password-grant-type/content.jsx +++ b/swan-lake/by-example/grpc-client-oauth2-password-grant-type/content.jsx @@ -67,7 +67,7 @@ export function GrpcClientOauth2PasswordGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-oauth2-password-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-oauth2-password-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-oauth2-refresh-token-grant-type/content.jsx b/swan-lake/by-example/grpc-client-oauth2-refresh-token-grant-type/content.jsx index 0748a3818587..6349491fdac8 100644 --- a/swan-lake/by-example/grpc-client-oauth2-refresh-token-grant-type/content.jsx +++ b/swan-lake/by-example/grpc-client-oauth2-refresh-token-grant-type/content.jsx @@ -64,7 +64,7 @@ export function GrpcClientOauth2RefreshTokenGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-oauth2-refresh-token-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-oauth2-refresh-token-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-self-signed-jwt-auth/content.jsx b/swan-lake/by-example/grpc-client-self-signed-jwt-auth/content.jsx index 429fd30757eb..82bb590b62b4 100644 --- a/swan-lake/by-example/grpc-client-self-signed-jwt-auth/content.jsx +++ b/swan-lake/by-example/grpc-client-self-signed-jwt-auth/content.jsx @@ -65,7 +65,7 @@ export function GrpcClientSelfSignedJwtAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-self-signed-jwt-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-self-signed-jwt-auth", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-server-streaming/content.jsx b/swan-lake/by-example/grpc-client-server-streaming/content.jsx index 4eb7b1027020..71a264b4bd42 100644 --- a/swan-lake/by-example/grpc-client-server-streaming/content.jsx +++ b/swan-lake/by-example/grpc-client-server-streaming/content.jsx @@ -77,7 +77,7 @@ export function GrpcClientServerStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-server-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-server-streaming", "_blank", ); }} @@ -285,7 +285,7 @@ export function GrpcClientServerStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-server-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-server-streaming", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-set-deadline/content.jsx b/swan-lake/by-example/grpc-client-set-deadline/content.jsx index edfde47e232c..6dbf1dd95d13 100644 --- a/swan-lake/by-example/grpc-client-set-deadline/content.jsx +++ b/swan-lake/by-example/grpc-client-set-deadline/content.jsx @@ -57,7 +57,7 @@ export function GrpcClientSetDeadline({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-set-deadline", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-set-deadline", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-simple/content.jsx b/swan-lake/by-example/grpc-client-simple/content.jsx index d64580acfcba..bf65444103b2 100644 --- a/swan-lake/by-example/grpc-client-simple/content.jsx +++ b/swan-lake/by-example/grpc-client-simple/content.jsx @@ -72,7 +72,7 @@ export function GrpcClientSimple({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-simple", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-simple", "_blank", ); }} @@ -278,7 +278,7 @@ export function GrpcClientSimple({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-simple", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-simple", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-client-ssl-tls/content.jsx b/swan-lake/by-example/grpc-client-ssl-tls/content.jsx index 8710eacc19da..ea418c52d3d1 100644 --- a/swan-lake/by-example/grpc-client-ssl-tls/content.jsx +++ b/swan-lake/by-example/grpc-client-ssl-tls/content.jsx @@ -49,7 +49,7 @@ export function GrpcClientSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-client-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-client-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-server-reflection/content.jsx b/swan-lake/by-example/grpc-server-reflection/content.jsx index dc88bd29f6af..54dcc8ce0070 100644 --- a/swan-lake/by-example/grpc-server-reflection/content.jsx +++ b/swan-lake/by-example/grpc-server-reflection/content.jsx @@ -52,7 +52,7 @@ export function GrpcServerReflection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-server-reflection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-server-reflection", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-basic-auth-file-user-store/content.jsx b/swan-lake/by-example/grpc-service-basic-auth-file-user-store/content.jsx index dd33180259db..e7c9dcf6ee75 100644 --- a/swan-lake/by-example/grpc-service-basic-auth-file-user-store/content.jsx +++ b/swan-lake/by-example/grpc-service-basic-auth-file-user-store/content.jsx @@ -97,7 +97,7 @@ export function GrpcServiceBasicAuthFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-basic-auth-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-basic-auth-file-user-store", "_blank", ); }} @@ -193,7 +193,7 @@ export function GrpcServiceBasicAuthFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-basic-auth-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-basic-auth-file-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-basic-auth-ldap-user-store/content.jsx b/swan-lake/by-example/grpc-service-basic-auth-ldap-user-store/content.jsx index 3bdaa781f76a..0256e7a751d1 100644 --- a/swan-lake/by-example/grpc-service-basic-auth-ldap-user-store/content.jsx +++ b/swan-lake/by-example/grpc-service-basic-auth-ldap-user-store/content.jsx @@ -100,7 +100,7 @@ export function GrpcServiceBasicAuthLdapUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-basic-auth-ldap-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-basic-auth-ldap-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-bidirectional-streaming/content.jsx b/swan-lake/by-example/grpc-service-bidirectional-streaming/content.jsx index f7827eedce59..64a4f9f35f40 100644 --- a/swan-lake/by-example/grpc-service-bidirectional-streaming/content.jsx +++ b/swan-lake/by-example/grpc-service-bidirectional-streaming/content.jsx @@ -98,7 +98,7 @@ export function GrpcServiceBidirectionalStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-bidirectional-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-bidirectional-streaming", "_blank", ); }} @@ -192,7 +192,7 @@ export function GrpcServiceBidirectionalStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-bidirectional-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-bidirectional-streaming", "_blank", ); }} @@ -317,7 +317,7 @@ export function GrpcServiceBidirectionalStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-bidirectional-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-bidirectional-streaming", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-check-deadline/content.jsx b/swan-lake/by-example/grpc-service-check-deadline/content.jsx index e32f43a8bac1..7edda42a8e34 100644 --- a/swan-lake/by-example/grpc-service-check-deadline/content.jsx +++ b/swan-lake/by-example/grpc-service-check-deadline/content.jsx @@ -57,7 +57,7 @@ export function GrpcServiceCheckDeadline({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-check-deadline", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-check-deadline", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-client-streaming/content.jsx b/swan-lake/by-example/grpc-service-client-streaming/content.jsx index 942851c0381b..1c455610e0e6 100644 --- a/swan-lake/by-example/grpc-service-client-streaming/content.jsx +++ b/swan-lake/by-example/grpc-service-client-streaming/content.jsx @@ -90,7 +90,7 @@ export function GrpcServiceClientStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-client-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-client-streaming", "_blank", ); }} @@ -281,7 +281,7 @@ export function GrpcServiceClientStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-client-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-client-streaming", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-headers/content.jsx b/swan-lake/by-example/grpc-service-headers/content.jsx index 821c0438bf32..c4730f05a528 100644 --- a/swan-lake/by-example/grpc-service-headers/content.jsx +++ b/swan-lake/by-example/grpc-service-headers/content.jsx @@ -66,7 +66,7 @@ export function GrpcServiceHeaders({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-headers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-headers", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-jwt-auth/content.jsx b/swan-lake/by-example/grpc-service-jwt-auth/content.jsx index 9b1a00397989..644bb2c3c628 100644 --- a/swan-lake/by-example/grpc-service-jwt-auth/content.jsx +++ b/swan-lake/by-example/grpc-service-jwt-auth/content.jsx @@ -77,7 +77,7 @@ export function GrpcServiceJwtAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-jwt-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-jwt-auth", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-mutual-ssl/content.jsx b/swan-lake/by-example/grpc-service-mutual-ssl/content.jsx index bf8bc603eb80..fdeedaa0c6a1 100644 --- a/swan-lake/by-example/grpc-service-mutual-ssl/content.jsx +++ b/swan-lake/by-example/grpc-service-mutual-ssl/content.jsx @@ -71,7 +71,7 @@ export function GrpcServiceMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-oauth2/content.jsx b/swan-lake/by-example/grpc-service-oauth2/content.jsx index 55f132284fad..3445a5b38dce 100644 --- a/swan-lake/by-example/grpc-service-oauth2/content.jsx +++ b/swan-lake/by-example/grpc-service-oauth2/content.jsx @@ -85,7 +85,7 @@ export function GrpcServiceOauth2({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-oauth2", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-oauth2", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-server-streaming/content.jsx b/swan-lake/by-example/grpc-service-server-streaming/content.jsx index dcbb66c438d2..287a5c17992f 100644 --- a/swan-lake/by-example/grpc-service-server-streaming/content.jsx +++ b/swan-lake/by-example/grpc-service-server-streaming/content.jsx @@ -83,7 +83,7 @@ export function GrpcServiceServerStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-server-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-server-streaming", "_blank", ); }} @@ -276,7 +276,7 @@ export function GrpcServiceServerStreaming({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-server-streaming", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-server-streaming", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-simple/content.jsx b/swan-lake/by-example/grpc-service-simple/content.jsx index b7344bbee5ac..bff9c3131698 100644 --- a/swan-lake/by-example/grpc-service-simple/content.jsx +++ b/swan-lake/by-example/grpc-service-simple/content.jsx @@ -74,7 +74,7 @@ export function GrpcServiceSimple({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-simple", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-simple", "_blank", ); }} @@ -267,7 +267,7 @@ export function GrpcServiceSimple({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-simple", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-simple", "_blank", ); }} diff --git a/swan-lake/by-example/grpc-service-ssl-tls/content.jsx b/swan-lake/by-example/grpc-service-ssl-tls/content.jsx index 40ba8d75a953..d73f3c93c94b 100644 --- a/swan-lake/by-example/grpc-service-ssl-tls/content.jsx +++ b/swan-lake/by-example/grpc-service-ssl-tls/content.jsx @@ -59,7 +59,7 @@ export function GrpcServiceSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/grpc-service-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/grpc-service-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/hello-world-service/content.jsx b/swan-lake/by-example/hello-world-service/content.jsx index ae639c667537..52899552c5df 100644 --- a/swan-lake/by-example/hello-world-service/content.jsx +++ b/swan-lake/by-example/hello-world-service/content.jsx @@ -47,7 +47,7 @@ export function HelloWorldService({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/hello-world-service", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/hello-world-service", "_blank", ); }} diff --git a/swan-lake/by-example/hello-world/content.jsx b/swan-lake/by-example/hello-world/content.jsx index 89629b4b6369..36550e2fb3ca 100644 --- a/swan-lake/by-example/hello-world/content.jsx +++ b/swan-lake/by-example/hello-world/content.jsx @@ -39,7 +39,7 @@ export function HelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/hello-world", "_blank", ); }} diff --git a/swan-lake/by-example/hierarchical-resources/content.jsx b/swan-lake/by-example/hierarchical-resources/content.jsx index 209165e54e1a..9378be340827 100644 --- a/swan-lake/by-example/hierarchical-resources/content.jsx +++ b/swan-lake/by-example/hierarchical-resources/content.jsx @@ -47,7 +47,7 @@ export function HierarchicalResources({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/hierarchical-resources", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/hierarchical-resources", "_blank", ); }} diff --git a/swan-lake/by-example/http-100-continue/content.jsx b/swan-lake/by-example/http-100-continue/content.jsx index f3c9aa36d124..0fc81c65622f 100644 --- a/swan-lake/by-example/http-100-continue/content.jsx +++ b/swan-lake/by-example/http-100-continue/content.jsx @@ -76,7 +76,7 @@ export function Http100Continue({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-100-continue", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-100-continue", "_blank", ); }} diff --git a/swan-lake/by-example/http-2-0-client-server-push/content.jsx b/swan-lake/by-example/http-2-0-client-server-push/content.jsx index da09813f68af..c609c86a2ba3 100644 --- a/swan-lake/by-example/http-2-0-client-server-push/content.jsx +++ b/swan-lake/by-example/http-2-0-client-server-push/content.jsx @@ -84,7 +84,7 @@ export function Http20ClientServerPush({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-2-0-client-server-push", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-2-0-client-server-push", "_blank", ); }} diff --git a/swan-lake/by-example/http-2-0-server-push/content.jsx b/swan-lake/by-example/http-2-0-server-push/content.jsx index 00632f59d631..eb85d8dccb5e 100644 --- a/swan-lake/by-example/http-2-0-server-push/content.jsx +++ b/swan-lake/by-example/http-2-0-server-push/content.jsx @@ -90,7 +90,7 @@ export function Http20ServerPush({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-2-0-server-push", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-2-0-server-push", "_blank", ); }} diff --git a/swan-lake/by-example/http-2-prior-knowledge-client/content.jsx b/swan-lake/by-example/http-2-prior-knowledge-client/content.jsx index 428e5252f4ec..23af41f02106 100644 --- a/swan-lake/by-example/http-2-prior-knowledge-client/content.jsx +++ b/swan-lake/by-example/http-2-prior-knowledge-client/content.jsx @@ -54,7 +54,7 @@ export function Http2PriorKnowledgeClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-2-prior-knowledge-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-2-prior-knowledge-client", "_blank", ); }} diff --git a/swan-lake/by-example/http-2-to-1-1-downgrade-client/content.jsx b/swan-lake/by-example/http-2-to-1-1-downgrade-client/content.jsx index d863262c632e..1d7489f83ac0 100644 --- a/swan-lake/by-example/http-2-to-1-1-downgrade-client/content.jsx +++ b/swan-lake/by-example/http-2-to-1-1-downgrade-client/content.jsx @@ -54,7 +54,7 @@ export function Http2To11DowngradeClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-2-to-1-1-downgrade-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-2-to-1-1-downgrade-client", "_blank", ); }} diff --git a/swan-lake/by-example/http-2-to-1-1-downgrade-service/content.jsx b/swan-lake/by-example/http-2-to-1-1-downgrade-service/content.jsx index a04b925f135e..16c985030d98 100644 --- a/swan-lake/by-example/http-2-to-1-1-downgrade-service/content.jsx +++ b/swan-lake/by-example/http-2-to-1-1-downgrade-service/content.jsx @@ -67,7 +67,7 @@ export function Http2To11DowngradeService({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-2-to-1-1-downgrade-service", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-2-to-1-1-downgrade-service", "_blank", ); }} diff --git a/swan-lake/by-example/http-access-logs/content.jsx b/swan-lake/by-example/http-access-logs/content.jsx index d2c121fda97c..77ab2c9a470d 100644 --- a/swan-lake/by-example/http-access-logs/content.jsx +++ b/swan-lake/by-example/http-access-logs/content.jsx @@ -67,7 +67,7 @@ export function HttpAccessLogs({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-access-logs", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-access-logs", "_blank", ); }} @@ -163,7 +163,7 @@ export function HttpAccessLogs({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-access-logs", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-access-logs", "_blank", ); }} diff --git a/swan-lake/by-example/http-basic-rest-service/content.jsx b/swan-lake/by-example/http-basic-rest-service/content.jsx index 45e9055f9d2f..a2a8f416f898 100644 --- a/swan-lake/by-example/http-basic-rest-service/content.jsx +++ b/swan-lake/by-example/http-basic-rest-service/content.jsx @@ -73,7 +73,7 @@ export function HttpBasicRestService({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-basic-rest-service", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-basic-rest-service", "_blank", ); }} diff --git a/swan-lake/by-example/http-caching-client/content.jsx b/swan-lake/by-example/http-caching-client/content.jsx index 50cc6d6e1afc..1d256f5fb413 100644 --- a/swan-lake/by-example/http-caching-client/content.jsx +++ b/swan-lake/by-example/http-caching-client/content.jsx @@ -63,7 +63,7 @@ export function HttpCachingClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-caching-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-caching-client", "_blank", ); }} diff --git a/swan-lake/by-example/http-caller/content.jsx b/swan-lake/by-example/http-caller/content.jsx index e5f5368107ce..4d2fbee963ff 100644 --- a/swan-lake/by-example/http-caller/content.jsx +++ b/swan-lake/by-example/http-caller/content.jsx @@ -69,7 +69,7 @@ export function HttpCaller({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-caller", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-caller", "_blank", ); }} diff --git a/swan-lake/by-example/http-circuit-breaker/content.jsx b/swan-lake/by-example/http-circuit-breaker/content.jsx index 4b467ed6bf84..a9cf21204a9d 100644 --- a/swan-lake/by-example/http-circuit-breaker/content.jsx +++ b/swan-lake/by-example/http-circuit-breaker/content.jsx @@ -81,7 +81,7 @@ export function HttpCircuitBreaker({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-circuit-breaker", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-circuit-breaker", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-basic-authentication/content.jsx b/swan-lake/by-example/http-client-basic-authentication/content.jsx index 9230db8cc9c7..cd992f0fc835 100644 --- a/swan-lake/by-example/http-client-basic-authentication/content.jsx +++ b/swan-lake/by-example/http-client-basic-authentication/content.jsx @@ -60,7 +60,7 @@ export function HttpClientBasicAuthentication({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-basic-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-basic-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-bearer-token-authentication/content.jsx b/swan-lake/by-example/http-client-bearer-token-authentication/content.jsx index 8869db4775f1..f40b35a56bb1 100644 --- a/swan-lake/by-example/http-client-bearer-token-authentication/content.jsx +++ b/swan-lake/by-example/http-client-bearer-token-authentication/content.jsx @@ -59,7 +59,7 @@ export function HttpClientBearerTokenAuthentication({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-bearer-token-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-bearer-token-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-chunking/content.jsx b/swan-lake/by-example/http-client-chunking/content.jsx index b349afddbb53..889815281ee7 100644 --- a/swan-lake/by-example/http-client-chunking/content.jsx +++ b/swan-lake/by-example/http-client-chunking/content.jsx @@ -63,7 +63,7 @@ export function HttpClientChunking({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-chunking", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-chunking", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-data-binding/content.jsx b/swan-lake/by-example/http-client-data-binding/content.jsx index 80e9c0c2f43a..85dcbdd77a8e 100644 --- a/swan-lake/by-example/http-client-data-binding/content.jsx +++ b/swan-lake/by-example/http-client-data-binding/content.jsx @@ -65,7 +65,7 @@ export function HttpClientDataBinding({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-data-binding", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-data-binding", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-file-upload/content.jsx b/swan-lake/by-example/http-client-file-upload/content.jsx index a4b73c1e44fb..8cb28515a479 100644 --- a/swan-lake/by-example/http-client-file-upload/content.jsx +++ b/swan-lake/by-example/http-client-file-upload/content.jsx @@ -56,7 +56,7 @@ export function HttpClientFileUpload({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-file-upload", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-file-upload", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-header-parameter/content.jsx b/swan-lake/by-example/http-client-header-parameter/content.jsx index 37513373e703..6ba053bfa20a 100644 --- a/swan-lake/by-example/http-client-header-parameter/content.jsx +++ b/swan-lake/by-example/http-client-header-parameter/content.jsx @@ -71,7 +71,7 @@ export function HttpClientHeaderParameter({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-header-parameter", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-header-parameter", "_blank", ); }} @@ -237,7 +237,7 @@ export function HttpClientHeaderParameter({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-header-parameter", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-header-parameter", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-mutual-ssl/content.jsx b/swan-lake/by-example/http-client-mutual-ssl/content.jsx index c88cfb693aaa..e9d62d6d9ad5 100644 --- a/swan-lake/by-example/http-client-mutual-ssl/content.jsx +++ b/swan-lake/by-example/http-client-mutual-ssl/content.jsx @@ -66,7 +66,7 @@ export function HttpClientMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-oauth2-client-credentials-grant-type/content.jsx b/swan-lake/by-example/http-client-oauth2-client-credentials-grant-type/content.jsx index 73109bc538fb..675d49a5e3aa 100644 --- a/swan-lake/by-example/http-client-oauth2-client-credentials-grant-type/content.jsx +++ b/swan-lake/by-example/http-client-oauth2-client-credentials-grant-type/content.jsx @@ -67,7 +67,7 @@ export function HttpClientOauth2ClientCredentialsGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-oauth2-client-credentials-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-oauth2-client-credentials-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-oauth2-jwt-bearer-grant-type/content.jsx b/swan-lake/by-example/http-client-oauth2-jwt-bearer-grant-type/content.jsx index 6d7192512c45..ceb7e79dae31 100644 --- a/swan-lake/by-example/http-client-oauth2-jwt-bearer-grant-type/content.jsx +++ b/swan-lake/by-example/http-client-oauth2-jwt-bearer-grant-type/content.jsx @@ -68,7 +68,7 @@ export function HttpClientOauth2JwtBearerGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-oauth2-jwt-bearer-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-oauth2-jwt-bearer-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-oauth2-password-grant-type/content.jsx b/swan-lake/by-example/http-client-oauth2-password-grant-type/content.jsx index 650ac89a3fed..7835c72c9c8b 100644 --- a/swan-lake/by-example/http-client-oauth2-password-grant-type/content.jsx +++ b/swan-lake/by-example/http-client-oauth2-password-grant-type/content.jsx @@ -72,7 +72,7 @@ export function HttpClientOauth2PasswordGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-oauth2-password-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-oauth2-password-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-oauth2-refresh-token-grant-type/content.jsx b/swan-lake/by-example/http-client-oauth2-refresh-token-grant-type/content.jsx index a6addb427c01..d0171b13126d 100644 --- a/swan-lake/by-example/http-client-oauth2-refresh-token-grant-type/content.jsx +++ b/swan-lake/by-example/http-client-oauth2-refresh-token-grant-type/content.jsx @@ -69,7 +69,7 @@ export function HttpClientOauth2RefreshTokenGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-oauth2-refresh-token-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-oauth2-refresh-token-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-path-parameter/content.jsx b/swan-lake/by-example/http-client-path-parameter/content.jsx index a591b5575853..7c9c203fb724 100644 --- a/swan-lake/by-example/http-client-path-parameter/content.jsx +++ b/swan-lake/by-example/http-client-path-parameter/content.jsx @@ -56,7 +56,7 @@ export function HttpClientPathParameter({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-path-parameter", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-path-parameter", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-payload-constraint-validation/content.jsx b/swan-lake/by-example/http-client-payload-constraint-validation/content.jsx index a9132772e079..be1f6c30f1a2 100644 --- a/swan-lake/by-example/http-client-payload-constraint-validation/content.jsx +++ b/swan-lake/by-example/http-client-payload-constraint-validation/content.jsx @@ -70,7 +70,7 @@ export function HttpClientPayloadConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-payload-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-payload-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-query-parameter/content.jsx b/swan-lake/by-example/http-client-query-parameter/content.jsx index 12cef834e913..6105afbd78fa 100644 --- a/swan-lake/by-example/http-client-query-parameter/content.jsx +++ b/swan-lake/by-example/http-client-query-parameter/content.jsx @@ -68,7 +68,7 @@ export function HttpClientQueryParameter({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-query-parameter", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-query-parameter", "_blank", ); }} @@ -234,7 +234,7 @@ export function HttpClientQueryParameter({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-query-parameter", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-query-parameter", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-redirects/content.jsx b/swan-lake/by-example/http-client-redirects/content.jsx index d6ed2cc36c11..7c0c5aafbd4e 100644 --- a/swan-lake/by-example/http-client-redirects/content.jsx +++ b/swan-lake/by-example/http-client-redirects/content.jsx @@ -58,7 +58,7 @@ export function HttpClientRedirects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-redirects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-redirects", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-self-signed-jwt-authentication/content.jsx b/swan-lake/by-example/http-client-self-signed-jwt-authentication/content.jsx index 32caeb93dbfc..c1a9f23b8c14 100644 --- a/swan-lake/by-example/http-client-self-signed-jwt-authentication/content.jsx +++ b/swan-lake/by-example/http-client-self-signed-jwt-authentication/content.jsx @@ -73,7 +73,7 @@ export function HttpClientSelfSignedJwtAuthentication({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-self-signed-jwt-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-self-signed-jwt-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-send-request-receive-response/content.jsx b/swan-lake/by-example/http-client-send-request-receive-response/content.jsx index 8ba5db48b75b..68938dd71eb6 100644 --- a/swan-lake/by-example/http-client-send-request-receive-response/content.jsx +++ b/swan-lake/by-example/http-client-send-request-receive-response/content.jsx @@ -68,7 +68,7 @@ export function HttpClientSendRequestReceiveResponse({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-send-request-receive-response", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-send-request-receive-response", "_blank", ); }} diff --git a/swan-lake/by-example/http-client-ssl-tls/content.jsx b/swan-lake/by-example/http-client-ssl-tls/content.jsx index c12aa27baa2d..8bf93107dca1 100644 --- a/swan-lake/by-example/http-client-ssl-tls/content.jsx +++ b/swan-lake/by-example/http-client-ssl-tls/content.jsx @@ -54,7 +54,7 @@ export function HttpClientSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-client-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-client-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/http-compression/content.jsx b/swan-lake/by-example/http-compression/content.jsx index effd10228560..94f879737fbc 100644 --- a/swan-lake/by-example/http-compression/content.jsx +++ b/swan-lake/by-example/http-compression/content.jsx @@ -66,7 +66,7 @@ export function HttpCompression({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-compression", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-compression", "_blank", ); }} diff --git a/swan-lake/by-example/http-cookies-client/content.jsx b/swan-lake/by-example/http-cookies-client/content.jsx index 44416fd2207e..a6fd9e9e00c7 100644 --- a/swan-lake/by-example/http-cookies-client/content.jsx +++ b/swan-lake/by-example/http-cookies-client/content.jsx @@ -65,7 +65,7 @@ export function HttpCookiesClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-cookies-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-cookies-client", "_blank", ); }} diff --git a/swan-lake/by-example/http-cookies-service/content.jsx b/swan-lake/by-example/http-cookies-service/content.jsx index 812072d5a784..ea3aaabe7a9d 100644 --- a/swan-lake/by-example/http-cookies-service/content.jsx +++ b/swan-lake/by-example/http-cookies-service/content.jsx @@ -89,7 +89,7 @@ export function HttpCookiesService({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-cookies-service", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-cookies-service", "_blank", ); }} diff --git a/swan-lake/by-example/http-cors/content.jsx b/swan-lake/by-example/http-cors/content.jsx index 08d7f32c0d35..17c1c089f055 100644 --- a/swan-lake/by-example/http-cors/content.jsx +++ b/swan-lake/by-example/http-cors/content.jsx @@ -75,7 +75,7 @@ export function HttpCors({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-cors", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-cors", "_blank", ); }} diff --git a/swan-lake/by-example/http-default-error-handling/content.jsx b/swan-lake/by-example/http-default-error-handling/content.jsx index 57818363c08b..5fa390cfb73d 100644 --- a/swan-lake/by-example/http-default-error-handling/content.jsx +++ b/swan-lake/by-example/http-default-error-handling/content.jsx @@ -76,7 +76,7 @@ export function HttpDefaultErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-default-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-default-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/http-default-resource/content.jsx b/swan-lake/by-example/http-default-resource/content.jsx index a1c9829aa70f..aa4c9fdf491d 100644 --- a/swan-lake/by-example/http-default-resource/content.jsx +++ b/swan-lake/by-example/http-default-resource/content.jsx @@ -56,7 +56,7 @@ export function HttpDefaultResource({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-default-resource", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-default-resource", "_blank", ); }} diff --git a/swan-lake/by-example/http-error-handling/content.jsx b/swan-lake/by-example/http-error-handling/content.jsx index 70e7e6c80b1d..8a44d5e3bff4 100644 --- a/swan-lake/by-example/http-error-handling/content.jsx +++ b/swan-lake/by-example/http-error-handling/content.jsx @@ -98,7 +98,7 @@ export function HttpErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/http-failover/content.jsx b/swan-lake/by-example/http-failover/content.jsx index 1400e2ae085e..04467880e7b1 100644 --- a/swan-lake/by-example/http-failover/content.jsx +++ b/swan-lake/by-example/http-failover/content.jsx @@ -62,7 +62,7 @@ export function HttpFailover({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-failover", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-failover", "_blank", ); }} diff --git a/swan-lake/by-example/http-header-param/content.jsx b/swan-lake/by-example/http-header-param/content.jsx index 1f46ed1e84b5..80771fbbc16a 100644 --- a/swan-lake/by-example/http-header-param/content.jsx +++ b/swan-lake/by-example/http-header-param/content.jsx @@ -69,7 +69,7 @@ export function HttpHeaderParam({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-header-param", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-header-param", "_blank", ); }} diff --git a/swan-lake/by-example/http-interceptor-error-handling/content.jsx b/swan-lake/by-example/http-interceptor-error-handling/content.jsx index 63419f343b67..13a6b7600c88 100644 --- a/swan-lake/by-example/http-interceptor-error-handling/content.jsx +++ b/swan-lake/by-example/http-interceptor-error-handling/content.jsx @@ -107,7 +107,7 @@ export function HttpInterceptorErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-interceptor-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-interceptor-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/http-load-balancer/content.jsx b/swan-lake/by-example/http-load-balancer/content.jsx index c2fec6fbab83..1d66b1dd7828 100644 --- a/swan-lake/by-example/http-load-balancer/content.jsx +++ b/swan-lake/by-example/http-load-balancer/content.jsx @@ -59,7 +59,7 @@ export function HttpLoadBalancer({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-load-balancer", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-load-balancer", "_blank", ); }} diff --git a/swan-lake/by-example/http-matrix-param/content.jsx b/swan-lake/by-example/http-matrix-param/content.jsx index cc882299e978..253cbe2aad34 100644 --- a/swan-lake/by-example/http-matrix-param/content.jsx +++ b/swan-lake/by-example/http-matrix-param/content.jsx @@ -68,7 +68,7 @@ export function HttpMatrixParam({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-matrix-param", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-matrix-param", "_blank", ); }} diff --git a/swan-lake/by-example/http-passthrough/content.jsx b/swan-lake/by-example/http-passthrough/content.jsx index 4a748abb97af..e99ed9e3718d 100644 --- a/swan-lake/by-example/http-passthrough/content.jsx +++ b/swan-lake/by-example/http-passthrough/content.jsx @@ -62,7 +62,7 @@ export function HttpPassthrough({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-passthrough", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-passthrough", "_blank", ); }} diff --git a/swan-lake/by-example/http-path-param/content.jsx b/swan-lake/by-example/http-path-param/content.jsx index acaae4befbe0..923f23f2a786 100644 --- a/swan-lake/by-example/http-path-param/content.jsx +++ b/swan-lake/by-example/http-path-param/content.jsx @@ -67,7 +67,7 @@ export function HttpPathParam({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-path-param", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-path-param", "_blank", ); }} diff --git a/swan-lake/by-example/http-query-parameter/content.jsx b/swan-lake/by-example/http-query-parameter/content.jsx index 515369cec609..d44d015c600d 100644 --- a/swan-lake/by-example/http-query-parameter/content.jsx +++ b/swan-lake/by-example/http-query-parameter/content.jsx @@ -69,7 +69,7 @@ export function HttpQueryParameter({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-query-parameter", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-query-parameter", "_blank", ); }} diff --git a/swan-lake/by-example/http-request-interceptor/content.jsx b/swan-lake/by-example/http-request-interceptor/content.jsx index d3b90de196c0..c45c11e460d6 100644 --- a/swan-lake/by-example/http-request-interceptor/content.jsx +++ b/swan-lake/by-example/http-request-interceptor/content.jsx @@ -108,7 +108,7 @@ export function HttpRequestInterceptor({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-request-interceptor", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-request-interceptor", "_blank", ); }} diff --git a/swan-lake/by-example/http-request-response/content.jsx b/swan-lake/by-example/http-request-response/content.jsx index fc13690edac6..c78c24a3475a 100644 --- a/swan-lake/by-example/http-request-response/content.jsx +++ b/swan-lake/by-example/http-request-response/content.jsx @@ -72,7 +72,7 @@ export function HttpRequestResponse({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-request-response", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-request-response", "_blank", ); }} diff --git a/swan-lake/by-example/http-request-with-multiparts/content.jsx b/swan-lake/by-example/http-request-with-multiparts/content.jsx index 76e69328b40f..fec382d1e979 100644 --- a/swan-lake/by-example/http-request-with-multiparts/content.jsx +++ b/swan-lake/by-example/http-request-with-multiparts/content.jsx @@ -129,7 +129,7 @@ export function HttpRequestWithMultiparts({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-request-with-multiparts", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-request-with-multiparts", "_blank", ); }} diff --git a/swan-lake/by-example/http-response-interceptor/content.jsx b/swan-lake/by-example/http-response-interceptor/content.jsx index 54e066b46a6f..f6df0e262d79 100644 --- a/swan-lake/by-example/http-response-interceptor/content.jsx +++ b/swan-lake/by-example/http-response-interceptor/content.jsx @@ -103,7 +103,7 @@ export function HttpResponseInterceptor({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-response-interceptor", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-response-interceptor", "_blank", ); }} diff --git a/swan-lake/by-example/http-response-with-multiparts/content.jsx b/swan-lake/by-example/http-response-with-multiparts/content.jsx index f1a73f008f8e..17c823afff48 100644 --- a/swan-lake/by-example/http-response-with-multiparts/content.jsx +++ b/swan-lake/by-example/http-response-with-multiparts/content.jsx @@ -155,7 +155,7 @@ export function HttpResponseWithMultiparts({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-response-with-multiparts", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-response-with-multiparts", "_blank", ); }} diff --git a/swan-lake/by-example/http-restrict-by-media-type/content.jsx b/swan-lake/by-example/http-restrict-by-media-type/content.jsx index d3aa199806ef..b432916c3365 100644 --- a/swan-lake/by-example/http-restrict-by-media-type/content.jsx +++ b/swan-lake/by-example/http-restrict-by-media-type/content.jsx @@ -63,7 +63,7 @@ export function HttpRestrictByMediaType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-restrict-by-media-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-restrict-by-media-type", "_blank", ); }} diff --git a/swan-lake/by-example/http-retry/content.jsx b/swan-lake/by-example/http-retry/content.jsx index 15f4cd9e0d53..dfe9567442bf 100644 --- a/swan-lake/by-example/http-retry/content.jsx +++ b/swan-lake/by-example/http-retry/content.jsx @@ -64,7 +64,7 @@ export function HttpRetry({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-retry", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-retry", "_blank", ); }} diff --git a/swan-lake/by-example/http-send-different-status-codes-with-payload/content.jsx b/swan-lake/by-example/http-send-different-status-codes-with-payload/content.jsx index 51feff49a9dd..805931994672 100644 --- a/swan-lake/by-example/http-send-different-status-codes-with-payload/content.jsx +++ b/swan-lake/by-example/http-send-different-status-codes-with-payload/content.jsx @@ -79,7 +79,7 @@ export function HttpSendDifferentStatusCodesWithPayload({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-send-different-status-codes-with-payload", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-send-different-status-codes-with-payload", "_blank", ); }} diff --git a/swan-lake/by-example/http-send-different-status-codes/content.jsx b/swan-lake/by-example/http-send-different-status-codes/content.jsx index 8c13944e5bd1..e6481001b989 100644 --- a/swan-lake/by-example/http-send-different-status-codes/content.jsx +++ b/swan-lake/by-example/http-send-different-status-codes/content.jsx @@ -67,7 +67,7 @@ export function HttpSendDifferentStatusCodes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-send-different-status-codes", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-send-different-status-codes", "_blank", ); }} diff --git a/swan-lake/by-example/http-send-header/content.jsx b/swan-lake/by-example/http-send-header/content.jsx index 121d4a6a260d..94b0c74fbf4e 100644 --- a/swan-lake/by-example/http-send-header/content.jsx +++ b/swan-lake/by-example/http-send-header/content.jsx @@ -74,7 +74,7 @@ export function HttpSendHeader({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-send-header", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-send-header", "_blank", ); }} diff --git a/swan-lake/by-example/http-send-response/content.jsx b/swan-lake/by-example/http-send-response/content.jsx index b9454474fa5d..9cb49f9dee5f 100644 --- a/swan-lake/by-example/http-send-response/content.jsx +++ b/swan-lake/by-example/http-send-response/content.jsx @@ -67,7 +67,7 @@ export function HttpSendResponse({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-send-response", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-send-response", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-and-resource-paths/content.jsx b/swan-lake/by-example/http-service-and-resource-paths/content.jsx index c703dfa04fc3..8084d5627733 100644 --- a/swan-lake/by-example/http-service-and-resource-paths/content.jsx +++ b/swan-lake/by-example/http-service-and-resource-paths/content.jsx @@ -22,8 +22,12 @@ table key(title) albums = table [ // It can be represented by both identifiers and string literals. E.g., \`/music\\-info\`, \`"/music-info"\`. service /info on new http:Listener(9090) { - // The \`resource path\` is \`albums\` and the \`resource accessor\` is \`get\`. - // The \`.\` represents the current resource that is \`/info\`. + // The \`resource path\` represents the relative path to the resource, and the \`resource accessor\` + // represents the HTTP method used to access the resource. + // Here, the resource path is \`/albums\`, and the resource accessor is \`get\`. + // This means the resource is invoked when an HTTP GET request is made to \`/info/albums\`. + // The \`resource path\` can be set as \`.\` to represent a resource with the \`service path\` + // that is \`/info\`. resource function get albums() returns Album[] { return albums.toArray(); } @@ -65,7 +69,7 @@ export function HttpServiceAndResourcePaths({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-and-resource-paths", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-and-resource-paths", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-basic-authentication-file-user-store/content.jsx b/swan-lake/by-example/http-service-basic-authentication-file-user-store/content.jsx index 04732c528681..97696e003bd6 100644 --- a/swan-lake/by-example/http-service-basic-authentication-file-user-store/content.jsx +++ b/swan-lake/by-example/http-service-basic-authentication-file-user-store/content.jsx @@ -107,7 +107,7 @@ export function HttpServiceBasicAuthenticationFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-basic-authentication-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-basic-authentication-file-user-store", "_blank", ); }} @@ -203,7 +203,7 @@ export function HttpServiceBasicAuthenticationFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-basic-authentication-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-basic-authentication-file-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-basic-authentication-ldap-user-store/content.jsx b/swan-lake/by-example/http-service-basic-authentication-ldap-user-store/content.jsx index efe0096e8dc3..f39b5ead6140 100644 --- a/swan-lake/by-example/http-service-basic-authentication-ldap-user-store/content.jsx +++ b/swan-lake/by-example/http-service-basic-authentication-ldap-user-store/content.jsx @@ -111,7 +111,7 @@ export function HttpServiceBasicAuthenticationLdapUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-basic-authentication-ldap-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-basic-authentication-ldap-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-cache-response/content.jsx b/swan-lake/by-example/http-service-cache-response/content.jsx index a2b6f8f15461..575e560d5fdc 100644 --- a/swan-lake/by-example/http-service-cache-response/content.jsx +++ b/swan-lake/by-example/http-service-cache-response/content.jsx @@ -65,7 +65,7 @@ export function HttpServiceCacheResponse({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-cache-response", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-cache-response", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-chunking/content.jsx b/swan-lake/by-example/http-service-chunking/content.jsx index 7c6b96cf92fe..6efcce0cc7a8 100644 --- a/swan-lake/by-example/http-service-chunking/content.jsx +++ b/swan-lake/by-example/http-service-chunking/content.jsx @@ -65,7 +65,7 @@ export function HttpServiceChunking({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-chunking", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-chunking", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-data-binding/content.jsx b/swan-lake/by-example/http-service-data-binding/content.jsx index d88a1425f6d7..d30d9e410cac 100644 --- a/swan-lake/by-example/http-service-data-binding/content.jsx +++ b/swan-lake/by-example/http-service-data-binding/content.jsx @@ -66,7 +66,7 @@ export function HttpServiceDataBinding({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-data-binding", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-data-binding", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-file-upload/content.jsx b/swan-lake/by-example/http-service-file-upload/content.jsx index cb1f2c441295..03664c6a0be6 100644 --- a/swan-lake/by-example/http-service-file-upload/content.jsx +++ b/swan-lake/by-example/http-service-file-upload/content.jsx @@ -52,7 +52,7 @@ export function HttpServiceFileUpload({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-file-upload", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-file-upload", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-jwt-authentication/content.jsx b/swan-lake/by-example/http-service-jwt-authentication/content.jsx index cf9ae084f53f..15467d4acf35 100644 --- a/swan-lake/by-example/http-service-jwt-authentication/content.jsx +++ b/swan-lake/by-example/http-service-jwt-authentication/content.jsx @@ -89,7 +89,7 @@ export function HttpServiceJwtAuthentication({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-jwt-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-jwt-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-mutual-ssl/content.jsx b/swan-lake/by-example/http-service-mutual-ssl/content.jsx index 6c14426b2520..47652b113c55 100644 --- a/swan-lake/by-example/http-service-mutual-ssl/content.jsx +++ b/swan-lake/by-example/http-service-mutual-ssl/content.jsx @@ -78,7 +78,7 @@ export function HttpServiceMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-oauth2/content.jsx b/swan-lake/by-example/http-service-oauth2/content.jsx index 6c21c0683887..9dc3373c9953 100644 --- a/swan-lake/by-example/http-service-oauth2/content.jsx +++ b/swan-lake/by-example/http-service-oauth2/content.jsx @@ -94,7 +94,7 @@ export function HttpServiceOauth2({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-oauth2", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-oauth2", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-payload-constraint-validation/content.jsx b/swan-lake/by-example/http-service-payload-constraint-validation/content.jsx index 5c39587579d2..825d1767e685 100644 --- a/swan-lake/by-example/http-service-payload-constraint-validation/content.jsx +++ b/swan-lake/by-example/http-service-payload-constraint-validation/content.jsx @@ -67,7 +67,7 @@ export function HttpServicePayloadConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-payload-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-payload-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-redirects/content.jsx b/swan-lake/by-example/http-service-redirects/content.jsx index 94b4127838c5..99952a9609a6 100644 --- a/swan-lake/by-example/http-service-redirects/content.jsx +++ b/swan-lake/by-example/http-service-redirects/content.jsx @@ -54,7 +54,7 @@ export function HttpServiceRedirects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-redirects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-redirects", "_blank", ); }} diff --git a/swan-lake/by-example/http-service-ssl-tls/content.jsx b/swan-lake/by-example/http-service-ssl-tls/content.jsx index f608f6c002b4..7c4d81751fef 100644 --- a/swan-lake/by-example/http-service-ssl-tls/content.jsx +++ b/swan-lake/by-example/http-service-ssl-tls/content.jsx @@ -66,7 +66,7 @@ export function HttpServiceSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-service-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-service-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/http-timeout/content.jsx b/swan-lake/by-example/http-timeout/content.jsx index 511b5eed398f..095f7a78c359 100644 --- a/swan-lake/by-example/http-timeout/content.jsx +++ b/swan-lake/by-example/http-timeout/content.jsx @@ -52,7 +52,7 @@ export function HttpTimeout({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-timeout", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-timeout", "_blank", ); }} diff --git a/swan-lake/by-example/http-trace-logs/content.jsx b/swan-lake/by-example/http-trace-logs/content.jsx index dab3e389345f..bd48fb0a27b0 100644 --- a/swan-lake/by-example/http-trace-logs/content.jsx +++ b/swan-lake/by-example/http-trace-logs/content.jsx @@ -65,7 +65,7 @@ export function HttpTraceLogs({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-trace-logs", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-trace-logs", "_blank", ); }} @@ -363,7 +363,7 @@ export function HttpTraceLogs({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/http-trace-logs", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/http-trace-logs", "_blank", ); }} diff --git a/swan-lake/by-example/identifiers/content.jsx b/swan-lake/by-example/identifiers/content.jsx index ed32ef8612de..814923dca8d8 100644 --- a/swan-lake/by-example/identifiers/content.jsx +++ b/swan-lake/by-example/identifiers/content.jsx @@ -48,7 +48,7 @@ export function Identifiers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/identifiers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/identifiers", "_blank", ); }} diff --git a/swan-lake/by-example/identity/content.jsx b/swan-lake/by-example/identity/content.jsx index a53870d20422..8754bf983877 100644 --- a/swan-lake/by-example/identity/content.jsx +++ b/swan-lake/by-example/identity/content.jsx @@ -75,7 +75,7 @@ export function Identity({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/identity", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/identity", "_blank", ); }} diff --git a/swan-lake/by-example/if-statement/content.jsx b/swan-lake/by-example/if-statement/content.jsx index 97a2308c9818..b391ccbd8e96 100644 --- a/swan-lake/by-example/if-statement/content.jsx +++ b/swan-lake/by-example/if-statement/content.jsx @@ -73,7 +73,7 @@ export function IfStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/if-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/if-statement", "_blank", ); }} diff --git a/swan-lake/by-example/ignoring-return-values-and-errors/content.jsx b/swan-lake/by-example/ignoring-return-values-and-errors/content.jsx index 1f64249bd371..0c6875f1ab05 100644 --- a/swan-lake/by-example/ignoring-return-values-and-errors/content.jsx +++ b/swan-lake/by-example/ignoring-return-values-and-errors/content.jsx @@ -74,7 +74,7 @@ export function IgnoringReturnValuesAndErrors({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/ignoring-return-values-and-errors", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/ignoring-return-values-and-errors", "_blank", ); }} diff --git a/swan-lake/by-example/immutability/content.jsx b/swan-lake/by-example/immutability/content.jsx index c5daa05f82a4..5500e1d14d23 100644 --- a/swan-lake/by-example/immutability/content.jsx +++ b/swan-lake/by-example/immutability/content.jsx @@ -67,7 +67,7 @@ export function Immutability({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/immutability", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/immutability", "_blank", ); }} diff --git a/swan-lake/by-example/included-record-parameters/content.jsx b/swan-lake/by-example/included-record-parameters/content.jsx index c7270cbcdac4..d66d1dcf25e1 100644 --- a/swan-lake/by-example/included-record-parameters/content.jsx +++ b/swan-lake/by-example/included-record-parameters/content.jsx @@ -59,7 +59,7 @@ export function IncludedRecordParameters({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/included-record-parameters", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/included-record-parameters", "_blank", ); }} diff --git a/swan-lake/by-example/index.jsx b/swan-lake/by-example/index.jsx index 16dfd46ddc35..994ced185cfe 100644 --- a/swan-lake/by-example/index.jsx +++ b/swan-lake/by-example/index.jsx @@ -707,10 +707,18 @@ import { InterWorkerMessagePassing, codeSnippetData as InterWorkerMessagePassingCodeSnippetData, } from "./inter-worker-message-passing/content.jsx"; +import { + ConditionalSend, + codeSnippetData as ConditionalSendCodeSnippetData, +} from "./conditional-send/content.jsx"; import { InterWorkerFailurePropagation, codeSnippetData as InterWorkerFailurePropagationCodeSnippetData, } from "./inter-worker-failure-propagation/content.jsx"; +import { + NamedWorkerWithOnFailClause, + codeSnippetData as NamedWorkerWithOnFailClauseCodeSnippetData, +} from "./named-worker-with-on-fail-clause/content.jsx"; import { SynchronizeMessagePassing, codeSnippetData as SynchronizeMessagePassingCodeSnippetData, @@ -2413,8 +2421,12 @@ const BBEs = { NamedWorkersAndFuturesCodeSnippetData, InterWorkerMessagePassing, InterWorkerMessagePassingCodeSnippetData, + ConditionalSend, + ConditionalSendCodeSnippetData, InterWorkerFailurePropagation, InterWorkerFailurePropagationCodeSnippetData, + NamedWorkerWithOnFailClause, + NamedWorkerWithOnFailClauseCodeSnippetData, SynchronizeMessagePassing, SynchronizeMessagePassingCodeSnippetData, AsynchronizeMessagePassing, diff --git a/swan-lake/by-example/inferring-isolated/content.jsx b/swan-lake/by-example/inferring-isolated/content.jsx index 4ee829fd62c0..7a94a4e8d021 100644 --- a/swan-lake/by-example/inferring-isolated/content.jsx +++ b/swan-lake/by-example/inferring-isolated/content.jsx @@ -85,7 +85,7 @@ export function InferringIsolated({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/inferring-isolated", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/inferring-isolated", "_blank", ); }} diff --git a/swan-lake/by-example/init-function/content.jsx b/swan-lake/by-example/init-function/content.jsx index 2ba0f109198f..c60ceaec8aa7 100644 --- a/swan-lake/by-example/init-function/content.jsx +++ b/swan-lake/by-example/init-function/content.jsx @@ -67,7 +67,7 @@ export function InitFunction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/init-function", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/init-function", "_blank", ); }} diff --git a/swan-lake/by-example/init-return-type/content.jsx b/swan-lake/by-example/init-return-type/content.jsx index ea13ff07904d..3c4f6acfee59 100644 --- a/swan-lake/by-example/init-return-type/content.jsx +++ b/swan-lake/by-example/init-return-type/content.jsx @@ -63,7 +63,7 @@ export function InitReturnType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/init-return-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/init-return-type", "_blank", ); }} diff --git a/swan-lake/by-example/int-range/content.jsx b/swan-lake/by-example/int-range/content.jsx index 69b5485f58bc..c9459171acf6 100644 --- a/swan-lake/by-example/int-range/content.jsx +++ b/swan-lake/by-example/int-range/content.jsx @@ -60,7 +60,7 @@ export function IntRange({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/int-range", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/int-range", "_blank", ); }} diff --git a/swan-lake/by-example/integers/content.jsx b/swan-lake/by-example/integers/content.jsx index 2154eba2e56c..b4f9b36560ab 100644 --- a/swan-lake/by-example/integers/content.jsx +++ b/swan-lake/by-example/integers/content.jsx @@ -50,7 +50,7 @@ export function Integers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/integers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/integers", "_blank", ); }} diff --git a/swan-lake/by-example/inter-worker-failure-propagation/content.jsx b/swan-lake/by-example/inter-worker-failure-propagation/content.jsx index a1ce77bb5651..8a110170f41e 100644 --- a/swan-lake/by-example/inter-worker-failure-propagation/content.jsx +++ b/swan-lake/by-example/inter-worker-failure-propagation/content.jsx @@ -75,7 +75,7 @@ export function InterWorkerFailurePropagation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/inter-worker-failure-propagation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/inter-worker-failure-propagation", "_blank", ); }} @@ -213,8 +213,8 @@ export function InterWorkerFailurePropagation({ codeSnippets }) {
updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} > - Inter-worker message passing + Conditional send
@@ -249,8 +249,8 @@ export function InterWorkerFailurePropagation({ codeSnippets }) {
@@ -260,7 +260,7 @@ export function InterWorkerFailurePropagation({ codeSnippets }) { onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} > - Synchronize message passing + Named worker with on fail clause
{ window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/inter-worker-message-passing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/inter-worker-message-passing", "_blank", ); }} @@ -245,8 +245,8 @@ export function InterWorkerMessagePassing({ codeSnippets }) {
@@ -256,7 +256,7 @@ export function InterWorkerMessagePassing({ codeSnippets }) { onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} > - Inter-worker failure propagation + Conditional send
{ window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/interface-to-external-code", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/interface-to-external-code", "_blank", ); }} diff --git a/swan-lake/by-example/io-bytes/content.jsx b/swan-lake/by-example/io-bytes/content.jsx index b11a4ca89a1c..9a02ec8d2113 100644 --- a/swan-lake/by-example/io-bytes/content.jsx +++ b/swan-lake/by-example/io-bytes/content.jsx @@ -66,7 +66,7 @@ export function IoBytes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/io-bytes", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/io-bytes", "_blank", ); }} diff --git a/swan-lake/by-example/io-csv-datamapping/content.jsx b/swan-lake/by-example/io-csv-datamapping/content.jsx index 65e0d5162823..c25ab15eaf29 100644 --- a/swan-lake/by-example/io-csv-datamapping/content.jsx +++ b/swan-lake/by-example/io-csv-datamapping/content.jsx @@ -82,7 +82,7 @@ export function IoCsvDatamapping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/io-csv-datamapping", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/io-csv-datamapping", "_blank", ); }} diff --git a/swan-lake/by-example/io-csv/content.jsx b/swan-lake/by-example/io-csv/content.jsx index 9a52d237aa32..9fd995e97a7c 100644 --- a/swan-lake/by-example/io-csv/content.jsx +++ b/swan-lake/by-example/io-csv/content.jsx @@ -68,7 +68,7 @@ export function IoCsv({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/io-csv", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/io-csv", "_blank", ); }} diff --git a/swan-lake/by-example/io-json/content.jsx b/swan-lake/by-example/io-json/content.jsx index 6f5ebec80697..a87f0c4928bb 100644 --- a/swan-lake/by-example/io-json/content.jsx +++ b/swan-lake/by-example/io-json/content.jsx @@ -65,7 +65,7 @@ export function IoJson({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/io-json", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/io-json", "_blank", ); }} diff --git a/swan-lake/by-example/io-strings/content.jsx b/swan-lake/by-example/io-strings/content.jsx index 2cf2fceb7253..afecfa457768 100644 --- a/swan-lake/by-example/io-strings/content.jsx +++ b/swan-lake/by-example/io-strings/content.jsx @@ -78,7 +78,7 @@ export function IoStrings({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/io-strings", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/io-strings", "_blank", ); }} diff --git a/swan-lake/by-example/io-xml/content.jsx b/swan-lake/by-example/io-xml/content.jsx index c3acea806555..25ded391dae6 100644 --- a/swan-lake/by-example/io-xml/content.jsx +++ b/swan-lake/by-example/io-xml/content.jsx @@ -57,7 +57,7 @@ export function IoXml({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/io-xml", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/io-xml", "_blank", ); }} diff --git a/swan-lake/by-example/isolated-functions/content.jsx b/swan-lake/by-example/isolated-functions/content.jsx index 7de4cd031871..f89331781d98 100644 --- a/swan-lake/by-example/isolated-functions/content.jsx +++ b/swan-lake/by-example/isolated-functions/content.jsx @@ -98,7 +98,7 @@ export function IsolatedFunctions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/isolated-functions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/isolated-functions", "_blank", ); }} diff --git a/swan-lake/by-example/isolated-methods/content.jsx b/swan-lake/by-example/isolated-methods/content.jsx index 1b6a3ea98a75..61dc5033c7a1 100644 --- a/swan-lake/by-example/isolated-methods/content.jsx +++ b/swan-lake/by-example/isolated-methods/content.jsx @@ -76,7 +76,7 @@ export function IsolatedMethods({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/isolated-methods", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/isolated-methods", "_blank", ); }} diff --git a/swan-lake/by-example/isolated-objects/content.jsx b/swan-lake/by-example/isolated-objects/content.jsx index edf4b3adb18f..2877d8ef7137 100644 --- a/swan-lake/by-example/isolated-objects/content.jsx +++ b/swan-lake/by-example/isolated-objects/content.jsx @@ -116,7 +116,7 @@ export function IsolatedObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/isolated-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/isolated-objects", "_blank", ); }} diff --git a/swan-lake/by-example/isolated-variables/content.jsx b/swan-lake/by-example/isolated-variables/content.jsx index f4bb28ca3ac0..995b3817f1a5 100644 --- a/swan-lake/by-example/isolated-variables/content.jsx +++ b/swan-lake/by-example/isolated-variables/content.jsx @@ -97,7 +97,7 @@ export function IsolatedVariables({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/isolated-variables", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/isolated-variables", "_blank", ); }} diff --git a/swan-lake/by-example/iterating-over-xml-with-query/content.jsx b/swan-lake/by-example/iterating-over-xml-with-query/content.jsx index 3d8c40ee4087..12a6b910ff2c 100644 --- a/swan-lake/by-example/iterating-over-xml-with-query/content.jsx +++ b/swan-lake/by-example/iterating-over-xml-with-query/content.jsx @@ -68,7 +68,7 @@ export function IteratingOverXmlWithQuery({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/iterating-over-xml-with-query", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/iterating-over-xml-with-query", "_blank", ); }} diff --git a/swan-lake/by-example/iterative-use-of-typed-binding/content.jsx b/swan-lake/by-example/iterative-use-of-typed-binding/content.jsx index ccbd7e265487..8cabefff1a32 100644 --- a/swan-lake/by-example/iterative-use-of-typed-binding/content.jsx +++ b/swan-lake/by-example/iterative-use-of-typed-binding/content.jsx @@ -78,7 +78,7 @@ export function IterativeUseOfTypedBinding({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/iterative-use-of-typed-binding", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/iterative-use-of-typed-binding", "_blank", ); }} diff --git a/swan-lake/by-example/jms-consumer-acknowledgement/content.jsx b/swan-lake/by-example/jms-consumer-acknowledgement/content.jsx index e641908a3330..4bbc4dc2c770 100644 --- a/swan-lake/by-example/jms-consumer-acknowledgement/content.jsx +++ b/swan-lake/by-example/jms-consumer-acknowledgement/content.jsx @@ -62,7 +62,7 @@ export function JmsConsumerAcknowledgement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/jms-consumer-acknowledgement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/jms-consumer-acknowledgement", "_blank", ); }} diff --git a/swan-lake/by-example/jms-consumer-consume-message/content.jsx b/swan-lake/by-example/jms-consumer-consume-message/content.jsx index bb5c24abeaee..d7e9506537cc 100644 --- a/swan-lake/by-example/jms-consumer-consume-message/content.jsx +++ b/swan-lake/by-example/jms-consumer-consume-message/content.jsx @@ -59,7 +59,7 @@ export function JmsConsumerConsumeMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/jms-consumer-consume-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/jms-consumer-consume-message", "_blank", ); }} diff --git a/swan-lake/by-example/jms-producer-produce-message/content.jsx b/swan-lake/by-example/jms-producer-produce-message/content.jsx index 196788a6f82a..50f1b911d036 100644 --- a/swan-lake/by-example/jms-producer-produce-message/content.jsx +++ b/swan-lake/by-example/jms-producer-produce-message/content.jsx @@ -80,7 +80,7 @@ export function JmsProducerProduceMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/jms-producer-produce-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/jms-producer-produce-message", "_blank", ); }} diff --git a/swan-lake/by-example/jms-producer-transaction/content.jsx b/swan-lake/by-example/jms-producer-transaction/content.jsx index 7153b5dabc85..300d8b792b2d 100644 --- a/swan-lake/by-example/jms-producer-transaction/content.jsx +++ b/swan-lake/by-example/jms-producer-transaction/content.jsx @@ -72,7 +72,7 @@ export function JmsProducerTransaction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/jms-producer-transaction", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/jms-producer-transaction", "_blank", ); }} diff --git a/swan-lake/by-example/jms-service-consume-message/content.jsx b/swan-lake/by-example/jms-service-consume-message/content.jsx index 10de38d60cbe..3a1af753ee5a 100644 --- a/swan-lake/by-example/jms-service-consume-message/content.jsx +++ b/swan-lake/by-example/jms-service-consume-message/content.jsx @@ -61,7 +61,7 @@ export function JmsServiceConsumeMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/jms-service-consume-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/jms-service-consume-message", "_blank", ); }} diff --git a/swan-lake/by-example/joining-iterable-objects/content.jsx b/swan-lake/by-example/joining-iterable-objects/content.jsx index eccc8dbd84d1..46470c7a681d 100644 --- a/swan-lake/by-example/joining-iterable-objects/content.jsx +++ b/swan-lake/by-example/joining-iterable-objects/content.jsx @@ -84,7 +84,7 @@ export function JoiningIterableObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/joining-iterable-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/joining-iterable-objects", "_blank", ); }} diff --git a/swan-lake/by-example/json-numbers/content.jsx b/swan-lake/by-example/json-numbers/content.jsx index 90c4588b0dff..b6f3176d28ec 100644 --- a/swan-lake/by-example/json-numbers/content.jsx +++ b/swan-lake/by-example/json-numbers/content.jsx @@ -81,7 +81,7 @@ export function JsonNumbers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/json-numbers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/json-numbers", "_blank", ); }} diff --git a/swan-lake/by-example/json-to-record-with-projection/content.jsx b/swan-lake/by-example/json-to-record-with-projection/content.jsx index 113e0457093d..89ff34443e9a 100644 --- a/swan-lake/by-example/json-to-record-with-projection/content.jsx +++ b/swan-lake/by-example/json-to-record-with-projection/content.jsx @@ -78,7 +78,7 @@ export function JsonToRecordWithProjection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/json-to-record-with-projection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/json-to-record-with-projection", "_blank", ); }} @@ -205,44 +205,9 @@ export function JsonToRecordWithProjection({ codeSnippets }) {
             
-              {`import ballerina/data.jsondata;`}
-              {`import ballerina/io;`}
-              {`
-`}
-              {`// Define a closed record type to capture the required fields from the JSON content.`}
-              {`type Book record {|`}
-              {`    string name;`}
-              {`    string author;`}
-              {`|};`}
-              {`
-`}
-              {`json jsonContent = {`}
-              {`    "name": "Clean Code",`}
-              {`    "author": "Robert C. Martin",`}
-              {`    "year": 2008,`}
-              {`    "publisher": "Prentice Hall"`}
-              {`};`}
-              {`
-`}
-              {`string jsonStr = string \``}
-              {`{`}
-              {`    "name": "The Pragmatic Programmer",`}
-              {`    "author": "Andrew Hunt, David Thomas",`}
-              {`    "year": 1999,`}
-              {`    "publisher": "Addison-Wesley"`}
-              {`}\`;`}
-              {`
-`}
-              {`public function main() returns error? {`}
-              {`    // Based on the expected type, it selectively converts the JSON content to the record type.`}
-              {`    Book book = check jsondata:parseAsType(jsonContent);`}
-              {`    io:println(book);`}
-              {`
-`}
-              {`    // Based on the expected type, it selectively converts the JSON string to the record type.`}
-              {`    Book book2 = check jsondata:parseString(jsonStr);`}
-              {`    io:println(book2);`}
-              {`}`}
+              {`\$ bal run json_to_record_with_projection.bal`}
+              {`{"name":"Clean Code","author":"Robert C. Martin"}`}
+              {`{"name":"The Pragmatic Programmer","author":"Andrew Hunt, David Thomas"}`}
             
           
diff --git a/swan-lake/by-example/json-to-record/content.jsx b/swan-lake/by-example/json-to-record/content.jsx index cddebc7de75d..fcfaecbdb5ec 100644 --- a/swan-lake/by-example/json-to-record/content.jsx +++ b/swan-lake/by-example/json-to-record/content.jsx @@ -108,7 +108,7 @@ export function JsonToRecord({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/json-to-record", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/json-to-record", "_blank", ); }} diff --git a/swan-lake/by-example/json-type/content.jsx b/swan-lake/by-example/json-type/content.jsx index eeabb61f3c9b..a437601d1c6f 100644 --- a/swan-lake/by-example/json-type/content.jsx +++ b/swan-lake/by-example/json-type/content.jsx @@ -88,7 +88,7 @@ export function JsonType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/json-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/json-type", "_blank", ); }} diff --git a/swan-lake/by-example/jsonpath-expressions/content.jsx b/swan-lake/by-example/jsonpath-expressions/content.jsx index 209bab6a6aca..9b80bfc567e7 100644 --- a/swan-lake/by-example/jsonpath-expressions/content.jsx +++ b/swan-lake/by-example/jsonpath-expressions/content.jsx @@ -83,7 +83,7 @@ export function JsonpathExpressions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/jsonpath-expressions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/jsonpath-expressions", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-consumer-constraint-validation/content.jsx b/swan-lake/by-example/kafka-consumer-constraint-validation/content.jsx index 8493e8ca4cdd..27b1825f9623 100644 --- a/swan-lake/by-example/kafka-consumer-constraint-validation/content.jsx +++ b/swan-lake/by-example/kafka-consumer-constraint-validation/content.jsx @@ -74,7 +74,7 @@ export function KafkaConsumerConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-consumer-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-consumer-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-consumer-consumer-record-data-binding/content.jsx b/swan-lake/by-example/kafka-consumer-consumer-record-data-binding/content.jsx index 0f17d3fbc869..d096791cc42d 100644 --- a/swan-lake/by-example/kafka-consumer-consumer-record-data-binding/content.jsx +++ b/swan-lake/by-example/kafka-consumer-consumer-record-data-binding/content.jsx @@ -83,7 +83,7 @@ export function KafkaConsumerConsumerRecordDataBinding({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-consumer-consumer-record-data-binding", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-consumer-consumer-record-data-binding", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-consumer-payload-data-binding/content.jsx b/swan-lake/by-example/kafka-consumer-payload-data-binding/content.jsx index 8f34db5eb0ab..a095d2821de1 100644 --- a/swan-lake/by-example/kafka-consumer-payload-data-binding/content.jsx +++ b/swan-lake/by-example/kafka-consumer-payload-data-binding/content.jsx @@ -74,7 +74,7 @@ export function KafkaConsumerPayloadDataBinding({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-consumer-payload-data-binding", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-consumer-payload-data-binding", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-consumer-sasl/content.jsx b/swan-lake/by-example/kafka-consumer-sasl/content.jsx index 6aaf3bbbbcb5..8a884c808927 100644 --- a/swan-lake/by-example/kafka-consumer-sasl/content.jsx +++ b/swan-lake/by-example/kafka-consumer-sasl/content.jsx @@ -76,7 +76,7 @@ export function KafkaConsumerSasl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-consumer-sasl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-consumer-sasl", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-consumer-ssl/content.jsx b/swan-lake/by-example/kafka-consumer-ssl/content.jsx index 262b660e17ef..5e71cd2b8079 100644 --- a/swan-lake/by-example/kafka-consumer-ssl/content.jsx +++ b/swan-lake/by-example/kafka-consumer-ssl/content.jsx @@ -75,7 +75,7 @@ export function KafkaConsumerSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-consumer-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-consumer-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-producer-produce-message/content.jsx b/swan-lake/by-example/kafka-producer-produce-message/content.jsx index 75f1d731a622..ec6363ba2d8b 100644 --- a/swan-lake/by-example/kafka-producer-produce-message/content.jsx +++ b/swan-lake/by-example/kafka-producer-produce-message/content.jsx @@ -69,7 +69,7 @@ export function KafkaProducerProduceMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-producer-produce-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-producer-produce-message", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-producer-sasl/content.jsx b/swan-lake/by-example/kafka-producer-sasl/content.jsx index a0e7adbff144..eaf8444dd75f 100644 --- a/swan-lake/by-example/kafka-producer-sasl/content.jsx +++ b/swan-lake/by-example/kafka-producer-sasl/content.jsx @@ -79,7 +79,7 @@ export function KafkaProducerSasl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-producer-sasl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-producer-sasl", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-producer-ssl/content.jsx b/swan-lake/by-example/kafka-producer-ssl/content.jsx index ef6bd483d512..4d198a500712 100644 --- a/swan-lake/by-example/kafka-producer-ssl/content.jsx +++ b/swan-lake/by-example/kafka-producer-ssl/content.jsx @@ -89,7 +89,7 @@ export function KafkaProducerSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-producer-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-producer-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-service-constraint-validation/content.jsx b/swan-lake/by-example/kafka-service-constraint-validation/content.jsx index a70ba19cdbfb..e84b598de40d 100644 --- a/swan-lake/by-example/kafka-service-constraint-validation/content.jsx +++ b/swan-lake/by-example/kafka-service-constraint-validation/content.jsx @@ -76,7 +76,7 @@ export function KafkaServiceConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-service-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-service-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-service-consume-message/content.jsx b/swan-lake/by-example/kafka-service-consume-message/content.jsx index 66cd2f69ac99..13d90d680726 100644 --- a/swan-lake/by-example/kafka-service-consume-message/content.jsx +++ b/swan-lake/by-example/kafka-service-consume-message/content.jsx @@ -75,7 +75,7 @@ export function KafkaServiceConsumeMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-service-consume-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-service-consume-message", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-service-error-handling/content.jsx b/swan-lake/by-example/kafka-service-error-handling/content.jsx index a1b2e4350937..9bab8ef5f7e5 100644 --- a/swan-lake/by-example/kafka-service-error-handling/content.jsx +++ b/swan-lake/by-example/kafka-service-error-handling/content.jsx @@ -95,7 +95,7 @@ export function KafkaServiceErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-service-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-service-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-service-sasl/content.jsx b/swan-lake/by-example/kafka-service-sasl/content.jsx index d249f6a381a8..8e5c7c29c208 100644 --- a/swan-lake/by-example/kafka-service-sasl/content.jsx +++ b/swan-lake/by-example/kafka-service-sasl/content.jsx @@ -77,7 +77,7 @@ export function KafkaServiceSasl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-service-sasl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-service-sasl", "_blank", ); }} diff --git a/swan-lake/by-example/kafka-service-ssl/content.jsx b/swan-lake/by-example/kafka-service-ssl/content.jsx index ca90961517ab..357be25ba735 100644 --- a/swan-lake/by-example/kafka-service-ssl/content.jsx +++ b/swan-lake/by-example/kafka-service-ssl/content.jsx @@ -75,7 +75,7 @@ export function KafkaServiceSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kafka-service-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kafka-service-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/kubernetes-hello-world/content.jsx b/swan-lake/by-example/kubernetes-hello-world/content.jsx index ecd816f7338f..f641c04e3892 100644 --- a/swan-lake/by-example/kubernetes-hello-world/content.jsx +++ b/swan-lake/by-example/kubernetes-hello-world/content.jsx @@ -75,7 +75,7 @@ export function KubernetesHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kubernetes-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kubernetes-hello-world", "_blank", ); }} @@ -174,7 +174,7 @@ export function KubernetesHelloWorld({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/kubernetes-hello-world", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/kubernetes-hello-world", "_blank", ); }} diff --git a/swan-lake/by-example/langlib-functions/content.jsx b/swan-lake/by-example/langlib-functions/content.jsx index 253abc407afd..ff408046aecb 100644 --- a/swan-lake/by-example/langlib-functions/content.jsx +++ b/swan-lake/by-example/langlib-functions/content.jsx @@ -89,7 +89,7 @@ export function LanglibFunctions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/langlib-functions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/langlib-functions", "_blank", ); }} diff --git a/swan-lake/by-example/let-clause/content.jsx b/swan-lake/by-example/let-clause/content.jsx index 60c3a7a7e219..5c3b52061add 100644 --- a/swan-lake/by-example/let-clause/content.jsx +++ b/swan-lake/by-example/let-clause/content.jsx @@ -71,7 +71,7 @@ export function LetClause({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/let-clause", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/let-clause", "_blank", ); }} diff --git a/swan-lake/by-example/limit-clause/content.jsx b/swan-lake/by-example/limit-clause/content.jsx index 256f75071649..fce98ce92ec8 100644 --- a/swan-lake/by-example/limit-clause/content.jsx +++ b/swan-lake/by-example/limit-clause/content.jsx @@ -63,7 +63,7 @@ export function LimitClause({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/limit-clause", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/limit-clause", "_blank", ); }} diff --git a/swan-lake/by-example/list-binding-pattern-in-match-statement/content.jsx b/swan-lake/by-example/list-binding-pattern-in-match-statement/content.jsx index 8ffacb0a2071..b2749d108245 100644 --- a/swan-lake/by-example/list-binding-pattern-in-match-statement/content.jsx +++ b/swan-lake/by-example/list-binding-pattern-in-match-statement/content.jsx @@ -65,7 +65,7 @@ export function ListBindingPatternInMatchStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/list-binding-pattern-in-match-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/list-binding-pattern-in-match-statement", "_blank", ); }} diff --git a/swan-lake/by-example/list-binding-pattern/content.jsx b/swan-lake/by-example/list-binding-pattern/content.jsx index 5773ad2928bf..90c9d8d07b11 100644 --- a/swan-lake/by-example/list-binding-pattern/content.jsx +++ b/swan-lake/by-example/list-binding-pattern/content.jsx @@ -52,7 +52,7 @@ export function ListBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/list-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/list-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/list-equality/content.jsx b/swan-lake/by-example/list-equality/content.jsx index bfedf0341d96..c1820e42d780 100644 --- a/swan-lake/by-example/list-equality/content.jsx +++ b/swan-lake/by-example/list-equality/content.jsx @@ -72,7 +72,7 @@ export function ListEquality({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/list-equality", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/list-equality", "_blank", ); }} diff --git a/swan-lake/by-example/list-subtyping/content.jsx b/swan-lake/by-example/list-subtyping/content.jsx index d3dad1a78a5b..fbf882e792fc 100644 --- a/swan-lake/by-example/list-subtyping/content.jsx +++ b/swan-lake/by-example/list-subtyping/content.jsx @@ -66,7 +66,7 @@ export function ListSubtyping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/list-subtyping", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/list-subtyping", "_blank", ); }} diff --git a/swan-lake/by-example/lock-statement/content.jsx b/swan-lake/by-example/lock-statement/content.jsx index 5229fc28e6e0..f19f3f23dc01 100644 --- a/swan-lake/by-example/lock-statement/content.jsx +++ b/swan-lake/by-example/lock-statement/content.jsx @@ -55,7 +55,7 @@ export function LockStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/lock-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/lock-statement", "_blank", ); }} diff --git a/swan-lake/by-example/logging-configuration/content.jsx b/swan-lake/by-example/logging-configuration/content.jsx index 232f13b073fa..a45870f0c7a8 100644 --- a/swan-lake/by-example/logging-configuration/content.jsx +++ b/swan-lake/by-example/logging-configuration/content.jsx @@ -52,7 +52,7 @@ export function LoggingConfiguration({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/logging-configuration", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/logging-configuration", "_blank", ); }} diff --git a/swan-lake/by-example/logging-with-context/content.jsx b/swan-lake/by-example/logging-with-context/content.jsx index 3c3d8de1540a..8d5f23a1d0a1 100644 --- a/swan-lake/by-example/logging-with-context/content.jsx +++ b/swan-lake/by-example/logging-with-context/content.jsx @@ -59,7 +59,7 @@ export function LoggingWithContext({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/logging-with-context", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/logging-with-context", "_blank", ); }} diff --git a/swan-lake/by-example/logging/content.jsx b/swan-lake/by-example/logging/content.jsx index 61f70604d9dc..eda20d46bfd0 100644 --- a/swan-lake/by-example/logging/content.jsx +++ b/swan-lake/by-example/logging/content.jsx @@ -61,7 +61,7 @@ export function Logging({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/logging", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/logging", "_blank", ); }} diff --git a/swan-lake/by-example/main-function/content.jsx b/swan-lake/by-example/main-function/content.jsx index dec9a3504e68..0789df0794fe 100644 --- a/swan-lake/by-example/main-function/content.jsx +++ b/swan-lake/by-example/main-function/content.jsx @@ -52,7 +52,7 @@ export function MainFunction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/main-function", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/main-function", "_blank", ); }} diff --git a/swan-lake/by-example/manage-scheduled-jobs/content.jsx b/swan-lake/by-example/manage-scheduled-jobs/content.jsx index 71af6e29b024..7a8e2ab1ce27 100644 --- a/swan-lake/by-example/manage-scheduled-jobs/content.jsx +++ b/swan-lake/by-example/manage-scheduled-jobs/content.jsx @@ -112,7 +112,7 @@ export function ManageScheduledJobs({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/manage-scheduled-jobs", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/manage-scheduled-jobs", "_blank", ); }} diff --git a/swan-lake/by-example/mapping-binding-pattern-in-match-statement/content.jsx b/swan-lake/by-example/mapping-binding-pattern-in-match-statement/content.jsx index 50316b302909..aaf0e8d0ec14 100644 --- a/swan-lake/by-example/mapping-binding-pattern-in-match-statement/content.jsx +++ b/swan-lake/by-example/mapping-binding-pattern-in-match-statement/content.jsx @@ -91,7 +91,7 @@ export function MappingBindingPatternInMatchStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mapping-binding-pattern-in-match-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mapping-binding-pattern-in-match-statement", "_blank", ); }} diff --git a/swan-lake/by-example/mapping-binding-pattern/content.jsx b/swan-lake/by-example/mapping-binding-pattern/content.jsx index 5b04f23a844e..2d49855192b6 100644 --- a/swan-lake/by-example/mapping-binding-pattern/content.jsx +++ b/swan-lake/by-example/mapping-binding-pattern/content.jsx @@ -79,7 +79,7 @@ export function MappingBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mapping-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mapping-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/maps/content.jsx b/swan-lake/by-example/maps/content.jsx index 6f067a2bd0f6..7ee724d78b6a 100644 --- a/swan-lake/by-example/maps/content.jsx +++ b/swan-lake/by-example/maps/content.jsx @@ -74,7 +74,7 @@ export function Maps({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/maps", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/maps", "_blank", ); }} diff --git a/swan-lake/by-example/match-guard-in-match-statement/content.jsx b/swan-lake/by-example/match-guard-in-match-statement/content.jsx index ae010f3748a8..1a7317ddb082 100644 --- a/swan-lake/by-example/match-guard-in-match-statement/content.jsx +++ b/swan-lake/by-example/match-guard-in-match-statement/content.jsx @@ -82,7 +82,7 @@ export function MatchGuardInMatchStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/match-guard-in-match-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/match-guard-in-match-statement", "_blank", ); }} diff --git a/swan-lake/by-example/match-statement-with-maps/content.jsx b/swan-lake/by-example/match-statement-with-maps/content.jsx index bb504dbab393..946c6d1750ba 100644 --- a/swan-lake/by-example/match-statement-with-maps/content.jsx +++ b/swan-lake/by-example/match-statement-with-maps/content.jsx @@ -61,7 +61,7 @@ export function MatchStatementWithMaps({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/match-statement-with-maps", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/match-statement-with-maps", "_blank", ); }} diff --git a/swan-lake/by-example/match-statement/content.jsx b/swan-lake/by-example/match-statement/content.jsx index aca9e352ec68..a2982396d153 100644 --- a/swan-lake/by-example/match-statement/content.jsx +++ b/swan-lake/by-example/match-statement/content.jsx @@ -81,7 +81,7 @@ export function MatchStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/match-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/match-statement", "_blank", ); }} diff --git a/swan-lake/by-example/module-lifecycle/content.jsx b/swan-lake/by-example/module-lifecycle/content.jsx index b11b50d73945..0faafad635d1 100644 --- a/swan-lake/by-example/module-lifecycle/content.jsx +++ b/swan-lake/by-example/module-lifecycle/content.jsx @@ -60,7 +60,7 @@ export function ModuleLifecycle({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/module-lifecycle", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/module-lifecycle", "_blank", ); }} diff --git a/swan-lake/by-example/mqtt-client-basic-authentication/content.jsx b/swan-lake/by-example/mqtt-client-basic-authentication/content.jsx index ea1239a168e8..e0ee9b3001e1 100644 --- a/swan-lake/by-example/mqtt-client-basic-authentication/content.jsx +++ b/swan-lake/by-example/mqtt-client-basic-authentication/content.jsx @@ -70,7 +70,7 @@ export function MqttClientBasicAuthentication({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mqtt-client-basic-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mqtt-client-basic-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/mqtt-client-publish-message/content.jsx b/swan-lake/by-example/mqtt-client-publish-message/content.jsx index 6489e3d8223d..c74a63432cd6 100644 --- a/swan-lake/by-example/mqtt-client-publish-message/content.jsx +++ b/swan-lake/by-example/mqtt-client-publish-message/content.jsx @@ -66,7 +66,7 @@ export function MqttClientPublishMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mqtt-client-publish-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mqtt-client-publish-message", "_blank", ); }} diff --git a/swan-lake/by-example/mqtt-client-ssl/content.jsx b/swan-lake/by-example/mqtt-client-ssl/content.jsx index b11dcb552f1d..4cb93d53c74a 100644 --- a/swan-lake/by-example/mqtt-client-ssl/content.jsx +++ b/swan-lake/by-example/mqtt-client-ssl/content.jsx @@ -82,7 +82,7 @@ export function MqttClientSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mqtt-client-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mqtt-client-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/mqtt-service-basic-authentication/content.jsx b/swan-lake/by-example/mqtt-service-basic-authentication/content.jsx index f73015e2212e..b787afa9b391 100644 --- a/swan-lake/by-example/mqtt-service-basic-authentication/content.jsx +++ b/swan-lake/by-example/mqtt-service-basic-authentication/content.jsx @@ -64,7 +64,7 @@ export function MqttServiceBasicAuthentication({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mqtt-service-basic-authentication", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mqtt-service-basic-authentication", "_blank", ); }} diff --git a/swan-lake/by-example/mqtt-service-ssl/content.jsx b/swan-lake/by-example/mqtt-service-ssl/content.jsx index 09f5acddd704..41b662c757a7 100644 --- a/swan-lake/by-example/mqtt-service-ssl/content.jsx +++ b/swan-lake/by-example/mqtt-service-ssl/content.jsx @@ -66,7 +66,7 @@ export function MqttServiceSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mqtt-service-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mqtt-service-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/mqtt-service-subscribe-message/content.jsx b/swan-lake/by-example/mqtt-service-subscribe-message/content.jsx index 099042f83f79..d92096777297 100644 --- a/swan-lake/by-example/mqtt-service-subscribe-message/content.jsx +++ b/swan-lake/by-example/mqtt-service-subscribe-message/content.jsx @@ -59,7 +59,7 @@ export function MqttServiceSubscribeMessage({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mqtt-service-subscribe-message", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mqtt-service-subscribe-message", "_blank", ); }} diff --git a/swan-lake/by-example/multiple-key-fields/content.jsx b/swan-lake/by-example/multiple-key-fields/content.jsx index 6555be381cb0..53b4b1709d35 100644 --- a/swan-lake/by-example/multiple-key-fields/content.jsx +++ b/swan-lake/by-example/multiple-key-fields/content.jsx @@ -65,7 +65,7 @@ export function MultipleKeyFields({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/multiple-key-fields", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/multiple-key-fields", "_blank", ); }} diff --git a/swan-lake/by-example/multiple-wait/content.jsx b/swan-lake/by-example/multiple-wait/content.jsx index 3b330097af38..0083aa106c0e 100644 --- a/swan-lake/by-example/multiple-wait/content.jsx +++ b/swan-lake/by-example/multiple-wait/content.jsx @@ -67,7 +67,7 @@ export function MultipleWait({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/multiple-wait", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/multiple-wait", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-atomic-transaction/content.jsx b/swan-lake/by-example/mysql-atomic-transaction/content.jsx index c2fd1bb22c59..21ff08ebcd9c 100644 --- a/swan-lake/by-example/mysql-atomic-transaction/content.jsx +++ b/swan-lake/by-example/mysql-atomic-transaction/content.jsx @@ -121,7 +121,7 @@ export function MysqlAtomicTransaction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-atomic-transaction", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-atomic-transaction", "_blank", ); }} @@ -352,7 +352,7 @@ export function MysqlAtomicTransaction({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-atomic-transaction", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-atomic-transaction", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-batch-execute-operation/content.jsx b/swan-lake/by-example/mysql-batch-execute-operation/content.jsx index aaeda6e693ab..e20f171351f4 100644 --- a/swan-lake/by-example/mysql-batch-execute-operation/content.jsx +++ b/swan-lake/by-example/mysql-batch-execute-operation/content.jsx @@ -94,7 +94,7 @@ export function MysqlBatchExecuteOperation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-batch-execute-operation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-batch-execute-operation", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-call-stored-procedures/content.jsx b/swan-lake/by-example/mysql-call-stored-procedures/content.jsx index d11f350f8795..e9799ae63acd 100644 --- a/swan-lake/by-example/mysql-call-stored-procedures/content.jsx +++ b/swan-lake/by-example/mysql-call-stored-procedures/content.jsx @@ -120,7 +120,7 @@ export function MysqlCallStoredProcedures({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-call-stored-procedures", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-call-stored-procedures", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-execute-operation/content.jsx b/swan-lake/by-example/mysql-execute-operation/content.jsx index 412705e9228a..677bf56b151b 100644 --- a/swan-lake/by-example/mysql-execute-operation/content.jsx +++ b/swan-lake/by-example/mysql-execute-operation/content.jsx @@ -88,7 +88,7 @@ export function MysqlExecuteOperation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-execute-operation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-execute-operation", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-query-column-mapping/content.jsx b/swan-lake/by-example/mysql-query-column-mapping/content.jsx index 6b283947ac4d..3a7417e1c358 100644 --- a/swan-lake/by-example/mysql-query-column-mapping/content.jsx +++ b/swan-lake/by-example/mysql-query-column-mapping/content.jsx @@ -94,7 +94,7 @@ export function MysqlQueryColumnMapping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-query-column-mapping", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-query-column-mapping", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-query-operation/content.jsx b/swan-lake/by-example/mysql-query-operation/content.jsx index 42f7dcad1ed2..2c5be02f8ef1 100644 --- a/swan-lake/by-example/mysql-query-operation/content.jsx +++ b/swan-lake/by-example/mysql-query-operation/content.jsx @@ -91,7 +91,7 @@ export function MysqlQueryOperation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-query-operation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-query-operation", "_blank", ); }} diff --git a/swan-lake/by-example/mysql-query-row-operation/content.jsx b/swan-lake/by-example/mysql-query-row-operation/content.jsx index 98cd92809f05..821a75c59c78 100644 --- a/swan-lake/by-example/mysql-query-row-operation/content.jsx +++ b/swan-lake/by-example/mysql-query-row-operation/content.jsx @@ -95,7 +95,7 @@ export function MysqlQueryRowOperation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/mysql-query-row-operation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/mysql-query-row-operation", "_blank", ); }} diff --git a/swan-lake/by-example/named-worker-return-values/content.jsx b/swan-lake/by-example/named-worker-return-values/content.jsx index 10a1a0e1cb9a..0d238c0cb3b1 100644 --- a/swan-lake/by-example/named-worker-return-values/content.jsx +++ b/swan-lake/by-example/named-worker-return-values/content.jsx @@ -70,7 +70,7 @@ export function NamedWorkerReturnValues({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/named-worker-return-values", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/named-worker-return-values", "_blank", ); }} diff --git a/swan-lake/by-example/named-worker-with-on-fail-clause/content.jsx b/swan-lake/by-example/named-worker-with-on-fail-clause/content.jsx new file mode 100644 index 000000000000..b73dcbdc039e --- /dev/null +++ b/swan-lake/by-example/named-worker-with-on-fail-clause/content.jsx @@ -0,0 +1,268 @@ +import React, { useState, createRef } from "react"; +import { Container, Row, Col } from "react-bootstrap"; +import DOMPurify from "dompurify"; +import { copyToClipboard, extractOutput } from "../../../utils/bbe"; +import Link from "next/link"; + +export const codeSnippetData = [ + `import ballerina/io; + +public function main() { + int[] values = [2, 3, 4, 5]; + int value = 0; + + worker w1 { + int index = check getIndex(values, value); + index -> function; + } on fail { + // Handle the error thrown in the worker body. + -1 -> function; + } + + int|error:NoMessage result = <- w1 | w1; + io:println(result); +} + +function getIndex(int[] values, int value) returns int|error => + let int? index = values.indexOf(value) in index ?: error("value not found"); +`, +]; + +export function NamedWorkerWithOnFailClause({ codeSnippets }) { + const [codeClick1, updateCodeClick1] = useState(false); + + const [outputClick1, updateOutputClick1] = useState(false); + const ref1 = createRef(); + + const [btnHover, updateBtnHover] = useState([false, false]); + + return ( + +

Named worker with on fail clause

+ +

+ The on fail clause can be used with a named worker, to + handle any errors that occur within the worker's body. +

+ + + + + {codeClick1 ? ( + + ) : ( + + )} + + + {codeSnippets[0] != undefined && ( +
+ )} + + + + + + {outputClick1 ? ( + + ) : ( + + )} + + +
+            
+              {`\$ bal run named_worker_with_on_fail_clause.bal`}
+              {`-1`}
+            
+          
+ +
+ + + + +
+ updateBtnHover([true, false])} + onMouseOut={() => updateBtnHover([false, false])} + > + + +
+ Previous + updateBtnHover([true, false])} + onMouseOut={() => updateBtnHover([false, false])} + > + Inter-worker failure propagation + +
+
+ + + + +
+
+ Next + updateBtnHover([false, true])} + onMouseOut={() => updateBtnHover([false, false])} + > + Synchronize message passing + +
+ updateBtnHover([false, true])} + onMouseOut={() => updateBtnHover([false, false])} + > + + +
+ + +
+ + ); +} diff --git a/swan-lake/by-example/named-worker-with-on-fail-clause/liquid.json b/swan-lake/by-example/named-worker-with-on-fail-clause/liquid.json new file mode 100644 index 000000000000..7fc916f053f2 --- /dev/null +++ b/swan-lake/by-example/named-worker-with-on-fail-clause/liquid.json @@ -0,0 +1,18 @@ +{ + "title": "Named worker with on fail clause", + "description": "This BBE demonstrates the use of `on fail` clause with named workers", + "keywords": [ + "ballerina", + "ballerina by example", + "bbe", + "worker", + "named workers", + "on fail" + ], + "permalink": "/learn/by-example/named-worker-with-on-fail-clause", + "active": "named-worker-with-on-fail-clause", + "redirect_from": [ + "/swan-lake/learn/by-example/named-worker-with-on-fail-clause", + "/swan-lake/learn/by-example/named-worker-with-on-fail-clause.html" + ] +} diff --git a/swan-lake/by-example/named-workers-and-futures/content.jsx b/swan-lake/by-example/named-workers-and-futures/content.jsx index f0b5fb836834..dcfde5824ed5 100644 --- a/swan-lake/by-example/named-workers-and-futures/content.jsx +++ b/swan-lake/by-example/named-workers-and-futures/content.jsx @@ -66,7 +66,7 @@ export function NamedWorkersAndFutures({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/named-workers-and-futures", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/named-workers-and-futures", "_blank", ); }} diff --git a/swan-lake/by-example/named-workers/content.jsx b/swan-lake/by-example/named-workers/content.jsx index f24eb18d881c..33e043e8e006 100644 --- a/swan-lake/by-example/named-workers/content.jsx +++ b/swan-lake/by-example/named-workers/content.jsx @@ -64,7 +64,7 @@ export function NamedWorkers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/named-workers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/named-workers", "_blank", ); }} diff --git a/swan-lake/by-example/nats-basic-pub/content.jsx b/swan-lake/by-example/nats-basic-pub/content.jsx index e2994210a888..dfc19ce51d81 100644 --- a/swan-lake/by-example/nats-basic-pub/content.jsx +++ b/swan-lake/by-example/nats-basic-pub/content.jsx @@ -69,7 +69,7 @@ export function NatsBasicPub({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-basic-pub", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-basic-pub", "_blank", ); }} diff --git a/swan-lake/by-example/nats-basic-reply/content.jsx b/swan-lake/by-example/nats-basic-reply/content.jsx index afb157d6828e..d0aaa863356c 100644 --- a/swan-lake/by-example/nats-basic-reply/content.jsx +++ b/swan-lake/by-example/nats-basic-reply/content.jsx @@ -64,7 +64,7 @@ export function NatsBasicReply({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-basic-reply", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-basic-reply", "_blank", ); }} diff --git a/swan-lake/by-example/nats-basic-request/content.jsx b/swan-lake/by-example/nats-basic-request/content.jsx index 74cacb73886f..e6ff40c84966 100644 --- a/swan-lake/by-example/nats-basic-request/content.jsx +++ b/swan-lake/by-example/nats-basic-request/content.jsx @@ -80,7 +80,7 @@ export function NatsBasicRequest({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-basic-request", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-basic-request", "_blank", ); }} diff --git a/swan-lake/by-example/nats-basic-sub/content.jsx b/swan-lake/by-example/nats-basic-sub/content.jsx index 9541cbfd7aaa..ec6a4a37aac3 100644 --- a/swan-lake/by-example/nats-basic-sub/content.jsx +++ b/swan-lake/by-example/nats-basic-sub/content.jsx @@ -62,7 +62,7 @@ export function NatsBasicSub({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-basic-sub", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-basic-sub", "_blank", ); }} diff --git a/swan-lake/by-example/nats-client-basic-auth/content.jsx b/swan-lake/by-example/nats-client-basic-auth/content.jsx index 897bf49886e9..4b4d5d41d44b 100644 --- a/swan-lake/by-example/nats-client-basic-auth/content.jsx +++ b/swan-lake/by-example/nats-client-basic-auth/content.jsx @@ -77,7 +77,7 @@ export function NatsClientBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-client-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-client-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/nats-client-secure-connection/content.jsx b/swan-lake/by-example/nats-client-secure-connection/content.jsx index 0d419ee4d78c..c1dde25def17 100644 --- a/swan-lake/by-example/nats-client-secure-connection/content.jsx +++ b/swan-lake/by-example/nats-client-secure-connection/content.jsx @@ -75,7 +75,7 @@ export function NatsClientSecureConnection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-client-secure-connection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-client-secure-connection", "_blank", ); }} diff --git a/swan-lake/by-example/nats-jetstream-pub/content.jsx b/swan-lake/by-example/nats-jetstream-pub/content.jsx index f876674cb7b2..6a6475da6ca8 100644 --- a/swan-lake/by-example/nats-jetstream-pub/content.jsx +++ b/swan-lake/by-example/nats-jetstream-pub/content.jsx @@ -84,7 +84,7 @@ export function NatsJetstreamPub({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-jetstream-pub", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-jetstream-pub", "_blank", ); }} diff --git a/swan-lake/by-example/nats-jetstream-sub/content.jsx b/swan-lake/by-example/nats-jetstream-sub/content.jsx index 328b815cd0ed..188aa0fee0ba 100644 --- a/swan-lake/by-example/nats-jetstream-sub/content.jsx +++ b/swan-lake/by-example/nats-jetstream-sub/content.jsx @@ -77,7 +77,7 @@ export function NatsJetstreamSub({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-jetstream-sub", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-jetstream-sub", "_blank", ); }} diff --git a/swan-lake/by-example/nats-service-basic-auth/content.jsx b/swan-lake/by-example/nats-service-basic-auth/content.jsx index ed381ca33014..af43d378e381 100644 --- a/swan-lake/by-example/nats-service-basic-auth/content.jsx +++ b/swan-lake/by-example/nats-service-basic-auth/content.jsx @@ -69,7 +69,7 @@ export function NatsServiceBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-service-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-service-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/nats-service-constraint-validation/content.jsx b/swan-lake/by-example/nats-service-constraint-validation/content.jsx index 3daafab337e4..8644748605ca 100644 --- a/swan-lake/by-example/nats-service-constraint-validation/content.jsx +++ b/swan-lake/by-example/nats-service-constraint-validation/content.jsx @@ -73,7 +73,7 @@ export function NatsServiceConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-service-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-service-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/nats-service-secure-connection/content.jsx b/swan-lake/by-example/nats-service-secure-connection/content.jsx index 9678fa099731..74fc025887ef 100644 --- a/swan-lake/by-example/nats-service-secure-connection/content.jsx +++ b/swan-lake/by-example/nats-service-secure-connection/content.jsx @@ -66,7 +66,7 @@ export function NatsServiceSecureConnection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nats-service-secure-connection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nats-service-secure-connection", "_blank", ); }} diff --git a/swan-lake/by-example/nested-arrays/content.jsx b/swan-lake/by-example/nested-arrays/content.jsx index d594d020f1a2..2b27a1eceb94 100644 --- a/swan-lake/by-example/nested-arrays/content.jsx +++ b/swan-lake/by-example/nested-arrays/content.jsx @@ -66,7 +66,7 @@ export function NestedArrays({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nested-arrays", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nested-arrays", "_blank", ); }} diff --git a/swan-lake/by-example/nested-query-expressions/content.jsx b/swan-lake/by-example/nested-query-expressions/content.jsx index ef8b4b53576b..85f65d4388ae 100644 --- a/swan-lake/by-example/nested-query-expressions/content.jsx +++ b/swan-lake/by-example/nested-query-expressions/content.jsx @@ -54,7 +54,7 @@ export function NestedQueryExpressions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nested-query-expressions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nested-query-expressions", "_blank", ); }} diff --git a/swan-lake/by-example/never-type/content.jsx b/swan-lake/by-example/never-type/content.jsx index 7f615071cb72..cacd5cc87a51 100644 --- a/swan-lake/by-example/never-type/content.jsx +++ b/swan-lake/by-example/never-type/content.jsx @@ -75,7 +75,7 @@ export function NeverType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/never-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/never-type", "_blank", ); }} diff --git a/swan-lake/by-example/nil/content.jsx b/swan-lake/by-example/nil/content.jsx index d38076cc9e96..184b1a2b5ea0 100644 --- a/swan-lake/by-example/nil/content.jsx +++ b/swan-lake/by-example/nil/content.jsx @@ -58,7 +58,7 @@ export function Nil({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/nil", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/nil", "_blank", ); }} diff --git a/swan-lake/by-example/object-closure/content.jsx b/swan-lake/by-example/object-closure/content.jsx index 914c4fc14c9d..f1837ad9d4de 100644 --- a/swan-lake/by-example/object-closure/content.jsx +++ b/swan-lake/by-example/object-closure/content.jsx @@ -55,7 +55,7 @@ export function ObjectClosure({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/object-closure", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/object-closure", "_blank", ); }} diff --git a/swan-lake/by-example/object-constructor/content.jsx b/swan-lake/by-example/object-constructor/content.jsx index e58044fc8c4a..84d177d20c00 100644 --- a/swan-lake/by-example/object-constructor/content.jsx +++ b/swan-lake/by-example/object-constructor/content.jsx @@ -62,7 +62,7 @@ export function ObjectConstructor({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/object-constructor", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/object-constructor", "_blank", ); }} diff --git a/swan-lake/by-example/object-type-inclusion/content.jsx b/swan-lake/by-example/object-type-inclusion/content.jsx index b8bb604379ad..fb1836e8e62c 100644 --- a/swan-lake/by-example/object-type-inclusion/content.jsx +++ b/swan-lake/by-example/object-type-inclusion/content.jsx @@ -91,7 +91,7 @@ export function ObjectTypeInclusion({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/object-type-inclusion", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/object-type-inclusion", "_blank", ); }} diff --git a/swan-lake/by-example/object-types/content.jsx b/swan-lake/by-example/object-types/content.jsx index 982020374b57..dfccd9c70083 100644 --- a/swan-lake/by-example/object-types/content.jsx +++ b/swan-lake/by-example/object-types/content.jsx @@ -64,7 +64,7 @@ export function ObjectTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/object-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/object-types", "_blank", ); }} diff --git a/swan-lake/by-example/object-value-from-class-definition/content.jsx b/swan-lake/by-example/object-value-from-class-definition/content.jsx index 5358510e5912..660ae526b7f1 100644 --- a/swan-lake/by-example/object-value-from-class-definition/content.jsx +++ b/swan-lake/by-example/object-value-from-class-definition/content.jsx @@ -82,7 +82,7 @@ export function ObjectValueFromClassDefinition({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/object-value-from-class-definition", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/object-value-from-class-definition", "_blank", ); }} diff --git a/swan-lake/by-example/object/content.jsx b/swan-lake/by-example/object/content.jsx index 150d60f3ab7e..6ac562a1861e 100644 --- a/swan-lake/by-example/object/content.jsx +++ b/swan-lake/by-example/object/content.jsx @@ -69,7 +69,7 @@ export function Object({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/object", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/object", "_blank", ); }} diff --git a/swan-lake/by-example/on-conflict-clause/content.jsx b/swan-lake/by-example/on-conflict-clause/content.jsx index e6b1f29253b6..429a74b71085 100644 --- a/swan-lake/by-example/on-conflict-clause/content.jsx +++ b/swan-lake/by-example/on-conflict-clause/content.jsx @@ -85,7 +85,7 @@ export function OnConflictClause({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/on-conflict-clause", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/on-conflict-clause", "_blank", ); }} diff --git a/swan-lake/by-example/open-records/content.jsx b/swan-lake/by-example/open-records/content.jsx index 7427898f05ad..45348e4b47bc 100644 --- a/swan-lake/by-example/open-records/content.jsx +++ b/swan-lake/by-example/open-records/content.jsx @@ -96,7 +96,7 @@ export function OpenRecords({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/open-records", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/open-records", "_blank", ); }} diff --git a/swan-lake/by-example/optional-fields/content.jsx b/swan-lake/by-example/optional-fields/content.jsx index 7648e09cbb11..952331bfa000 100644 --- a/swan-lake/by-example/optional-fields/content.jsx +++ b/swan-lake/by-example/optional-fields/content.jsx @@ -81,7 +81,7 @@ export function OptionalFields({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/optional-fields", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/optional-fields", "_blank", ); }} diff --git a/swan-lake/by-example/outer-join-clause/content.jsx b/swan-lake/by-example/outer-join-clause/content.jsx index 9d721e676a27..33277422bc8c 100644 --- a/swan-lake/by-example/outer-join-clause/content.jsx +++ b/swan-lake/by-example/outer-join-clause/content.jsx @@ -81,7 +81,7 @@ export function OuterJoinClause({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/outer-join-clause", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/outer-join-clause", "_blank", ); }} diff --git a/swan-lake/by-example/panics/content.jsx b/swan-lake/by-example/panics/content.jsx index 28c93d13fb2a..d07fae6e94fd 100644 --- a/swan-lake/by-example/panics/content.jsx +++ b/swan-lake/by-example/panics/content.jsx @@ -71,7 +71,7 @@ export function Panics({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/panics", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/panics", "_blank", ); }} diff --git a/swan-lake/by-example/persist-create/content.jsx b/swan-lake/by-example/persist-create/content.jsx index de15aaf6d536..dc8ab6670fc1 100644 --- a/swan-lake/by-example/persist-create/content.jsx +++ b/swan-lake/by-example/persist-create/content.jsx @@ -201,7 +201,7 @@ export function PersistCreate({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-create", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-create", "_blank", ); }} @@ -359,7 +359,7 @@ export function PersistCreate({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-create", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-create", "_blank", ); }} diff --git a/swan-lake/by-example/persist-delete/content.jsx b/swan-lake/by-example/persist-delete/content.jsx index 1f8691b2ac95..49a55adaa214 100644 --- a/swan-lake/by-example/persist-delete/content.jsx +++ b/swan-lake/by-example/persist-delete/content.jsx @@ -170,7 +170,7 @@ export function PersistDelete({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-delete", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-delete", "_blank", ); }} @@ -328,7 +328,7 @@ export function PersistDelete({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-delete", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-delete", "_blank", ); }} diff --git a/swan-lake/by-example/persist-filtering/content.jsx b/swan-lake/by-example/persist-filtering/content.jsx index 22e3d66c389b..d56ffa992042 100644 --- a/swan-lake/by-example/persist-filtering/content.jsx +++ b/swan-lake/by-example/persist-filtering/content.jsx @@ -205,7 +205,7 @@ export function PersistFiltering({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-filtering", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-filtering", "_blank", ); }} @@ -364,7 +364,7 @@ export function PersistFiltering({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-filtering", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-filtering", "_blank", ); }} diff --git a/swan-lake/by-example/persist-get-all/content.jsx b/swan-lake/by-example/persist-get-all/content.jsx index 56c17a709822..feb3d78d0e6b 100644 --- a/swan-lake/by-example/persist-get-all/content.jsx +++ b/swan-lake/by-example/persist-get-all/content.jsx @@ -167,7 +167,7 @@ export function PersistGetAll({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-get-all", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-get-all", "_blank", ); }} @@ -326,7 +326,7 @@ export function PersistGetAll({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-get-all", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-get-all", "_blank", ); }} diff --git a/swan-lake/by-example/persist-get-by-key/content.jsx b/swan-lake/by-example/persist-get-by-key/content.jsx index fba99635ee1c..d7405b13995e 100644 --- a/swan-lake/by-example/persist-get-by-key/content.jsx +++ b/swan-lake/by-example/persist-get-by-key/content.jsx @@ -169,7 +169,7 @@ export function PersistGetByKey({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-get-by-key", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-get-by-key", "_blank", ); }} @@ -328,7 +328,7 @@ export function PersistGetByKey({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-get-by-key", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-get-by-key", "_blank", ); }} diff --git a/swan-lake/by-example/persist-relation-queries/content.jsx b/swan-lake/by-example/persist-relation-queries/content.jsx index c9dc62bf91af..e5f857248825 100644 --- a/swan-lake/by-example/persist-relation-queries/content.jsx +++ b/swan-lake/by-example/persist-relation-queries/content.jsx @@ -235,7 +235,7 @@ export function PersistRelationQueries({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-relation-queries", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-relation-queries", "_blank", ); }} @@ -394,7 +394,7 @@ export function PersistRelationQueries({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-relation-queries", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-relation-queries", "_blank", ); }} diff --git a/swan-lake/by-example/persist-select-fields/content.jsx b/swan-lake/by-example/persist-select-fields/content.jsx index ff806b28a8f7..b1bcac99067d 100644 --- a/swan-lake/by-example/persist-select-fields/content.jsx +++ b/swan-lake/by-example/persist-select-fields/content.jsx @@ -184,7 +184,7 @@ export function PersistSelectFields({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-select-fields", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-select-fields", "_blank", ); }} @@ -343,7 +343,7 @@ export function PersistSelectFields({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-select-fields", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-select-fields", "_blank", ); }} diff --git a/swan-lake/by-example/persist-update/content.jsx b/swan-lake/by-example/persist-update/content.jsx index 25429da1dfbe..de489f9dd849 100644 --- a/swan-lake/by-example/persist-update/content.jsx +++ b/swan-lake/by-example/persist-update/content.jsx @@ -176,7 +176,7 @@ export function PersistUpdate({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-update", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-update", "_blank", ); }} @@ -334,7 +334,7 @@ export function PersistUpdate({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/persist-update", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/persist-update", "_blank", ); }} diff --git a/swan-lake/by-example/programs-and-modules/content.jsx b/swan-lake/by-example/programs-and-modules/content.jsx index be29a2c249c9..0f3864c36fa6 100644 --- a/swan-lake/by-example/programs-and-modules/content.jsx +++ b/swan-lake/by-example/programs-and-modules/content.jsx @@ -48,7 +48,7 @@ export function ProgramsAndModules({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/programs-and-modules", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/programs-and-modules", "_blank", ); }} diff --git a/swan-lake/by-example/provide-function-arguments-by-name/content.jsx b/swan-lake/by-example/provide-function-arguments-by-name/content.jsx index 6dbb50ef1ca5..0216accdc82e 100644 --- a/swan-lake/by-example/provide-function-arguments-by-name/content.jsx +++ b/swan-lake/by-example/provide-function-arguments-by-name/content.jsx @@ -54,7 +54,7 @@ export function ProvideFunctionArgumentsByName({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/provide-function-arguments-by-name", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/provide-function-arguments-by-name", "_blank", ); }} diff --git a/swan-lake/by-example/providing-services/content.jsx b/swan-lake/by-example/providing-services/content.jsx index dabd55480a41..81f95d630b41 100644 --- a/swan-lake/by-example/providing-services/content.jsx +++ b/swan-lake/by-example/providing-services/content.jsx @@ -73,7 +73,7 @@ export function ProvidingServices({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/providing-services", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/providing-services", "_blank", ); }} diff --git a/swan-lake/by-example/query-actions/content.jsx b/swan-lake/by-example/query-actions/content.jsx index 0fd1731334bf..825114dd1c1b 100644 --- a/swan-lake/by-example/query-actions/content.jsx +++ b/swan-lake/by-example/query-actions/content.jsx @@ -69,7 +69,7 @@ export function QueryActions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/query-actions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/query-actions", "_blank", ); }} diff --git a/swan-lake/by-example/query-expressions/content.jsx b/swan-lake/by-example/query-expressions/content.jsx index 4358b4c6d9dd..784b457a5c64 100644 --- a/swan-lake/by-example/query-expressions/content.jsx +++ b/swan-lake/by-example/query-expressions/content.jsx @@ -74,7 +74,7 @@ export function QueryExpressions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/query-expressions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/query-expressions", "_blank", ); }} diff --git a/swan-lake/by-example/querying-tables/content.jsx b/swan-lake/by-example/querying-tables/content.jsx index a2795ca52764..e17fcb7b4567 100644 --- a/swan-lake/by-example/querying-tables/content.jsx +++ b/swan-lake/by-example/querying-tables/content.jsx @@ -70,7 +70,7 @@ export function QueryingTables({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/querying-tables", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/querying-tables", "_blank", ); }} diff --git a/swan-lake/by-example/querying-with-streams/content.jsx b/swan-lake/by-example/querying-with-streams/content.jsx index 1c24fcdea381..89ad4857af1c 100644 --- a/swan-lake/by-example/querying-with-streams/content.jsx +++ b/swan-lake/by-example/querying-with-streams/content.jsx @@ -65,7 +65,7 @@ export function QueryingWithStreams({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/querying-with-streams", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/querying-with-streams", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-client-basic-auth/content.jsx b/swan-lake/by-example/rabbitmq-client-basic-auth/content.jsx index 9f8027fe0ec5..92b00e5b623f 100644 --- a/swan-lake/by-example/rabbitmq-client-basic-auth/content.jsx +++ b/swan-lake/by-example/rabbitmq-client-basic-auth/content.jsx @@ -80,7 +80,7 @@ export function RabbitmqClientBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-client-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-client-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-client-constraint-validation/content.jsx b/swan-lake/by-example/rabbitmq-client-constraint-validation/content.jsx index 53bf327ebe3d..af314278fe0c 100644 --- a/swan-lake/by-example/rabbitmq-client-constraint-validation/content.jsx +++ b/swan-lake/by-example/rabbitmq-client-constraint-validation/content.jsx @@ -72,7 +72,7 @@ export function RabbitmqClientConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-client-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-client-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-client-secure-connection/content.jsx b/swan-lake/by-example/rabbitmq-client-secure-connection/content.jsx index 9ca5fee384eb..ad1f58a6d9a8 100644 --- a/swan-lake/by-example/rabbitmq-client-secure-connection/content.jsx +++ b/swan-lake/by-example/rabbitmq-client-secure-connection/content.jsx @@ -75,7 +75,7 @@ export function RabbitmqClientSecureConnection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-client-secure-connection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-client-secure-connection", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-consumer-with-client-acknowledgement/content.jsx b/swan-lake/by-example/rabbitmq-consumer-with-client-acknowledgement/content.jsx index fb7b609f9e3d..5dbe11a9f3e6 100644 --- a/swan-lake/by-example/rabbitmq-consumer-with-client-acknowledgement/content.jsx +++ b/swan-lake/by-example/rabbitmq-consumer-with-client-acknowledgement/content.jsx @@ -68,7 +68,7 @@ export function RabbitmqConsumerWithClientAcknowledgement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-consumer-with-client-acknowledgement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-consumer-with-client-acknowledgement", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-consumer/content.jsx b/swan-lake/by-example/rabbitmq-consumer/content.jsx index 672fb19f28f2..4c7e94e63a8f 100644 --- a/swan-lake/by-example/rabbitmq-consumer/content.jsx +++ b/swan-lake/by-example/rabbitmq-consumer/content.jsx @@ -62,7 +62,7 @@ export function RabbitmqConsumer({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-consumer", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-consumer", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-producer/content.jsx b/swan-lake/by-example/rabbitmq-producer/content.jsx index e1cc57b325ba..596884dc8c60 100644 --- a/swan-lake/by-example/rabbitmq-producer/content.jsx +++ b/swan-lake/by-example/rabbitmq-producer/content.jsx @@ -72,7 +72,7 @@ export function RabbitmqProducer({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-producer", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-producer", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-queue-declare/content.jsx b/swan-lake/by-example/rabbitmq-queue-declare/content.jsx index b52bc09596e3..7b1fa6c15c18 100644 --- a/swan-lake/by-example/rabbitmq-queue-declare/content.jsx +++ b/swan-lake/by-example/rabbitmq-queue-declare/content.jsx @@ -50,7 +50,7 @@ export function RabbitmqQueueDeclare({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-queue-declare", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-queue-declare", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-service-basic-auth/content.jsx b/swan-lake/by-example/rabbitmq-service-basic-auth/content.jsx index 5615e3a6eb9f..29c9ff007eb7 100644 --- a/swan-lake/by-example/rabbitmq-service-basic-auth/content.jsx +++ b/swan-lake/by-example/rabbitmq-service-basic-auth/content.jsx @@ -70,7 +70,7 @@ export function RabbitmqServiceBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-service-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-service-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-service-constraint-validation/content.jsx b/swan-lake/by-example/rabbitmq-service-constraint-validation/content.jsx index a657ce2b0661..71e952bf31bd 100644 --- a/swan-lake/by-example/rabbitmq-service-constraint-validation/content.jsx +++ b/swan-lake/by-example/rabbitmq-service-constraint-validation/content.jsx @@ -73,7 +73,7 @@ export function RabbitmqServiceConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-service-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-service-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-service-secure-connection/content.jsx b/swan-lake/by-example/rabbitmq-service-secure-connection/content.jsx index 607573791b1e..70781e481682 100644 --- a/swan-lake/by-example/rabbitmq-service-secure-connection/content.jsx +++ b/swan-lake/by-example/rabbitmq-service-secure-connection/content.jsx @@ -65,7 +65,7 @@ export function RabbitmqServiceSecureConnection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-service-secure-connection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-service-secure-connection", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-sync-consumer/content.jsx b/swan-lake/by-example/rabbitmq-sync-consumer/content.jsx index da5609f226c7..6776701aebc7 100644 --- a/swan-lake/by-example/rabbitmq-sync-consumer/content.jsx +++ b/swan-lake/by-example/rabbitmq-sync-consumer/content.jsx @@ -61,7 +61,7 @@ export function RabbitmqSyncConsumer({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-sync-consumer", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-sync-consumer", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-transaction-consumer/content.jsx b/swan-lake/by-example/rabbitmq-transaction-consumer/content.jsx index 6126b67df760..8941b1256961 100644 --- a/swan-lake/by-example/rabbitmq-transaction-consumer/content.jsx +++ b/swan-lake/by-example/rabbitmq-transaction-consumer/content.jsx @@ -70,7 +70,7 @@ export function RabbitmqTransactionConsumer({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-transaction-consumer", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-transaction-consumer", "_blank", ); }} diff --git a/swan-lake/by-example/rabbitmq-transaction-producer/content.jsx b/swan-lake/by-example/rabbitmq-transaction-producer/content.jsx index d9dfca312988..b641665c008c 100644 --- a/swan-lake/by-example/rabbitmq-transaction-producer/content.jsx +++ b/swan-lake/by-example/rabbitmq-transaction-producer/content.jsx @@ -72,7 +72,7 @@ export function RabbitmqTransactionProducer({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rabbitmq-transaction-producer", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rabbitmq-transaction-producer", "_blank", ); }} diff --git a/swan-lake/by-example/random-numbers/content.jsx b/swan-lake/by-example/random-numbers/content.jsx index 43670af93eb1..1a8e44359a0a 100644 --- a/swan-lake/by-example/random-numbers/content.jsx +++ b/swan-lake/by-example/random-numbers/content.jsx @@ -55,7 +55,7 @@ export function RandomNumbers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/random-numbers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/random-numbers", "_blank", ); }} diff --git a/swan-lake/by-example/raw-templates/content.jsx b/swan-lake/by-example/raw-templates/content.jsx index 078dfa718695..b63420dd1ffd 100644 --- a/swan-lake/by-example/raw-templates/content.jsx +++ b/swan-lake/by-example/raw-templates/content.jsx @@ -116,7 +116,7 @@ export function RawTemplates({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/raw-templates", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/raw-templates", "_blank", ); }} @@ -205,7 +205,7 @@ export function RawTemplates({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/raw-templates", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/raw-templates", "_blank", ); }} diff --git a/swan-lake/by-example/readonly-and-isolated/content.jsx b/swan-lake/by-example/readonly-and-isolated/content.jsx index f7f26f4665e7..82e26cc4a048 100644 --- a/swan-lake/by-example/readonly-and-isolated/content.jsx +++ b/swan-lake/by-example/readonly-and-isolated/content.jsx @@ -66,7 +66,7 @@ export function ReadonlyAndIsolated({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/readonly-and-isolated", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/readonly-and-isolated", "_blank", ); }} diff --git a/swan-lake/by-example/readonly-objects-and-classes/content.jsx b/swan-lake/by-example/readonly-objects-and-classes/content.jsx index 85abd8d493cf..623e1f03d241 100644 --- a/swan-lake/by-example/readonly-objects-and-classes/content.jsx +++ b/swan-lake/by-example/readonly-objects-and-classes/content.jsx @@ -73,7 +73,7 @@ export function ReadonlyObjectsAndClasses({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/readonly-objects-and-classes", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/readonly-objects-and-classes", "_blank", ); }} diff --git a/swan-lake/by-example/readonly-type/content.jsx b/swan-lake/by-example/readonly-type/content.jsx index 64d78500ebb9..aeae325a1534 100644 --- a/swan-lake/by-example/readonly-type/content.jsx +++ b/swan-lake/by-example/readonly-type/content.jsx @@ -63,7 +63,7 @@ export function ReadonlyType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/readonly-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/readonly-type", "_blank", ); }} diff --git a/swan-lake/by-example/receive-email-using-client/content.jsx b/swan-lake/by-example/receive-email-using-client/content.jsx index b9cad8efb05e..1c4e86ea30a8 100644 --- a/swan-lake/by-example/receive-email-using-client/content.jsx +++ b/swan-lake/by-example/receive-email-using-client/content.jsx @@ -69,7 +69,7 @@ export function ReceiveEmailUsingClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/receive-email-using-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/receive-email-using-client", "_blank", ); }} diff --git a/swan-lake/by-example/receive-email-using-service/content.jsx b/swan-lake/by-example/receive-email-using-service/content.jsx index 2c6455012a24..9b18685d8311 100644 --- a/swan-lake/by-example/receive-email-using-service/content.jsx +++ b/swan-lake/by-example/receive-email-using-service/content.jsx @@ -83,7 +83,7 @@ export function ReceiveEmailUsingService({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/receive-email-using-service", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/receive-email-using-service", "_blank", ); }} diff --git a/swan-lake/by-example/record-to-edi/content.jsx b/swan-lake/by-example/record-to-edi/content.jsx index 602cb3c2c451..ee0b33d79450 100644 --- a/swan-lake/by-example/record-to-edi/content.jsx +++ b/swan-lake/by-example/record-to-edi/content.jsx @@ -79,7 +79,7 @@ export function RecordToEdi({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/record-to-edi", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/record-to-edi", "_blank", ); }} @@ -169,7 +169,7 @@ export function RecordToEdi({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/record-to-edi", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/record-to-edi", "_blank", ); }} @@ -469,7 +469,7 @@ export function RecordToEdi({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/record-to-edi", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/record-to-edi", "_blank", ); }} diff --git a/swan-lake/by-example/records/content.jsx b/swan-lake/by-example/records/content.jsx index 83d5e3123b3e..d45962ed9332 100644 --- a/swan-lake/by-example/records/content.jsx +++ b/swan-lake/by-example/records/content.jsx @@ -91,7 +91,7 @@ export function Records({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/records", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/records", "_blank", ); }} diff --git a/swan-lake/by-example/regexp-operations/content.jsx b/swan-lake/by-example/regexp-operations/content.jsx index f44b65baea7f..6e9e982e4596 100644 --- a/swan-lake/by-example/regexp-operations/content.jsx +++ b/swan-lake/by-example/regexp-operations/content.jsx @@ -68,7 +68,7 @@ export function RegexpOperations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/regexp-operations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/regexp-operations", "_blank", ); }} diff --git a/swan-lake/by-example/regexp-type/content.jsx b/swan-lake/by-example/regexp-type/content.jsx index 5ab0f156c18c..854242d89e6f 100644 --- a/swan-lake/by-example/regexp-type/content.jsx +++ b/swan-lake/by-example/regexp-type/content.jsx @@ -96,7 +96,7 @@ export function RegexpType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/regexp-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/regexp-type", "_blank", ); }} diff --git a/swan-lake/by-example/resource-method-typing/content.jsx b/swan-lake/by-example/resource-method-typing/content.jsx index 75d0ae8db93b..3d45363b97fb 100644 --- a/swan-lake/by-example/resource-method-typing/content.jsx +++ b/swan-lake/by-example/resource-method-typing/content.jsx @@ -67,7 +67,7 @@ export function ResourceMethodTyping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/resource-method-typing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/resource-method-typing", "_blank", ); }} diff --git a/swan-lake/by-example/resource-methods/content.jsx b/swan-lake/by-example/resource-methods/content.jsx index b9ea4665b63c..43bb7a037fe3 100644 --- a/swan-lake/by-example/resource-methods/content.jsx +++ b/swan-lake/by-example/resource-methods/content.jsx @@ -68,7 +68,7 @@ export function ResourceMethods({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/resource-methods", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/resource-methods", "_blank", ); }} diff --git a/swan-lake/by-example/resource-path-parameters/content.jsx b/swan-lake/by-example/resource-path-parameters/content.jsx index a1bfe00484d6..aa09a7165868 100644 --- a/swan-lake/by-example/resource-path-parameters/content.jsx +++ b/swan-lake/by-example/resource-path-parameters/content.jsx @@ -42,7 +42,7 @@ export function ResourcePathParameters({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/resource-path-parameters", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/resource-path-parameters", "_blank", ); }} diff --git a/swan-lake/by-example/rest-binding-pattern-in-error-binding-pattern/content.jsx b/swan-lake/by-example/rest-binding-pattern-in-error-binding-pattern/content.jsx index 40abf8079d2a..8d542d59d4ca 100644 --- a/swan-lake/by-example/rest-binding-pattern-in-error-binding-pattern/content.jsx +++ b/swan-lake/by-example/rest-binding-pattern-in-error-binding-pattern/content.jsx @@ -73,7 +73,7 @@ export function RestBindingPatternInErrorBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rest-binding-pattern-in-error-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rest-binding-pattern-in-error-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/rest-binding-pattern-in-list-binding-pattern/content.jsx b/swan-lake/by-example/rest-binding-pattern-in-list-binding-pattern/content.jsx index e378bb9986bf..c3689f05d8fa 100644 --- a/swan-lake/by-example/rest-binding-pattern-in-list-binding-pattern/content.jsx +++ b/swan-lake/by-example/rest-binding-pattern-in-list-binding-pattern/content.jsx @@ -54,7 +54,7 @@ export function RestBindingPatternInListBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rest-binding-pattern-in-list-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rest-binding-pattern-in-list-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/rest-binding-pattern-in-mapping-binding-pattern/content.jsx b/swan-lake/by-example/rest-binding-pattern-in-mapping-binding-pattern/content.jsx index 541a557efd52..c3726f25f93e 100644 --- a/swan-lake/by-example/rest-binding-pattern-in-mapping-binding-pattern/content.jsx +++ b/swan-lake/by-example/rest-binding-pattern-in-mapping-binding-pattern/content.jsx @@ -72,7 +72,7 @@ export function RestBindingPatternInMappingBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rest-binding-pattern-in-mapping-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rest-binding-pattern-in-mapping-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/rest-parameters/content.jsx b/swan-lake/by-example/rest-parameters/content.jsx index 2e0187c6772a..817817a32cef 100644 --- a/swan-lake/by-example/rest-parameters/content.jsx +++ b/swan-lake/by-example/rest-parameters/content.jsx @@ -60,7 +60,7 @@ export function RestParameters({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rest-parameters", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rest-parameters", "_blank", ); }} diff --git a/swan-lake/by-example/rest-type-in-tuples/content.jsx b/swan-lake/by-example/rest-type-in-tuples/content.jsx index 350637b585b2..0d996f4add8f 100644 --- a/swan-lake/by-example/rest-type-in-tuples/content.jsx +++ b/swan-lake/by-example/rest-type-in-tuples/content.jsx @@ -60,7 +60,7 @@ export function RestTypeInTuples({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rest-type-in-tuples", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rest-type-in-tuples", "_blank", ); }} diff --git a/swan-lake/by-example/retry-transaction-statement/content.jsx b/swan-lake/by-example/retry-transaction-statement/content.jsx index 8dff48e8f73b..dbb4ccdbce64 100644 --- a/swan-lake/by-example/retry-transaction-statement/content.jsx +++ b/swan-lake/by-example/retry-transaction-statement/content.jsx @@ -71,7 +71,7 @@ export function RetryTransactionStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/retry-transaction-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/retry-transaction-statement", "_blank", ); }} diff --git a/swan-lake/by-example/rollback/content.jsx b/swan-lake/by-example/rollback/content.jsx index 5bba9acee489..e9542e9f198a 100644 --- a/swan-lake/by-example/rollback/content.jsx +++ b/swan-lake/by-example/rollback/content.jsx @@ -117,7 +117,7 @@ export function Rollback({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/rollback", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/rollback", "_blank", ); }} diff --git a/swan-lake/by-example/run-strands-safely-on-separate-threads/content.jsx b/swan-lake/by-example/run-strands-safely-on-separate-threads/content.jsx index 2ca42646f400..4702f7443324 100644 --- a/swan-lake/by-example/run-strands-safely-on-separate-threads/content.jsx +++ b/swan-lake/by-example/run-strands-safely-on-separate-threads/content.jsx @@ -97,7 +97,7 @@ export function RunStrandsSafelyOnSeparateThreads({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/run-strands-safely-on-separate-threads", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/run-strands-safely-on-separate-threads", "_blank", ); }} diff --git a/swan-lake/by-example/security-crypto/content.jsx b/swan-lake/by-example/security-crypto/content.jsx index ffc5a4f933f0..b507ae028c21 100644 --- a/swan-lake/by-example/security-crypto/content.jsx +++ b/swan-lake/by-example/security-crypto/content.jsx @@ -264,7 +264,7 @@ export function SecurityCrypto({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/security-crypto", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/security-crypto", "_blank", ); }} diff --git a/swan-lake/by-example/security-jwt-issue-validate/content.jsx b/swan-lake/by-example/security-jwt-issue-validate/content.jsx index da53d477c016..66d01ece250f 100644 --- a/swan-lake/by-example/security-jwt-issue-validate/content.jsx +++ b/swan-lake/by-example/security-jwt-issue-validate/content.jsx @@ -93,7 +93,7 @@ export function SecurityJwtIssueValidate({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/security-jwt-issue-validate", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/security-jwt-issue-validate", "_blank", ); }} diff --git a/swan-lake/by-example/send-email/content.jsx b/swan-lake/by-example/send-email/content.jsx index 2b13cd7bc34d..047f9a3090d6 100644 --- a/swan-lake/by-example/send-email/content.jsx +++ b/swan-lake/by-example/send-email/content.jsx @@ -69,7 +69,7 @@ export function SendEmail({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/send-email", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/send-email", "_blank", ); }} diff --git a/swan-lake/by-example/sequence-diagrams/content.jsx b/swan-lake/by-example/sequence-diagrams/content.jsx index 2f38a09721b7..13a8adcb1acb 100644 --- a/swan-lake/by-example/sequence-diagrams/content.jsx +++ b/swan-lake/by-example/sequence-diagrams/content.jsx @@ -67,7 +67,7 @@ export function SequenceDiagrams({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/sequence-diagrams", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/sequence-diagrams", "_blank", ); }} diff --git a/swan-lake/by-example/service-declaration/content.jsx b/swan-lake/by-example/service-declaration/content.jsx index 0fe726187cfc..9931216ccc91 100644 --- a/swan-lake/by-example/service-declaration/content.jsx +++ b/swan-lake/by-example/service-declaration/content.jsx @@ -54,7 +54,7 @@ export function ServiceDeclaration({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/service-declaration", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/service-declaration", "_blank", ); }} diff --git a/swan-lake/by-example/sftp-client-receive-file/content.jsx b/swan-lake/by-example/sftp-client-receive-file/content.jsx index 6d75982ee1f0..20e7f851914a 100644 --- a/swan-lake/by-example/sftp-client-receive-file/content.jsx +++ b/swan-lake/by-example/sftp-client-receive-file/content.jsx @@ -75,7 +75,7 @@ export function SftpClientReceiveFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/sftp-client-receive-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/sftp-client-receive-file", "_blank", ); }} diff --git a/swan-lake/by-example/sftp-client-send-file/content.jsx b/swan-lake/by-example/sftp-client-send-file/content.jsx index 0fec58983727..336ab824abe1 100644 --- a/swan-lake/by-example/sftp-client-send-file/content.jsx +++ b/swan-lake/by-example/sftp-client-send-file/content.jsx @@ -72,7 +72,7 @@ export function SftpClientSendFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/sftp-client-send-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/sftp-client-send-file", "_blank", ); }} diff --git a/swan-lake/by-example/sftp-service-receive-file/content.jsx b/swan-lake/by-example/sftp-service-receive-file/content.jsx index 56aa67828e10..fe03507fc384 100644 --- a/swan-lake/by-example/sftp-service-receive-file/content.jsx +++ b/swan-lake/by-example/sftp-service-receive-file/content.jsx @@ -87,7 +87,7 @@ export function SftpServiceReceiveFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/sftp-service-receive-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/sftp-service-receive-file", "_blank", ); }} diff --git a/swan-lake/by-example/sftp-service-send-file/content.jsx b/swan-lake/by-example/sftp-service-send-file/content.jsx index b133e6e308b4..ff6c7635dfd4 100644 --- a/swan-lake/by-example/sftp-service-send-file/content.jsx +++ b/swan-lake/by-example/sftp-service-send-file/content.jsx @@ -83,7 +83,7 @@ export function SftpServiceSendFile({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/sftp-service-send-file", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/sftp-service-send-file", "_blank", ); }} diff --git a/swan-lake/by-example/single-use-of-typed-binding/content.jsx b/swan-lake/by-example/single-use-of-typed-binding/content.jsx index cf00722d1015..a78bfca583c5 100644 --- a/swan-lake/by-example/single-use-of-typed-binding/content.jsx +++ b/swan-lake/by-example/single-use-of-typed-binding/content.jsx @@ -67,7 +67,7 @@ export function SingleUseOfTypedBinding({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/single-use-of-typed-binding", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/single-use-of-typed-binding", "_blank", ); }} diff --git a/swan-lake/by-example/single-use-with-on-fail-clause/content.jsx b/swan-lake/by-example/single-use-with-on-fail-clause/content.jsx index 58e84058b94e..ef84267d7b0e 100644 --- a/swan-lake/by-example/single-use-with-on-fail-clause/content.jsx +++ b/swan-lake/by-example/single-use-with-on-fail-clause/content.jsx @@ -50,7 +50,7 @@ export function SingleUseWithOnFailClause({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/single-use-with-on-fail-clause", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/single-use-with-on-fail-clause", "_blank", ); }} diff --git a/swan-lake/by-example/soap-client-security-inbound-security-config/content.jsx b/swan-lake/by-example/soap-client-security-inbound-security-config/content.jsx index 55b72345d613..acac2b126b2c 100644 --- a/swan-lake/by-example/soap-client-security-inbound-security-config/content.jsx +++ b/swan-lake/by-example/soap-client-security-inbound-security-config/content.jsx @@ -62,7 +62,7 @@ export function SoapClientSecurityInboundSecurityConfig({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/soap-client-security-inbound-security-config", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/soap-client-security-inbound-security-config", "_blank", ); }} diff --git a/swan-lake/by-example/soap-client-security-outbound-security-config/content.jsx b/swan-lake/by-example/soap-client-security-outbound-security-config/content.jsx index ea4b786acfad..0de175a9aeb1 100644 --- a/swan-lake/by-example/soap-client-security-outbound-security-config/content.jsx +++ b/swan-lake/by-example/soap-client-security-outbound-security-config/content.jsx @@ -67,7 +67,7 @@ export function SoapClientSecurityOutboundSecurityConfig({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/soap-client-security-outbound-security-config", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/soap-client-security-outbound-security-config", "_blank", ); }} diff --git a/swan-lake/by-example/soap-client-security-ssl-tsl/content.jsx b/swan-lake/by-example/soap-client-security-ssl-tsl/content.jsx index 638e9ad22c16..b2fe6bc1cdb5 100644 --- a/swan-lake/by-example/soap-client-security-ssl-tsl/content.jsx +++ b/swan-lake/by-example/soap-client-security-ssl-tsl/content.jsx @@ -57,7 +57,7 @@ export function SoapClientSecuritySslTsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/soap-client-security-ssl-tsl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/soap-client-security-ssl-tsl", "_blank", ); }} diff --git a/swan-lake/by-example/soap-client-send-receive/content.jsx b/swan-lake/by-example/soap-client-send-receive/content.jsx index be7f9b91edfa..d7f34e1590f3 100644 --- a/swan-lake/by-example/soap-client-send-receive/content.jsx +++ b/swan-lake/by-example/soap-client-send-receive/content.jsx @@ -75,7 +75,7 @@ export function SoapClientSendReceive({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/soap-client-send-receive", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/soap-client-send-receive", "_blank", ); }} diff --git a/swan-lake/by-example/sort-iterable-objects/content.jsx b/swan-lake/by-example/sort-iterable-objects/content.jsx index b61cb21109af..358aeacaa8fb 100644 --- a/swan-lake/by-example/sort-iterable-objects/content.jsx +++ b/swan-lake/by-example/sort-iterable-objects/content.jsx @@ -77,7 +77,7 @@ export function SortIterableObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/sort-iterable-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/sort-iterable-objects", "_blank", ); }} diff --git a/swan-lake/by-example/start-service-from-service-class-definition/content.jsx b/swan-lake/by-example/start-service-from-service-class-definition/content.jsx index 8239b9192ddf..2545b5d92bb1 100644 --- a/swan-lake/by-example/start-service-from-service-class-definition/content.jsx +++ b/swan-lake/by-example/start-service-from-service-class-definition/content.jsx @@ -90,7 +90,7 @@ export function StartServiceFromServiceClassDefinition({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/start-service-from-service-class-definition", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/start-service-from-service-class-definition", "_blank", ); }} diff --git a/swan-lake/by-example/stop-handler/content.jsx b/swan-lake/by-example/stop-handler/content.jsx index cb90d657ed0c..544b6d3505bf 100644 --- a/swan-lake/by-example/stop-handler/content.jsx +++ b/swan-lake/by-example/stop-handler/content.jsx @@ -74,7 +74,7 @@ export function StopHandler({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/stop-handler", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/stop-handler", "_blank", ); }} diff --git a/swan-lake/by-example/strands/content.jsx b/swan-lake/by-example/strands/content.jsx index 0ae9458cbff8..1a37bbd092c3 100644 --- a/swan-lake/by-example/strands/content.jsx +++ b/swan-lake/by-example/strands/content.jsx @@ -71,7 +71,7 @@ export function Strands({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/strands", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/strands", "_blank", ); }} diff --git a/swan-lake/by-example/stream-type/content.jsx b/swan-lake/by-example/stream-type/content.jsx index 83116ced1b23..bb513d0427e2 100644 --- a/swan-lake/by-example/stream-type/content.jsx +++ b/swan-lake/by-example/stream-type/content.jsx @@ -72,7 +72,7 @@ export function StreamType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/stream-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/stream-type", "_blank", ); }} diff --git a/swan-lake/by-example/strings/content.jsx b/swan-lake/by-example/strings/content.jsx index 45507cc74f7a..5f6f0ad9882c 100644 --- a/swan-lake/by-example/strings/content.jsx +++ b/swan-lake/by-example/strings/content.jsx @@ -58,7 +58,7 @@ export function Strings({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/strings", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/strings", "_blank", ); }} diff --git a/swan-lake/by-example/structural-typing/content.jsx b/swan-lake/by-example/structural-typing/content.jsx index 632b1285d684..a84eea05b4da 100644 --- a/swan-lake/by-example/structural-typing/content.jsx +++ b/swan-lake/by-example/structural-typing/content.jsx @@ -70,7 +70,7 @@ export function StructuralTyping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/structural-typing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/structural-typing", "_blank", ); }} diff --git a/swan-lake/by-example/structured-keys/content.jsx b/swan-lake/by-example/structured-keys/content.jsx index 30827df31769..cb0947d6231f 100644 --- a/swan-lake/by-example/structured-keys/content.jsx +++ b/swan-lake/by-example/structured-keys/content.jsx @@ -64,7 +64,7 @@ export function StructuredKeys({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/structured-keys", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/structured-keys", "_blank", ); }} diff --git a/swan-lake/by-example/synchronize-message-passing/content.jsx b/swan-lake/by-example/synchronize-message-passing/content.jsx index 0b9ef5fa1011..5c48e077f1fa 100644 --- a/swan-lake/by-example/synchronize-message-passing/content.jsx +++ b/swan-lake/by-example/synchronize-message-passing/content.jsx @@ -70,7 +70,7 @@ export function SynchronizeMessagePassing({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/synchronize-message-passing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/synchronize-message-passing", "_blank", ); }} @@ -209,8 +209,8 @@ export function SynchronizeMessagePassing({ codeSnippets }) {
updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} > - Inter-worker failure propagation + Named worker with on fail clause
diff --git a/swan-lake/by-example/table-types/content.jsx b/swan-lake/by-example/table-types/content.jsx index 433bfdf17e85..6958ef98d582 100644 --- a/swan-lake/by-example/table-types/content.jsx +++ b/swan-lake/by-example/table-types/content.jsx @@ -88,7 +88,7 @@ export function TableTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/table-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/table-types", "_blank", ); }} diff --git a/swan-lake/by-example/table/content.jsx b/swan-lake/by-example/table/content.jsx index ab2ce4f3865d..28ba2079c6de 100644 --- a/swan-lake/by-example/table/content.jsx +++ b/swan-lake/by-example/table/content.jsx @@ -79,7 +79,7 @@ export function Table({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/table", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/table", "_blank", ); }} diff --git a/swan-lake/by-example/task-frequency-job-execution/content.jsx b/swan-lake/by-example/task-frequency-job-execution/content.jsx index aa6bcc35038a..53504eb23de8 100644 --- a/swan-lake/by-example/task-frequency-job-execution/content.jsx +++ b/swan-lake/by-example/task-frequency-job-execution/content.jsx @@ -75,7 +75,7 @@ export function TaskFrequencyJobExecution({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/task-frequency-job-execution", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/task-frequency-job-execution", "_blank", ); }} diff --git a/swan-lake/by-example/task-one-time-job-execution/content.jsx b/swan-lake/by-example/task-one-time-job-execution/content.jsx index e606d210aeac..57a312f4bf64 100644 --- a/swan-lake/by-example/task-one-time-job-execution/content.jsx +++ b/swan-lake/by-example/task-one-time-job-execution/content.jsx @@ -79,7 +79,7 @@ export function TaskOneTimeJobExecution({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/task-one-time-job-execution", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/task-one-time-job-execution", "_blank", ); }} diff --git a/swan-lake/by-example/tcp-client-ssl-tls/content.jsx b/swan-lake/by-example/tcp-client-ssl-tls/content.jsx index 7a97b7e207c1..f808a8fb3a6a 100644 --- a/swan-lake/by-example/tcp-client-ssl-tls/content.jsx +++ b/swan-lake/by-example/tcp-client-ssl-tls/content.jsx @@ -59,7 +59,7 @@ export function TcpClientSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/tcp-client-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/tcp-client-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/tcp-client/content.jsx b/swan-lake/by-example/tcp-client/content.jsx index 7ff605804d2a..a6d6635ff051 100644 --- a/swan-lake/by-example/tcp-client/content.jsx +++ b/swan-lake/by-example/tcp-client/content.jsx @@ -61,7 +61,7 @@ export function TcpClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/tcp-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/tcp-client", "_blank", ); }} diff --git a/swan-lake/by-example/tcp-listener/content.jsx b/swan-lake/by-example/tcp-listener/content.jsx index 0ccb300729e4..c70344750297 100644 --- a/swan-lake/by-example/tcp-listener/content.jsx +++ b/swan-lake/by-example/tcp-listener/content.jsx @@ -78,7 +78,7 @@ export function TcpListener({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/tcp-listener", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/tcp-listener", "_blank", ); }} diff --git a/swan-lake/by-example/tcp-service-ssl-tls/content.jsx b/swan-lake/by-example/tcp-service-ssl-tls/content.jsx index a9cba67eeb13..90d6eaa82662 100644 --- a/swan-lake/by-example/tcp-service-ssl-tls/content.jsx +++ b/swan-lake/by-example/tcp-service-ssl-tls/content.jsx @@ -74,7 +74,7 @@ export function TcpServiceSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/tcp-service-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/tcp-service-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/temp-files-directories/content.jsx b/swan-lake/by-example/temp-files-directories/content.jsx index ed7c9abe9033..09f4abd55f33 100644 --- a/swan-lake/by-example/temp-files-directories/content.jsx +++ b/swan-lake/by-example/temp-files-directories/content.jsx @@ -60,7 +60,7 @@ export function TempFilesDirectories({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/temp-files-directories", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/temp-files-directories", "_blank", ); }} diff --git a/swan-lake/by-example/testerina-assertions/content.jsx b/swan-lake/by-example/testerina-assertions/content.jsx index 9ce61633fa82..ae51a0f3fd3d 100644 --- a/swan-lake/by-example/testerina-assertions/content.jsx +++ b/swan-lake/by-example/testerina-assertions/content.jsx @@ -7,7 +7,7 @@ import Link from "next/link"; export const codeSnippetData = [ `import ballerina/test; -@test:Config +@test:Config { } function testAssertEquals() { json a = {name:"John Doe", age:25, address:{city:"Colombo", country:"Sri Lanka"}}; @@ -17,7 +17,7 @@ function testAssertEquals() { test:assertEquals(a, b, msg = "JSON values are not equal"); } -@test:Config +@test:Config { } function testAssertNotEquals() { string s1 = "abc"; string s2 = "def"; @@ -25,21 +25,21 @@ function testAssertNotEquals() { test:assertNotEquals(s1, s2, msg = "String values are equal"); } -@test:Config +@test:Config { } function testAssertTrue() { boolean value = true; // Asserts if the provided value is \`true\`. test:assertTrue(value, msg = "AssertTrue failed"); } -@test:Config +@test:Config { } function testAssertFalse() { boolean value = false; // Asserts if the provided value is \`false\`. test:assertFalse(value, msg = "AssertFalse failed"); } -@test:Config +@test:Config { } function testAssertFail() { boolean flag = true; if (flag) { @@ -57,7 +57,7 @@ class Person { string address = "No 20, Palm grove"; } -@test:Config +@test:Config { } function testAssertExactEquals() { Person person1 = new; Person person2 = person1; @@ -66,7 +66,7 @@ function testAssertExactEquals() { msg = "Objects are not exactly equal"); } -@test:Config +@test:Config { } function testAssertNotExactEquals() { Person person1 = new; Person person2 = new; @@ -117,7 +117,7 @@ export function TesterinaAssertions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-assertions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-assertions", "_blank", ); }} @@ -284,8 +284,9 @@ export function TesterinaAssertions({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -329,8 +330,9 @@ export function TesterinaAssertions({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-before-and-after-each/content.jsx b/swan-lake/by-example/testerina-before-and-after-each/content.jsx index 019468b2a193..35cde9b133d6 100644 --- a/swan-lake/by-example/testerina-before-and-after-each/content.jsx +++ b/swan-lake/by-example/testerina-before-and-after-each/content.jsx @@ -21,14 +21,14 @@ function afterEachFunc() { } // A test function. -@test:Config +@test:Config { } function testFunction1() { io:println("I'm in test function 1!"); test:assertTrue(true, msg = "Failed!"); } // Another test function. -@test:Config +@test:Config { } function testFunction2() { io:println("I'm in test function 2!"); test:assertTrue(true, msg = "Failed!"); @@ -78,7 +78,7 @@ export function TesterinaBeforeAndAfterEach({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-before-and-after-each", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-before-and-after-each", "_blank", ); }} @@ -246,8 +246,9 @@ export function TesterinaBeforeAndAfterEach({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -291,8 +292,9 @@ export function TesterinaBeforeAndAfterEach({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-before-and-after-groups/content.jsx b/swan-lake/by-example/testerina-before-and-after-groups/content.jsx index 6b7ea73daf3d..a952c139c673 100644 --- a/swan-lake/by-example/testerina-before-and-after-groups/content.jsx +++ b/swan-lake/by-example/testerina-before-and-after-groups/content.jsx @@ -28,7 +28,7 @@ function testFunction1() { } // Another test function. -@test:Config +@test:Config {} function testFunction2() { io:println("I'm in test function 2!"); test:assertTrue(true, msg = "Failed!"); @@ -78,7 +78,7 @@ export function TesterinaBeforeAndAfterGroups({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-before-and-after-groups", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-before-and-after-groups", "_blank", ); }} @@ -244,8 +244,9 @@ export function TesterinaBeforeAndAfterGroups({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -289,8 +290,9 @@ export function TesterinaBeforeAndAfterGroups({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-before-and-after-suite/content.jsx b/swan-lake/by-example/testerina-before-and-after-suite/content.jsx index b2c03d668c05..752ad3764b31 100644 --- a/swan-lake/by-example/testerina-before-and-after-suite/content.jsx +++ b/swan-lake/by-example/testerina-before-and-after-suite/content.jsx @@ -15,21 +15,21 @@ function beforeSuit() { } // A Test function. -@test:Config +@test:Config { } function testFunction1() { io:println("I'm in test function 1!"); test:assertTrue(true, msg = "Failed"); } // A Test function. -@test:Config +@test:Config { } function testFunction2() { io:println("I'm in test function 2!"); test:assertTrue(true, msg = "Failed"); } // Executed after all the test functions in the module. -@test:AfterSuite +@test:AfterSuite { } function afterSuite() { io:println("I'm the after suite function!"); } @@ -82,7 +82,7 @@ export function TesterinaBeforeAndAfterSuite({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-before-and-after-suite", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-before-and-after-suite", "_blank", ); }} @@ -248,8 +248,9 @@ export function TesterinaBeforeAndAfterSuite({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -293,8 +294,9 @@ export function TesterinaBeforeAndAfterSuite({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-before-and-after-test/content.jsx b/swan-lake/by-example/testerina-before-and-after-test/content.jsx index f2f0194105f3..333c39a5ac02 100644 --- a/swan-lake/by-example/testerina-before-and-after-test/content.jsx +++ b/swan-lake/by-example/testerina-before-and-after-test/content.jsx @@ -77,7 +77,7 @@ export function TesterinaBeforeAndAfterTest({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-before-and-after-test", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-before-and-after-test", "_blank", ); }} diff --git a/swan-lake/by-example/testerina-data-driven-tests/content.jsx b/swan-lake/by-example/testerina-data-driven-tests/content.jsx index d704276e483d..378d20be2596 100644 --- a/swan-lake/by-example/testerina-data-driven-tests/content.jsx +++ b/swan-lake/by-example/testerina-data-driven-tests/content.jsx @@ -91,7 +91,7 @@ export function TesterinaDataDrivenTests({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-data-driven-tests", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-data-driven-tests", "_blank", ); }} diff --git a/swan-lake/by-example/testerina-group-tests/content.jsx b/swan-lake/by-example/testerina-group-tests/content.jsx index 2b2558ef24b9..0219bfe07614 100644 --- a/swan-lake/by-example/testerina-group-tests/content.jsx +++ b/swan-lake/by-example/testerina-group-tests/content.jsx @@ -23,7 +23,7 @@ function testFunction2() { } // Does not belong to any test group. -@test:Config +@test:Config { } function testFunction3() { io:println("I'm the ungrouped test"); test:assertTrue(true, msg = "Failed!"); @@ -84,7 +84,7 @@ export function TesterinaGroupTests({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-group-tests", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-group-tests", "_blank", ); }} @@ -424,8 +424,9 @@ export function TesterinaGroupTests({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -469,8 +470,9 @@ export function TesterinaGroupTests({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-guarantee-test-execution-order/content.jsx b/swan-lake/by-example/testerina-guarantee-test-execution-order/content.jsx index ce2757ce6c4c..5baac805eec8 100644 --- a/swan-lake/by-example/testerina-guarantee-test-execution-order/content.jsx +++ b/swan-lake/by-example/testerina-guarantee-test-execution-order/content.jsx @@ -25,7 +25,7 @@ function testFunction2() { // This will be executed without depending on other functions. // However, since other functions depend on this function, it will be executed first. -@test:Config +@test:Config { } function testFunction3() { io:println("I'm in test function 3!"); test:assertTrue(true, msg = "Failed!"); @@ -78,7 +78,7 @@ export function TesterinaGuaranteeTestExecutionOrder({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-guarantee-test-execution-order", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-guarantee-test-execution-order", "_blank", ); }} @@ -244,8 +244,9 @@ export function TesterinaGuaranteeTestExecutionOrder({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -289,8 +290,9 @@ export function TesterinaGuaranteeTestExecutionOrder({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-mocking-functions/content.jsx b/swan-lake/by-example/testerina-mocking-functions/content.jsx index de841bfa7deb..9157a9232d4b 100644 --- a/swan-lake/by-example/testerina-mocking-functions/content.jsx +++ b/swan-lake/by-example/testerina-mocking-functions/content.jsx @@ -24,7 +24,7 @@ import ballerina/io; @test:Mock { functionName: "intAdd" } test:MockFunction intAddMockFn = new(); -@test:Config +@test:Config {} function testReturn() { // Stubs the calls to return a specific value. test:when(intAddMockFn).thenReturn(20); @@ -52,7 +52,7 @@ public function mockPrint(any|error... val) { tally = tally + 1; } -@test:Config +@test:Config {} function testCall() { // Stubs the calls to the \`io:println\` function // to invoke the \`mockPrint\` function instead. @@ -114,7 +114,7 @@ export function TesterinaMockingFunctions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-mocking-functions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-mocking-functions", "_blank", ); }} @@ -198,7 +198,7 @@ export function TesterinaMockingFunctions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-mocking-functions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-mocking-functions", "_blank", ); }} @@ -362,8 +362,9 @@ export function TesterinaMockingFunctions({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -407,8 +408,9 @@ export function TesterinaMockingFunctions({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/testerina-mocking-objects/content.jsx b/swan-lake/by-example/testerina-mocking-objects/content.jsx index 3b8538296162..d220b4f005d2 100644 --- a/swan-lake/by-example/testerina-mocking-objects/content.jsx +++ b/swan-lake/by-example/testerina-mocking-objects/content.jsx @@ -71,7 +71,7 @@ public client class MockHttpClient { } } -@test:Config +@test:Config { } function testTestDouble() { // Creates and assigns the defined test-double. clientEndpoint = test:mock(http:Client, new MockHttpClient()); @@ -79,7 +79,7 @@ function testTestDouble() { test:assertEquals(res.statusCode, 500); } -@test:Config +@test:Config { } function testReturn() { // Creates and assigns a default mock object, // which subsequently needs to be stubbed. @@ -90,7 +90,7 @@ function testReturn() { test:assertEquals(res.statusCode, 200); } -@test:Config +@test:Config { } function testReturnSequence() { http:Response mockResponse = new; mockResponse.statusCode = 404; @@ -105,7 +105,7 @@ function testReturnSequence() { test:assertEquals(res.statusCode, 404); } -@test:Config +@test:Config { } function testReturnWithArgs() { http:Response mockResponse = new; mockResponse.statusCode = 404; @@ -121,7 +121,7 @@ function testReturnWithArgs() { test:assertEquals(res.statusCode, 404); } -@test:Config +@test:Config { } function testSendNotification() { smtpClient = test:mock(email:SmtpClient); // Stubs the \`send\` method of the \`mockSmtpClient\` to do nothing. @@ -132,7 +132,7 @@ function testSendNotification() { test:assertEquals(err, ()); } -@test:Config +@test:Config {} function testMemberVariable() { string mockId = "test"; lock { @@ -216,7 +216,7 @@ export function TesterinaMockingObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-mocking-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-mocking-objects", "_blank", ); }} @@ -300,7 +300,7 @@ export function TesterinaMockingObjects({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/testerina-mocking-objects", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/testerina-mocking-objects", "_blank", ); }} @@ -478,8 +478,9 @@ export function TesterinaMockingObjects({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[0] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[0] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([true, false])} onMouseOut={() => updateBtnHover([false, false])} @@ -523,8 +524,9 @@ export function TesterinaMockingObjects({ codeSnippets }) { width="20" height="20" fill="#3ad1ca" - className={`${btnHover[1] ? "btnArrowHover" : "btnArrow" - } bi bi-arrow-right`} + className={`${ + btnHover[1] ? "btnArrowHover" : "btnArrow" + } bi bi-arrow-right`} viewBox="0 0 16 16" onMouseEnter={() => updateBtnHover([false, true])} onMouseOut={() => updateBtnHover([false, false])} diff --git a/swan-lake/by-example/time-formatting-and-parsing/content.jsx b/swan-lake/by-example/time-formatting-and-parsing/content.jsx index 2a5288e43862..f9fc8876859b 100644 --- a/swan-lake/by-example/time-formatting-and-parsing/content.jsx +++ b/swan-lake/by-example/time-formatting-and-parsing/content.jsx @@ -86,7 +86,7 @@ export function TimeFormattingAndParsing({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/time-formatting-and-parsing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/time-formatting-and-parsing", "_blank", ); }} diff --git a/swan-lake/by-example/time-utc-and-civil/content.jsx b/swan-lake/by-example/time-utc-and-civil/content.jsx index dd378336202a..dffe5258383b 100644 --- a/swan-lake/by-example/time-utc-and-civil/content.jsx +++ b/swan-lake/by-example/time-utc-and-civil/content.jsx @@ -72,7 +72,7 @@ export function TimeUtcAndCivil({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/time-utc-and-civil", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/time-utc-and-civil", "_blank", ); }} diff --git a/swan-lake/by-example/time-utc/content.jsx b/swan-lake/by-example/time-utc/content.jsx index 137d1b9790b6..9aea7c642daa 100644 --- a/swan-lake/by-example/time-utc/content.jsx +++ b/swan-lake/by-example/time-utc/content.jsx @@ -58,7 +58,7 @@ export function TimeUtc({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/time-utc", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/time-utc", "_blank", ); }} diff --git a/swan-lake/by-example/tracing/content.jsx b/swan-lake/by-example/tracing/content.jsx index d78ccfcaa411..9d970647842d 100644 --- a/swan-lake/by-example/tracing/content.jsx +++ b/swan-lake/by-example/tracing/content.jsx @@ -119,7 +119,7 @@ export function Tracing({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/tracing", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/tracing", "_blank", ); }} diff --git a/swan-lake/by-example/transaction-statement/content.jsx b/swan-lake/by-example/transaction-statement/content.jsx index 576dd21152c0..d13be20f83df 100644 --- a/swan-lake/by-example/transaction-statement/content.jsx +++ b/swan-lake/by-example/transaction-statement/content.jsx @@ -66,7 +66,7 @@ export function TransactionStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/transaction-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/transaction-statement", "_blank", ); }} diff --git a/swan-lake/by-example/transactional-named-workers/content.jsx b/swan-lake/by-example/transactional-named-workers/content.jsx index 82f8c8825fa4..6ddf0ee5414c 100644 --- a/swan-lake/by-example/transactional-named-workers/content.jsx +++ b/swan-lake/by-example/transactional-named-workers/content.jsx @@ -65,7 +65,7 @@ export function TransactionalNamedWorkers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/transactional-named-workers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/transactional-named-workers", "_blank", ); }} diff --git a/swan-lake/by-example/transactional-qualifier/content.jsx b/swan-lake/by-example/transactional-qualifier/content.jsx index 24fd4ca56016..e00317cb38c2 100644 --- a/swan-lake/by-example/transactional-qualifier/content.jsx +++ b/swan-lake/by-example/transactional-qualifier/content.jsx @@ -79,7 +79,7 @@ export function TransactionalQualifier({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/transactional-qualifier", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/transactional-qualifier", "_blank", ); }} diff --git a/swan-lake/by-example/tuples/content.jsx b/swan-lake/by-example/tuples/content.jsx index 9c8916d7ed1c..8167e27cf88c 100644 --- a/swan-lake/by-example/tuples/content.jsx +++ b/swan-lake/by-example/tuples/content.jsx @@ -76,7 +76,7 @@ export function Tuples({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/tuples", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/tuples", "_blank", ); }} diff --git a/swan-lake/by-example/type-definitions/content.jsx b/swan-lake/by-example/type-definitions/content.jsx index 208a73a92d47..99a4bf04c101 100644 --- a/swan-lake/by-example/type-definitions/content.jsx +++ b/swan-lake/by-example/type-definitions/content.jsx @@ -50,7 +50,7 @@ export function TypeDefinitions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/type-definitions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/type-definitions", "_blank", ); }} diff --git a/swan-lake/by-example/type-inclusion-for-records/content.jsx b/swan-lake/by-example/type-inclusion-for-records/content.jsx index 28a5bfc39f51..6d78caed1d86 100644 --- a/swan-lake/by-example/type-inclusion-for-records/content.jsx +++ b/swan-lake/by-example/type-inclusion-for-records/content.jsx @@ -67,7 +67,7 @@ export function TypeInclusionForRecords({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/type-inclusion-for-records", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/type-inclusion-for-records", "_blank", ); }} diff --git a/swan-lake/by-example/type-inference/content.jsx b/swan-lake/by-example/type-inference/content.jsx index 16a89677383a..799cd67cad83 100644 --- a/swan-lake/by-example/type-inference/content.jsx +++ b/swan-lake/by-example/type-inference/content.jsx @@ -66,7 +66,7 @@ export function TypeInference({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/type-inference", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/type-inference", "_blank", ); }} diff --git a/swan-lake/by-example/typed-binding-pattern/content.jsx b/swan-lake/by-example/typed-binding-pattern/content.jsx index 2441783c3d69..790c151b616f 100644 --- a/swan-lake/by-example/typed-binding-pattern/content.jsx +++ b/swan-lake/by-example/typed-binding-pattern/content.jsx @@ -65,7 +65,7 @@ export function TypedBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/typed-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/typed-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/typedesc-type/content.jsx b/swan-lake/by-example/typedesc-type/content.jsx index b76d4b3ac201..5912a6d82d18 100644 --- a/swan-lake/by-example/typedesc-type/content.jsx +++ b/swan-lake/by-example/typedesc-type/content.jsx @@ -61,7 +61,7 @@ export function TypedescType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/typedesc-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/typedesc-type", "_blank", ); }} diff --git a/swan-lake/by-example/udp-client/content.jsx b/swan-lake/by-example/udp-client/content.jsx index ae8a5e1d96d7..54e3375a7d29 100644 --- a/swan-lake/by-example/udp-client/content.jsx +++ b/swan-lake/by-example/udp-client/content.jsx @@ -71,7 +71,7 @@ export function UdpClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/udp-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/udp-client", "_blank", ); }} diff --git a/swan-lake/by-example/udp-connect-client/content.jsx b/swan-lake/by-example/udp-connect-client/content.jsx index d98a442a048c..289c2da3b20a 100644 --- a/swan-lake/by-example/udp-connect-client/content.jsx +++ b/swan-lake/by-example/udp-connect-client/content.jsx @@ -69,7 +69,7 @@ export function UdpConnectClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/udp-connect-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/udp-connect-client", "_blank", ); }} diff --git a/swan-lake/by-example/udp-listener/content.jsx b/swan-lake/by-example/udp-listener/content.jsx index 64efe6f8784f..f685148a303e 100644 --- a/swan-lake/by-example/udp-listener/content.jsx +++ b/swan-lake/by-example/udp-listener/content.jsx @@ -60,7 +60,7 @@ export function UdpListener({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/udp-listener", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/udp-listener", "_blank", ); }} diff --git a/swan-lake/by-example/unions/content.jsx b/swan-lake/by-example/unions/content.jsx index 183880c529ad..d3d9b1113507 100644 --- a/swan-lake/by-example/unions/content.jsx +++ b/swan-lake/by-example/unions/content.jsx @@ -74,7 +74,7 @@ export function Unions({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/unions", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/unions", "_blank", ); }} diff --git a/swan-lake/by-example/url-encode-decode/content.jsx b/swan-lake/by-example/url-encode-decode/content.jsx index 0698d18683d7..28997ef9ad54 100644 --- a/swan-lake/by-example/url-encode-decode/content.jsx +++ b/swan-lake/by-example/url-encode-decode/content.jsx @@ -56,7 +56,7 @@ export function UrlEncodeDecode({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/url-encode-decode", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/url-encode-decode", "_blank", ); }} diff --git a/swan-lake/by-example/uuid-generation/content.jsx b/swan-lake/by-example/uuid-generation/content.jsx index 521fe6987e32..690dd90d6f15 100644 --- a/swan-lake/by-example/uuid-generation/content.jsx +++ b/swan-lake/by-example/uuid-generation/content.jsx @@ -91,7 +91,7 @@ export function UuidGeneration({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/uuid-generation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/uuid-generation", "_blank", ); }} diff --git a/swan-lake/by-example/uuid-operations/content.jsx b/swan-lake/by-example/uuid-operations/content.jsx index dba9e46f301d..932fc5bd54fc 100644 --- a/swan-lake/by-example/uuid-operations/content.jsx +++ b/swan-lake/by-example/uuid-operations/content.jsx @@ -92,7 +92,7 @@ export function UuidOperations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/uuid-operations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/uuid-operations", "_blank", ); }} diff --git a/swan-lake/by-example/variables-and-types/content.jsx b/swan-lake/by-example/variables-and-types/content.jsx index 8b6bb3576fc8..3cd5ca3d03d2 100644 --- a/swan-lake/by-example/variables-and-types/content.jsx +++ b/swan-lake/by-example/variables-and-types/content.jsx @@ -48,7 +48,7 @@ export function VariablesAndTypes({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/variables-and-types", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/variables-and-types", "_blank", ); }} diff --git a/swan-lake/by-example/visibility-of-object-fields-and-methods/content.jsx b/swan-lake/by-example/visibility-of-object-fields-and-methods/content.jsx index 1d3d2818b557..02bb84672ffa 100644 --- a/swan-lake/by-example/visibility-of-object-fields-and-methods/content.jsx +++ b/swan-lake/by-example/visibility-of-object-fields-and-methods/content.jsx @@ -113,7 +113,7 @@ export function VisibilityOfObjectFieldsAndMethods({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/visibility-of-object-fields-and-methods", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/visibility-of-object-fields-and-methods", "_blank", ); }} diff --git a/swan-lake/by-example/waiting-for-workers/content.jsx b/swan-lake/by-example/waiting-for-workers/content.jsx index 264d146120ec..a0b928ad70e3 100644 --- a/swan-lake/by-example/waiting-for-workers/content.jsx +++ b/swan-lake/by-example/waiting-for-workers/content.jsx @@ -56,7 +56,7 @@ export function WaitingForWorkers({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/waiting-for-workers", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/waiting-for-workers", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-basic-sample/content.jsx b/swan-lake/by-example/websocket-basic-sample/content.jsx index 2aaa890cfe4a..7c62e2eb6329 100644 --- a/swan-lake/by-example/websocket-basic-sample/content.jsx +++ b/swan-lake/by-example/websocket-basic-sample/content.jsx @@ -73,7 +73,7 @@ export function WebsocketBasicSample({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-basic-sample", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-basic-sample", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-basic-auth/content.jsx b/swan-lake/by-example/websocket-client-basic-auth/content.jsx index 9006c80051f6..d307753b544d 100644 --- a/swan-lake/by-example/websocket-client-basic-auth/content.jsx +++ b/swan-lake/by-example/websocket-client-basic-auth/content.jsx @@ -58,7 +58,7 @@ export function WebsocketClientBasicAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-basic-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-basic-auth", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-bearer-token-auth/content.jsx b/swan-lake/by-example/websocket-client-bearer-token-auth/content.jsx index 0804ff817b7f..b30b97cf4b15 100644 --- a/swan-lake/by-example/websocket-client-bearer-token-auth/content.jsx +++ b/swan-lake/by-example/websocket-client-bearer-token-auth/content.jsx @@ -57,7 +57,7 @@ export function WebsocketClientBearerTokenAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-bearer-token-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-bearer-token-auth", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-mutual-ssl/content.jsx b/swan-lake/by-example/websocket-client-mutual-ssl/content.jsx index 9432903f1874..bc385a0254bf 100644 --- a/swan-lake/by-example/websocket-client-mutual-ssl/content.jsx +++ b/swan-lake/by-example/websocket-client-mutual-ssl/content.jsx @@ -64,7 +64,7 @@ export function WebsocketClientMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-oauth2-client-cred-grant-type/content.jsx b/swan-lake/by-example/websocket-client-oauth2-client-cred-grant-type/content.jsx index fe6c0536a543..557607896a52 100644 --- a/swan-lake/by-example/websocket-client-oauth2-client-cred-grant-type/content.jsx +++ b/swan-lake/by-example/websocket-client-oauth2-client-cred-grant-type/content.jsx @@ -65,7 +65,7 @@ export function WebsocketClientOauth2ClientCredGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-oauth2-client-cred-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-oauth2-client-cred-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-oauth2-jwt-bearer-grant-type/content.jsx b/swan-lake/by-example/websocket-client-oauth2-jwt-bearer-grant-type/content.jsx index 7d7605743078..31ac82b2abb8 100644 --- a/swan-lake/by-example/websocket-client-oauth2-jwt-bearer-grant-type/content.jsx +++ b/swan-lake/by-example/websocket-client-oauth2-jwt-bearer-grant-type/content.jsx @@ -66,7 +66,7 @@ export function WebsocketClientOauth2JwtBearerGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-oauth2-jwt-bearer-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-oauth2-jwt-bearer-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-oauth2-password-grant-type/content.jsx b/swan-lake/by-example/websocket-client-oauth2-password-grant-type/content.jsx index 03e5f73cd51b..df6068acce97 100644 --- a/swan-lake/by-example/websocket-client-oauth2-password-grant-type/content.jsx +++ b/swan-lake/by-example/websocket-client-oauth2-password-grant-type/content.jsx @@ -71,7 +71,7 @@ export function WebsocketClientOauth2PasswordGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-oauth2-password-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-oauth2-password-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-oauth2-refresh-token-grant-type/content.jsx b/swan-lake/by-example/websocket-client-oauth2-refresh-token-grant-type/content.jsx index cf7193415fd9..f2388aff176f 100644 --- a/swan-lake/by-example/websocket-client-oauth2-refresh-token-grant-type/content.jsx +++ b/swan-lake/by-example/websocket-client-oauth2-refresh-token-grant-type/content.jsx @@ -67,7 +67,7 @@ export function WebsocketClientOauth2RefreshTokenGrantType({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-oauth2-refresh-token-grant-type", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-oauth2-refresh-token-grant-type", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-payload-constraint-validation/content.jsx b/swan-lake/by-example/websocket-client-payload-constraint-validation/content.jsx index cdfa5dcb50e6..4a90b850e01e 100644 --- a/swan-lake/by-example/websocket-client-payload-constraint-validation/content.jsx +++ b/swan-lake/by-example/websocket-client-payload-constraint-validation/content.jsx @@ -60,7 +60,7 @@ export function WebsocketClientPayloadConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-payload-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-payload-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-self-signed-jwt-auth/content.jsx b/swan-lake/by-example/websocket-client-self-signed-jwt-auth/content.jsx index 55f9f4d23b06..502e14cb67fb 100644 --- a/swan-lake/by-example/websocket-client-self-signed-jwt-auth/content.jsx +++ b/swan-lake/by-example/websocket-client-self-signed-jwt-auth/content.jsx @@ -70,7 +70,7 @@ export function WebsocketClientSelfSignedJwtAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-self-signed-jwt-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-self-signed-jwt-auth", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client-ssl-tls/content.jsx b/swan-lake/by-example/websocket-client-ssl-tls/content.jsx index 1e210c30d62d..eb704e5539eb 100644 --- a/swan-lake/by-example/websocket-client-ssl-tls/content.jsx +++ b/swan-lake/by-example/websocket-client-ssl-tls/content.jsx @@ -56,7 +56,7 @@ export function WebsocketClientSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-client/content.jsx b/swan-lake/by-example/websocket-client/content.jsx index fc1e2e09edbe..cee4889bdb81 100644 --- a/swan-lake/by-example/websocket-client/content.jsx +++ b/swan-lake/by-example/websocket-client/content.jsx @@ -59,7 +59,7 @@ export function WebsocketClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-client", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-retry-client/content.jsx b/swan-lake/by-example/websocket-retry-client/content.jsx index d741efd90e29..07b9eb26f199 100644 --- a/swan-lake/by-example/websocket-retry-client/content.jsx +++ b/swan-lake/by-example/websocket-retry-client/content.jsx @@ -58,7 +58,7 @@ export function WebsocketRetryClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-retry-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-retry-client", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-basic-auth-file-user-store/content.jsx b/swan-lake/by-example/websocket-service-basic-auth-file-user-store/content.jsx index a623cf03a1a3..c4ef71be8343 100644 --- a/swan-lake/by-example/websocket-service-basic-auth-file-user-store/content.jsx +++ b/swan-lake/by-example/websocket-service-basic-auth-file-user-store/content.jsx @@ -105,7 +105,7 @@ export function WebsocketServiceBasicAuthFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-basic-auth-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-basic-auth-file-user-store", "_blank", ); }} @@ -197,7 +197,7 @@ export function WebsocketServiceBasicAuthFileUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-basic-auth-file-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-basic-auth-file-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-basic-auth-ldap-user-store/content.jsx b/swan-lake/by-example/websocket-service-basic-auth-ldap-user-store/content.jsx index 24cc66277be4..b8dc57ed5b12 100644 --- a/swan-lake/by-example/websocket-service-basic-auth-ldap-user-store/content.jsx +++ b/swan-lake/by-example/websocket-service-basic-auth-ldap-user-store/content.jsx @@ -108,7 +108,7 @@ export function WebsocketServiceBasicAuthLdapUserStore({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-basic-auth-ldap-user-store", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-basic-auth-ldap-user-store", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-error-handling/content.jsx b/swan-lake/by-example/websocket-service-error-handling/content.jsx index 721bbb3a10c2..db4cd75cc070 100644 --- a/swan-lake/by-example/websocket-service-error-handling/content.jsx +++ b/swan-lake/by-example/websocket-service-error-handling/content.jsx @@ -74,7 +74,7 @@ export function WebsocketServiceErrorHandling({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-error-handling", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-error-handling", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-jwt-auth/content.jsx b/swan-lake/by-example/websocket-service-jwt-auth/content.jsx index 2502b4f7d1a8..c3a35956940c 100644 --- a/swan-lake/by-example/websocket-service-jwt-auth/content.jsx +++ b/swan-lake/by-example/websocket-service-jwt-auth/content.jsx @@ -87,7 +87,7 @@ export function WebsocketServiceJwtAuth({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-jwt-auth", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-jwt-auth", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-mutual-ssl/content.jsx b/swan-lake/by-example/websocket-service-mutual-ssl/content.jsx index 88698662f4e0..a8133cbcb3a0 100644 --- a/swan-lake/by-example/websocket-service-mutual-ssl/content.jsx +++ b/swan-lake/by-example/websocket-service-mutual-ssl/content.jsx @@ -79,7 +79,7 @@ export function WebsocketServiceMutualSsl({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-mutual-ssl", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-mutual-ssl", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-oauth2/content.jsx b/swan-lake/by-example/websocket-service-oauth2/content.jsx index 5339f0c1ddd0..f7df529a54af 100644 --- a/swan-lake/by-example/websocket-service-oauth2/content.jsx +++ b/swan-lake/by-example/websocket-service-oauth2/content.jsx @@ -91,7 +91,7 @@ export function WebsocketServiceOauth2({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-oauth2", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-oauth2", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-payload-constraint-validation/content.jsx b/swan-lake/by-example/websocket-service-payload-constraint-validation/content.jsx index 7a8be94edbe6..b78e93ef3ff2 100644 --- a/swan-lake/by-example/websocket-service-payload-constraint-validation/content.jsx +++ b/swan-lake/by-example/websocket-service-payload-constraint-validation/content.jsx @@ -68,7 +68,7 @@ export function WebsocketServicePayloadConstraintValidation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-payload-constraint-validation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-payload-constraint-validation", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-service-ssl-tls/content.jsx b/swan-lake/by-example/websocket-service-ssl-tls/content.jsx index 93f7db86fcdc..83676c60d88c 100644 --- a/swan-lake/by-example/websocket-service-ssl-tls/content.jsx +++ b/swan-lake/by-example/websocket-service-ssl-tls/content.jsx @@ -70,7 +70,7 @@ export function WebsocketServiceSslTls({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-service-ssl-tls", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-service-ssl-tls", "_blank", ); }} diff --git a/swan-lake/by-example/websocket-timeout-client/content.jsx b/swan-lake/by-example/websocket-timeout-client/content.jsx index c8e2fb17e251..ac2e908e8f0f 100644 --- a/swan-lake/by-example/websocket-timeout-client/content.jsx +++ b/swan-lake/by-example/websocket-timeout-client/content.jsx @@ -54,7 +54,7 @@ export function WebsocketTimeoutClient({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websocket-timeout-client", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websocket-timeout-client", "_blank", ); }} diff --git a/swan-lake/by-example/websub-webhook-sample/content.jsx b/swan-lake/by-example/websub-webhook-sample/content.jsx index 4b2a42bf23b4..9c6054f06b22 100644 --- a/swan-lake/by-example/websub-webhook-sample/content.jsx +++ b/swan-lake/by-example/websub-webhook-sample/content.jsx @@ -75,7 +75,7 @@ export function WebsubWebhookSample({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/websub-webhook-sample", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/websub-webhook-sample", "_blank", ); }} diff --git a/swan-lake/by-example/while-statement/content.jsx b/swan-lake/by-example/while-statement/content.jsx index 5d88c1abf752..4d8d8e88e852 100644 --- a/swan-lake/by-example/while-statement/content.jsx +++ b/swan-lake/by-example/while-statement/content.jsx @@ -50,7 +50,7 @@ export function WhileStatement({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/while-statement", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/while-statement", "_blank", ); }} diff --git a/swan-lake/by-example/wildcard-binding-pattern/content.jsx b/swan-lake/by-example/wildcard-binding-pattern/content.jsx index fb017b66ba25..59a3db88ad77 100644 --- a/swan-lake/by-example/wildcard-binding-pattern/content.jsx +++ b/swan-lake/by-example/wildcard-binding-pattern/content.jsx @@ -53,7 +53,7 @@ export function WildcardBindingPattern({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/wildcard-binding-pattern", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/wildcard-binding-pattern", "_blank", ); }} diff --git a/swan-lake/by-example/xml-access/content.jsx b/swan-lake/by-example/xml-access/content.jsx index c963f93e75b2..665b1b1a72e9 100644 --- a/swan-lake/by-example/xml-access/content.jsx +++ b/swan-lake/by-example/xml-access/content.jsx @@ -91,7 +91,7 @@ export function XmlAccess({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-access", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-access", "_blank", ); }} diff --git a/swan-lake/by-example/xml-data-model/content.jsx b/swan-lake/by-example/xml-data-model/content.jsx index 395cd24ff397..4fa88bb2c57c 100644 --- a/swan-lake/by-example/xml-data-model/content.jsx +++ b/swan-lake/by-example/xml-data-model/content.jsx @@ -172,7 +172,7 @@ export function XmlDataModel({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-data-model", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-data-model", "_blank", ); }} diff --git a/swan-lake/by-example/xml-from-json-conversion/content.jsx b/swan-lake/by-example/xml-from-json-conversion/content.jsx index 6f3d9eed7d7e..48da1effb6bb 100644 --- a/swan-lake/by-example/xml-from-json-conversion/content.jsx +++ b/swan-lake/by-example/xml-from-json-conversion/content.jsx @@ -62,7 +62,7 @@ export function XmlFromJsonConversion({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-from-json-conversion", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-from-json-conversion", "_blank", ); }} diff --git a/swan-lake/by-example/xml-from-record-conversion/content.jsx b/swan-lake/by-example/xml-from-record-conversion/content.jsx index 395f37bd6d2e..362ea62c07a6 100644 --- a/swan-lake/by-example/xml-from-record-conversion/content.jsx +++ b/swan-lake/by-example/xml-from-record-conversion/content.jsx @@ -84,7 +84,7 @@ export function XmlFromRecordConversion({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-from-record-conversion", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-from-record-conversion", "_blank", ); }} diff --git a/swan-lake/by-example/xml-iteration/content.jsx b/swan-lake/by-example/xml-iteration/content.jsx index b25aa0b15b1f..eaad587efb53 100644 --- a/swan-lake/by-example/xml-iteration/content.jsx +++ b/swan-lake/by-example/xml-iteration/content.jsx @@ -53,7 +53,7 @@ export function XmlIteration({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-iteration", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-iteration", "_blank", ); }} diff --git a/swan-lake/by-example/xml-mutation/content.jsx b/swan-lake/by-example/xml-mutation/content.jsx index 53a39ca6ed7a..9b23af871625 100644 --- a/swan-lake/by-example/xml-mutation/content.jsx +++ b/swan-lake/by-example/xml-mutation/content.jsx @@ -52,7 +52,7 @@ export function XmlMutation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-mutation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-mutation", "_blank", ); }} diff --git a/swan-lake/by-example/xml-namespaces/content.jsx b/swan-lake/by-example/xml-namespaces/content.jsx index 824ca20cbf3d..32af7ff0d0df 100644 --- a/swan-lake/by-example/xml-namespaces/content.jsx +++ b/swan-lake/by-example/xml-namespaces/content.jsx @@ -51,7 +51,7 @@ export function XmlNamespaces({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-namespaces", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-namespaces", "_blank", ); }} diff --git a/swan-lake/by-example/xml-navigation/content.jsx b/swan-lake/by-example/xml-navigation/content.jsx index e6b57da4ba4b..f76c9695322b 100644 --- a/swan-lake/by-example/xml-navigation/content.jsx +++ b/swan-lake/by-example/xml-navigation/content.jsx @@ -85,7 +85,7 @@ export function XmlNavigation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-navigation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-navigation", "_blank", ); }} diff --git a/swan-lake/by-example/xml-operations/content.jsx b/swan-lake/by-example/xml-operations/content.jsx index 901899f9f85a..8d20cf9b16f4 100644 --- a/swan-lake/by-example/xml-operations/content.jsx +++ b/swan-lake/by-example/xml-operations/content.jsx @@ -59,7 +59,7 @@ export function XmlOperations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-operations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-operations", "_blank", ); }} diff --git a/swan-lake/by-example/xml-subtyping/content.jsx b/swan-lake/by-example/xml-subtyping/content.jsx index 2408a644a3f5..2b37ceb186f3 100644 --- a/swan-lake/by-example/xml-subtyping/content.jsx +++ b/swan-lake/by-example/xml-subtyping/content.jsx @@ -128,7 +128,7 @@ export function XmlSubtyping({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-subtyping", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-subtyping", "_blank", ); }} diff --git a/swan-lake/by-example/xml-templates-and-query/content.jsx b/swan-lake/by-example/xml-templates-and-query/content.jsx index 4194dd096cfb..ba23cff21419 100644 --- a/swan-lake/by-example/xml-templates-and-query/content.jsx +++ b/swan-lake/by-example/xml-templates-and-query/content.jsx @@ -55,7 +55,7 @@ export function XmlTemplatesAndQuery({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-templates-and-query", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-templates-and-query", "_blank", ); }} diff --git a/swan-lake/by-example/xml-templates/content.jsx b/swan-lake/by-example/xml-templates/content.jsx index 73431ce96d4a..09504d44e025 100644 --- a/swan-lake/by-example/xml-templates/content.jsx +++ b/swan-lake/by-example/xml-templates/content.jsx @@ -58,7 +58,7 @@ export function XmlTemplates({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-templates", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-templates", "_blank", ); }} diff --git a/swan-lake/by-example/xml-to-json-conversion/content.jsx b/swan-lake/by-example/xml-to-json-conversion/content.jsx index 08387db2b8a7..ed3cd7f258b5 100644 --- a/swan-lake/by-example/xml-to-json-conversion/content.jsx +++ b/swan-lake/by-example/xml-to-json-conversion/content.jsx @@ -62,7 +62,7 @@ export function XmlToJsonConversion({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-to-json-conversion", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-to-json-conversion", "_blank", ); }} diff --git a/swan-lake/by-example/xml-to-record-conversion/content.jsx b/swan-lake/by-example/xml-to-record-conversion/content.jsx index a9e81a6e258d..21de2a332921 100644 --- a/swan-lake/by-example/xml-to-record-conversion/content.jsx +++ b/swan-lake/by-example/xml-to-record-conversion/content.jsx @@ -86,7 +86,7 @@ export function XmlToRecordConversion({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-to-record-conversion", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-to-record-conversion", "_blank", ); }} diff --git a/swan-lake/by-example/xml-to-record-with-projection/content.jsx b/swan-lake/by-example/xml-to-record-with-projection/content.jsx index 9df0e0e2f8bd..fb95f136767e 100644 --- a/swan-lake/by-example/xml-to-record-with-projection/content.jsx +++ b/swan-lake/by-example/xml-to-record-with-projection/content.jsx @@ -80,7 +80,7 @@ export function XmlToRecordWithProjection({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-to-record-with-projection", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-to-record-with-projection", "_blank", ); }} @@ -207,45 +207,9 @@ export function XmlToRecordWithProjection({ codeSnippets }) {
             
-              {`import ballerina/data.xmldata;`}
-              {`import ballerina/io;`}
-              {`
-`}
-              {`// Define a closed record type to capture the required elements and attributes from the XML data.`}
-              {`type Book record {|`}
-              {`    string name;`}
-              {`    string author;`}
-              {`|};`}
-              {`
-`}
-              {`xml xmlData = xml \``}
-              {``}
-              {`    Clean Code`}
-              {`    Robert C. Martin`}
-              {`    2008`}
-              {`    Prentice Hall`}
-              {`\`;`}
-              {`
-`}
-              {`string xmlStr = string \``}
-              {``}
-              {`    Clean Code`}
-              {`    Robert C. Martin`}
-              {`    2008`}
-              {`    Prentice Hall`}
-              {`\`;`}
-              {`
-`}
-              {`public function main() returns error? {`}
-              {`    // Based on the expected type, it selectively converts the XML data to the record type.`}
-              {`    Book book = check xmldata:parseAsType(xmlData);`}
-              {`    io:println(book);`}
-              {`
-`}
-              {`    // Based on the expected type, it selectively converts the XML string to the record type.`}
-              {`    Book book2 = check xmldata:parseString(xmlStr);`}
-              {`    io:println(book2);`}
-              {`}`}
+              {`\$ bal run xml_to_record_with_projection.bal`}
+              {`{"name":"Clean Code","author":"Robert C. Martin"}`}
+              {`{"name":"Clean Code","author":"Robert C. Martin"}`}
             
           
diff --git a/swan-lake/by-example/xml-to-record/content.jsx b/swan-lake/by-example/xml-to-record/content.jsx index b70af5d8b9aa..fb1b2bf58cbb 100644 --- a/swan-lake/by-example/xml-to-record/content.jsx +++ b/swan-lake/by-example/xml-to-record/content.jsx @@ -110,7 +110,7 @@ export function XmlToRecord({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xml-to-record", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xml-to-record", "_blank", ); }} diff --git a/swan-lake/by-example/xmlns-declarations/content.jsx b/swan-lake/by-example/xmlns-declarations/content.jsx index 4c209e5b6f75..55a6ecaeaab2 100644 --- a/swan-lake/by-example/xmlns-declarations/content.jsx +++ b/swan-lake/by-example/xmlns-declarations/content.jsx @@ -69,7 +69,7 @@ export function XmlnsDeclarations({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xmlns-declarations", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xmlns-declarations", "_blank", ); }} diff --git a/swan-lake/by-example/xslt-transformation/content.jsx b/swan-lake/by-example/xslt-transformation/content.jsx index 757e981ee984..29ca25aedfe8 100644 --- a/swan-lake/by-example/xslt-transformation/content.jsx +++ b/swan-lake/by-example/xslt-transformation/content.jsx @@ -106,7 +106,7 @@ export function XsltTransformation({ codeSnippets }) { className="bg-transparent border-0 m-0 p-2 ms-auto" onClick={() => { window.open( - "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.0/examples/xslt-transformation", + "https://github.com/ballerina-platform/ballerina-distribution/tree/v2201.9.2/examples/xslt-transformation", "_blank", ); }}