From e62c2ed646b2be2d6b4dc3a17d0e97ae2b89404e Mon Sep 17 00:00:00 2001 From: RayPals Date: Mon, 1 Jun 2026 00:53:35 +0200 Subject: [PATCH] Add docs/V1_14_STATIC_TYPES.md from Claro v1.17.26 zip --- docs/V1_14_STATIC_TYPES.md | 84 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 docs/V1_14_STATIC_TYPES.md diff --git a/docs/V1_14_STATIC_TYPES.md b/docs/V1_14_STATIC_TYPES.md new file mode 100644 index 0000000..808c42a --- /dev/null +++ b/docs/V1_14_STATIC_TYPES.md @@ -0,0 +1,84 @@ +# Claro v1.14.26 Static Type Hardening + +Claro is still beginner-first. You can keep writing simple scripts like: + +```claro +SET name "Jon" +SAY name +``` + +v1.14.26 adds stronger type tools for learners who are ready for safer, larger programs. + +## Simple typed variables + +```claro +SET score NUMBER 10 +SET name TEXT "Jon" +SET ready YESNO YES +``` + +Claro remembers the type. If a variable starts as a `NUMBER`, Claro protects it from accidentally becoming text later. + +```claro +SET score NUMBER 10 +SET score "hello" +``` + +Friendly error: + +```text +score must be NUMBER, but got TEXT. +``` + +## Type checking before running + +Use: + +```bash +claro typecheck my_script.claro +``` + +Example: + +```claro +SET score NUMBER 10 +SET score "hello" +``` + +The type checker explains the mistake before the learner runs the program. + +## Type helper commands + +```claro +TYPE OF score AS kind +SAY kind + +CHECK TYPE score IS NUMBER +``` + +`TYPE OF` stores the visible type name as text. + +`CHECK TYPE` stops the script if the value is not the expected type. + +## Typed input + +```claro +ASK "How old are you?" age NUMBER +ASK "Are you ready?" ready YESNO +``` + +Claro converts `NUMBER` input into a number and `YESNO` input into `YES` or `NO`. + +## Supported simple types + +```text +NUMBER +TEXT +YESNO +LIST +MAP +OBJECT +ANY +``` + +This is not the final complete type system. It is the safe beginner foundation for stronger static checking in later v1 releases.