From 45e4a854b2832e1a416527d5bbbce1af438bbd8f Mon Sep 17 00:00:00 2001 From: Martin Janiczek Date: Sun, 15 Dec 2024 14:10:25 +0100 Subject: [PATCH 1/2] Warn about unexpected behaviour of io.debug --- src/gleam/io.gleam | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gleam/io.gleam b/src/gleam/io.gleam index 4487a601..d55599b7 100644 --- a/src/gleam/io.gleam +++ b/src/gleam/io.gleam @@ -89,6 +89,8 @@ pub fn println_error(string: String) -> Nil /// // [2, 3] /// ``` /// +/// Note: At runtime Gleam doesn't have type information and uses runtime reflection to print the values. This can result in some values being shown in an unexpected way. +/// pub fn debug(term: anything) -> anything { term |> string.inspect From f7e2174e242ddb8dc0068ac6671cf32d914ccd05 Mon Sep 17 00:00:00 2001 From: Martin Janiczek Date: Thu, 19 Dec 2024 19:20:15 +0100 Subject: [PATCH 2/2] Update the note --- src/gleam/io.gleam | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gleam/io.gleam b/src/gleam/io.gleam index d55599b7..ec73ece7 100644 --- a/src/gleam/io.gleam +++ b/src/gleam/io.gleam @@ -89,7 +89,9 @@ pub fn println_error(string: String) -> Nil /// // [2, 3] /// ``` /// -/// Note: At runtime Gleam doesn't have type information and uses runtime reflection to print the values. This can result in some values being shown in an unexpected way. +/// Note: At runtime Gleam doesn't have type information anymore. This combined +/// with some types having the same runtime representation results in it not +/// always being possible to correctly choose which Gleam syntax to show. /// pub fn debug(term: anything) -> anything { term