- Fix fn.call documentation to clarify that extra arguments are discarded
rather than causing a runtime error
- Correct list.insert example output from "[a, e, c, d]" to "[a, e, b, c, d]"
to accurately reflect insertion behavior
The wren_meta.h header included <stdio.h>, "wren_value.h", and "wren_vm.h"
which were not required for its declarations. These headers are already
included transitively through "wren.h" and "wren_common.h", making the
explicit includes redundant. Removing them reduces unnecessary
dependencies and potential circular inclusion issues.
Extract file path construction into `wrenFilePath` helper and modify `readModule` to first attempt loading the module as a `.wren` file. If that fails, treat the module name as a package directory and try to load `module.wren` from within it. Add test files `module_package/module.wren` and `package_module.wren` to verify the new package resolution behavior.
The comment previously stated that a leading space prevents direct calls,
but the actual mechanism uses angle brackets in the method name "<instantiate>"
to make it inaccessible from user code.
Replace TODO stubs with actual errno checks in readHexNumber, readNumber, and num_fromString to emit a "Number literal is too large." error when strtol/strtod overflow. Add three test files (literal_too_large.wren, hex_too_large.wren, from_string_too_large.wren) verifying compile-time and runtime error behavior for out-of-range numeric inputs.
Add test cases for Num.fromString covering leading/trailing whitespace (" 12 "),
numeric prefix with trailing non-numeric characters ("1.2prefix"), empty string,
non-numeric prefix ("prefix1.2"), and a runtime error test for non-string argument
(Num.fromString(1)).
Implements a new `fromString` static method on the `Num` class that attempts to parse a string as a decimal number literal using `strtod`. Returns the parsed `Num` value on success, or `null` if the string does not represent a valid number. Includes runtime validation that the argument is a string, and adds test coverage for positive, negative, zero, and decimal inputs as well as non-numeric strings.
Implement equality comparison for Range objects by defining `range_eqeq` and `range_bangeq` native methods that delegate to `wrenValuesEqual`. Register both operators on the Range class in `wrenInitializeCore` and add a comprehensive test suite in `test/range/equality.wren` covering inclusive/exclusive ranges and cross-type inequality checks.
Remove the TOKEN_HEXADECIMAL token type and isHexDigit helper, replacing them with a readHexDigit function and readHexNumber parser that directly converts hex literals to numeric values during lexing. Add a `number` field to the Parser struct to hold the parsed value, and include a test for invalid hex literal error handling.
Add TOKEN_HEXADECIMAL token type and isHexDigit helper function to lexer.
Modify readNumber to detect 'x' prefix after '0' and lex hex digits.
Implement emitNumericConstant for hex values in compiler.
Add test file test/number/hex_literals.wren verifying basic hex parsing,
arithmetic, type checks, and negative hex literals.
Add `join` and `join(sep)` methods to the `Sequence` class, allowing any sequence to produce a concatenated string of its elements with an optional separator. Refactor `List.toString` to delegate to `join(", ")` with bracket wrapping, removing the manual iteration logic from List. Include new test files for List, Range, and String join behavior, plus runtime error tests for non-string separators.
Extract range validation logic from list_subscript into a reusable calculateRange function that handles inclusive/exclusive bounds, negative indices, and direction stepping. Add CalculatedRange struct to wren_core.h and implement string subscripting via the new helper, including comprehensive test coverage for forward, backward, negative, and half-negative ranges with proper error messages for out-of-bounds and non-integer values.
Add test case verifying that `forall` returns true for an empty list regardless of predicate, and add two new test files covering runtime errors when `forall` receives a non-boolean-returning function or a non-function argument. Also refactor the `forall` implementation to use logical negation (`!`) instead of explicit `!= true` comparison.
Implement a `forall` method on the Sequence class that takes a predicate function and returns true only if every element in the sequence satisfies the predicate. The method iterates through all elements, returning false immediately upon encountering any element where the predicate does not return exactly true. Includes core library documentation and a test file verifying behavior with numeric comparisons and non-boolean predicate returns.
Add helper functions `canonicalSymbol` and `methodArgumentsString` to extract and format the argument count from symbol names. Update the runtime error message in `runInterpreter` to append the arity (e.g., "with 0 arguments", "with 2 arguments", "with 1 argument") when a class does not implement a method. Add new test cases for missing methods with one, two, and eleven arguments, and update all existing test expectations to include the arity suffix.
Add a strcmp check against "\n" before invoking wrenInterpret in the
runRepl function, preventing an unnecessary interpretation attempt and
potential error handling for blank user input.