Functions were already objects (they carry a member table + vtable, so
`_doc_` and any attribute already worked). What was missing was a way
to turn a chunk table into a *function value* rather than just running
it: `bc_run` builds a prototype, runs it and frees it.
- build.c: new `bc_fn(chunk)` returns a real closure built from the
chunk. It can be stored, passed around, given attributes and called
later, exactly like a compiler-produced closure.
- function.{h,c}: `cat_types_function_new_owned()` so a closure built
at runtime owns (and frees) its prototype; compiler-produced closures
still do not (proto is owned by the module/bytecode tree).
- tests/bc.cat: type/name/call/hof + injecting `_doc_` on the built
function; wired into the suite (98 total, all green).
- REPL now runs every line on the SAME vm, so 'x = 50' then 'x'
persists across lines (was re-creating a vm per line)
- a lone expression echoes its value (new PRINTEXPR opcode), and a
call yielding no value (the empty object) is not echoed
- compiler: cat_compiler_compile_mode(src, err, repl) emits PRINTEXPR
for a lone expression in REPL mode
- _repr_ protocol: cat_value_repr honours a member (text value
used verbatim, or a callable invoked with the value as self); a
default by family otherwise. tostring is the display form (text
unquoted); the REPL echo is the repr form (text quoted)
- list/object default representations ([a, b], {k = v})
- tests: tests/repr.cat + REPL checks (92 total, all green)
- delete the nil type; catscript has no nil and no null
- add the empty object (Object with no members), exposed as the global
'empty'; it is a shared immutable singleton
- 'nil' is no longer a keyword: it is an undefined global, which raises
- undefined global -> error (consistent with a missing attribute)
- only 'false' is falsy (numbers/objects are truthy); booleans kept
- OP_NIL -> OP_EMPTY; compiler, VM, stdlib, toml, ffi, generator, file,
list, selector, value all migrated
- rename the table type to Object
- std/ front-end and examples/tests migrated to 'empty'
- 84/84 tests
- CAT_TYPES_FUNCTION_Closure gains an attrs table; get/set_attribute
give closures real members, so a function can hold _doc_ and any other
attribute like a table
- cat_types_function_attrs() accessor; attributes() enumerates a
closure's members; help() reads a function's _doc_
- compiler: generalise dotted assignment to chains (name.a.b = v), so a
method can be documented (Calc.add._doc_ = ...)
- tests/functions_as_objects.cat + 7 assertions (84 total, all green)
- README: 'funcoes tambem sao objetos' + reflection sections
- new list type (iterable, indexable) backing attributes()
- attributes(obj): member names of a table/object, follows __index
inheritance, includes native and slot members (like Python dir())
- help(obj): prints the value's _doc_ documentation, else its type
and attributes
- natives carry an optional _doc_ string (cat_types_native_new_doc);
stdlib builtins documented
- len() handles lists
- examples/reflect.cat + 8 assertions wired into run_tests.sh (77 total)
- std/ layout: std/lang/{lexer,parser,checker,compiler}.cat moved from src/catscript
- std/io/io.cat, std/fs/fs.cat, std/math/math.cat modules
- use "path.cat": import another unit (compile+run in the same VM)
- class NAME [extends BASE] ... end: methods, inheritance via __index,
default new constructor (runs optional init), tables are callable
- examples/classes.cat, tests/std.cat; 48/48 tests
- Modelo de objetos Cat_Value + vtable (interfaces abstratas)
- VM de bytecode, sem GIL (VM por-thread, nativas como valores)
- Stdlib com TOML embutido (toml_parse/toml_encode)
- Família de arquivos: AbstractFile (abstrata), File::open, StringIO, BytesIO
- Front-end (lexer/parser/checker/compiler) implementado em catscript
- cpk (cat package manager) como primeiro programa; manifest package.toml
- Type hints advisory, inclusive DynSized() e sentinel_sized<...>
- 25/25 testes passando (make test)