File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -829,6 +829,28 @@ pub fn capitalise(string: String) -> String {
829829
830830/// Returns a `String` representation of a term in Gleam syntax.
831831///
832+ /// This may be occasionally useful for quick-and-dirty printing of values in
833+ /// scripts. For error reporting and other uses prefer constructing strings by
834+ /// pattern matching on the values.
835+ ///
836+ /// ## Limitations
837+ ///
838+ /// The output format of this function is not stable and could change at any
839+ /// time. The output is not suitable for parsing.
840+ ///
841+ /// This function works using runtime reflection, so the output may not be
842+ /// perfectly accurate for data structures where the runtime structure doesn't
843+ /// hold enough information to determine the original syntax. For example,
844+ /// tuples with an Erlang atom in the first position will be mistaken for Gleam
845+ /// records.
846+ ///
847+ /// ## Security and safety
848+ ///
849+ /// There is no limit to how large the strings that this function can produce.
850+ /// Be careful not to call this function with large data structures or you
851+ /// could use very large amounts of memory, potentially causing runtime
852+ /// problems.
853+ ///
832854pub fn inspect ( term : anything) -> String {
833855 do_inspect ( term )
834856 |> string_tree . to_string
You can’t perform that action at this time.
0 commit comments