Skip to content

Commit 70db5d0

Browse files
Update README.md for 0.16.0 release
1 parent 8e40254 commit 70db5d0

File tree

1 file changed

+56
-6
lines changed

1 file changed

+56
-6
lines changed

README.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,32 @@ https://tea-age.solutions/downloads/<br>
1616
Also, a Library bundle with more example scripts is available in the download section as well.
1717

1818
# About TeaScript
19-
**What is new in TeaScript 0.15.0?** TeaScript 0.15 comes with a Web Server / Web Client module preview, full JSON read/write support and more.<br>
19+
**What is new in TeaScript 0.16.0?** TeaScript 0.16 comes with a distinct Error type, a catch statement, default shared params, BSON support and more.<br>
20+
<br>Get all infos in the **latest blog post**:<br>
21+
https://tea-age.solutions/2025/12/22/release-of-teascript-0-16-0/ <br>
22+
<br>**What was new in TeaScript 0.15.0?** TeaScript 0.15 comes with a Web Server / Web Client module preview, full JSON read/write support and more.<br>
2023
<br>**Watch the web feature demo on YouTube:** <br>
2124
https://youtu.be/31_5-IrHcaE <br>
22-
<br>Get all infos in the **latest blog post**:<br>
25+
<br>Read all infos in the corresponding blog post:<br>
2326
https://tea-age.solutions/2024/09/01/release-of-teascript-0-15-0/ <br>
2427

25-
## Summary of the latest release
28+
## Summary of the last releases
29+
### TeaScript 0.16.0
30+
- a new and distinct **Error** type
31+
- a **catch** statement similar as in and highly inspired by [Zig](https://ziglang.org/documentation/master/#catch).
32+
- Function parameters are **shared assign** by default now.
33+
- experimental **BSON** support.
34+
### TeaScript 0.15.0
2635
- **Web module** as a preview for **http client / server** functionality with enhanced build-in **JSON** support.
2736
- Full **JSON** support for read and write operations (String/File ⟷ (Named) Tuple).
2837
- Provided C++ JSON adapter for nlohmann::json, RapidJSON, Boost.Json and PicoJson.
2938
- Added missing write support for TOML (now TOML is complete as well).
3039
- Import/export of C++ JSON / TOML objects from/to ValueObject of TeaScript (as a Named Tuple)
3140

32-
### Example Files for the latest release
33-
[web_client.tea](demo/web_client.tea), [web_server.tea](demo/web_server.tea), [JSON Support UniTest](demo/corelibrary_test05.tea), [Json C++ Import/Export](https://github.com/Florian-Thake/TeaScript-Cpp-Library/blob/6a7f348a7d8c959187b6f7ddcb5ed0c4e0e092c9/demo/teascript_demo.cpp#L90)
41+
### Example Files for the last releases
42+
[web_client.tea](demo/web_client.tea), [web_server.tea](demo/web_server.tea), [JSON Support UnitTest](demo/corelibrary_test05.tea), [Json C++ Import/Export](https://github.com/Florian-Thake/TeaScript-Cpp-Library/blob/6a7f348a7d8c959187b6f7ddcb5ed0c4e0e092c9/demo/teascript_demo.cpp#L90), [Error and Catch UnitTest](demo/corelibrary_test06.tea), [Catch and BSON example](demo/example_v0.16.tea)
43+
44+
**Hint:** Better syntax highlighting is on the TeaScript home page or in Notepad++ with the provided [SyntaxHighlighting.xml](TeaScript_SyntaxHighlighting_Notepad%2B%2B.xml)
3445

3546
## Example HTTP GET
3647
**Please, note:** The pre-compiled Windows and Linux packages of the TeaScript Host Application have this feature enabled by default (download link above).<br>
@@ -63,6 +74,43 @@ println( reply.json["User-Agent"] )
6374
// dot access possible as well!
6475
println( reply.json."User-Agent" )
6576
```
77+
## Example for convenient error handling with the new catch statement
78+
```cpp
79+
// _strtonum returns an Error if the String cannot be parsed to an integer.
80+
// Here catch is used for yielding default values on error.
81+
def x := _strtonum( "3" ) catch -1 // no Error, x is 3
82+
83+
def y := _strtonum( "xyz" ) catch -1 // Error, y is -1
84+
85+
// catch can be chained
86+
def z := _strtonum( "xyz" ) catch _strtonum( "3" ) catch -1 // z is 3
87+
88+
89+
// catch the error and do sth. with it.
90+
def a := _strtonum( "uvw" ) catch( err ) {
91+
println("Error: %(err)\nReturning default: 100!" )
92+
100
93+
}
94+
95+
// catch can be used for early return on errors
96+
func test(s1, s2)
97+
{
98+
def n1 := _strtonum( s1 ) catch( err ) return err
99+
def n2 := _strtonum( s2 ) catch( err ) return err
100+
if( n2 == 0 ) { return "n2 is zero!" as Error }
101+
102+
// reaching here only if no Error occurred!
103+
n1 / n2
104+
}
105+
106+
def baz := test( "4", "2" ) // baz is 2
107+
def foo := test( "10", "xyz" ) // foo is Error
108+
109+
// handle error by exiting script
110+
def bar := test( "qwert", "2" ) catch (err) {
111+
fail_with_message( err ) // prints err and exit
112+
}
113+
```
66114

67115
## General information
68116
Get a very nice overview with the most **impressive highlights** here:<br>
@@ -363,7 +411,7 @@ All compilers are compiling in **C++20** and for **x86_64**.<br>
363411
364412
**None** -- for fully C++20 supporting compilers / C++ standard libraries.
365413
366-
**Libfmt (as header only)** -- for gcc 11 / clang 14 (tested with **libfmt 11.0.2**, **libfmt 10.2.1** and **libfmt 10.1.1**)<br>
414+
**Libfmt (as header only)** -- for gcc 11 / clang 14 (tested with **libfmt 11.1.4**, **libfmt 11.0.2**, **libfmt 10.2.1** and **libfmt 10.1.1**)<br>
367415
- Libfmt can be downloaded here https://fmt.dev/latest/index.html <br>
368416
You only need to set the include path in your project(s) / for compilation. Detection is then done automatically.
369417
@@ -393,6 +441,8 @@ For use a different adapter you must do the following steps:<br>
393441
3.) Add include for the json library of use, e.g., <rootpath>/nlohmann_3.11.3/single_inlude/<br>
394442
4.) Set the define TEASCRIPT_JSON_FLAVOR to the desired Json flavor, e.g., TEASCRIPT_JSON_NLOHMANN<br>
395443
444+
**BSON Support** - Currently BSON support is only available if the used JsonAdapter is nlohmann::json (see above how to change).
445+
396446
# Building the demo app
397447
398448
**Windows:** Use the provided VS-project or the settings in compile.props.

0 commit comments

Comments
 (0)