From 59845e610f2c90474f34079d27b5f1e07071ded4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 6 Apr 2025 13:40:17 -0400 Subject: Deprecate `!!` print statement --- examples/http-server/http-server.tm | 2 +- examples/http/http.tm | 14 +++++++------- examples/ini/ini.tm | 4 ++-- examples/learnxiny.tm | 3 --- examples/tomodeps/tomodeps.tm | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) (limited to 'examples') diff --git a/examples/http-server/http-server.tm b/examples/http-server/http-server.tm index 56ba3683..1a09b601 100644 --- a/examples/http-server/http-server.tm +++ b/examples/http-server/http-server.tm @@ -138,7 +138,7 @@ func load_routes(directory:Path -> {Text=RouteEntry}): func main(directory:Path, port=Int32(8080)): say("Serving on port $port") routes := load_routes(directory) - !! Hosting: $routes + say(" Hosting: $routes") serve(port, func(request:HTTPRequest): if handler := routes[request.path]: diff --git a/examples/http/http.tm b/examples/http/http.tm index ce74d010..12d9978e 100644 --- a/examples/http/http.tm +++ b/examples/http/http.tm @@ -97,17 +97,17 @@ func delete(url:Text, data:Text?=none, headers=["Content-Type: application/json" return _send(DELETE, url, data, headers) func main(): - !! GET: + say("GET:") say(get("https://httpbin.org/get").body) - !! Waiting 1sec... + say("Waiting 1sec... sleep(1) - !! POST: + say("POST:") say(post("https://httpbin.org/post", `{"key": "value"}`).body) - !! Waiting 1sec... + say("Waiting 1sec...") sleep(1) - !! PUT: + say("PUT:") say(put("https://httpbin.org/put", `{"key": "value"}`).body) - !! Waiting 1sec... + say("Waiting 1sec...") sleep(1) - !! DELETE: + say("DELETE:") say(delete("https://httpbin.org/delete").body) diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm index d67dd0d5..cee33f3c 100644 --- a/examples/ini/ini.tm +++ b/examples/ini/ini.tm @@ -41,7 +41,7 @@ func main(path:Path, key:Text?): data := parse_ini(path) if keys.length < 1 or keys[1] == '*': - !! $data + say("$data") return section := keys[1]:lower() @@ -50,7 +50,7 @@ func main(path:Path, key:Text?): Valid names: $\[1]$(", ":join([k:quoted() for k in data.keys]))$\[] ") if keys.length < 2 or keys[2] == '*': - !! $section_data + say("$section_data") return section_key := keys[2]:lower() diff --git a/examples/learnxiny.tm b/examples/learnxiny.tm index 7373f057..ecb1140f 100644 --- a/examples/learnxiny.tm +++ b/examples/learnxiny.tm @@ -9,9 +9,6 @@ func main(): # Print to the console say("Hello world!") - # You can also use !! as a shorthand: - !! This is the same as using say(), but a bit easier to type - # Declare a variable with ':=' (the type is inferred to be integer) my_variable := 123 diff --git a/examples/tomodeps/tomodeps.tm b/examples/tomodeps/tomodeps.tm index 8c75173a..c6c2171e 100644 --- a/examples/tomodeps/tomodeps.tm +++ b/examples/tomodeps/tomodeps.tm @@ -13,7 +13,7 @@ enum Dependency(File(path:Path), Module(name:Text)) func _get_file_dependencies(file:Path -> {Dependency}): if not file:is_file(): - !! Could not read file: $file + say("Could not read file: $file") return {} deps : @{Dependency} = @{} -- cgit v1.2.3