UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

761 lines (752 loc) 119 kB
# Release notes All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). ## 2.4.0 - Expanded MATLAB/Octave conformance coverage across parser, AST, dispatch, and runtime semantics, including command-form parsing, source resolution, function-call defaults, return-list handling, `arguments` validation, object/class dispatch, and native helper behavior. - Strengthened multidimensional array compatibility over MathJSLab's page-stacked storage model, covering N-D slicing, assignment, expansion, deletion, logical subscripts, cell contents, comma-separated lists, and structure/cell conversion order. - Broadened core runtime and built-in helper semantics for dimension metadata, sparse API placeholders, structure helpers, indexing helpers, and MATLAB/Octave-compatible validation paths while keeping sparse storage itself intentionally virtual. - Tightened runtime/AST type boundaries and module architecture, keeping parser-only carriers out of runtime storage, preserving source metadata for browser-hosted `.m` files, and maintaining the no-circular-dependency release gate. - Refreshed focused JSDoc comments, parser/AST compatibility notes, language subset documentation, and release-facing conformance fixtures. ## 2.3.0 - Tightened generated parser return types for identifiers, function definitions, and matrix literals, and cleaned related AST factory narrowing in preparation for removing the remaining broad `NodeExpr` compatibility carrier. - Narrowed generated parser return types for primary lexical expression forms, including strings, numbers, `end`, colon/tilde magic nodes, function handles, and metaclass literals. - Replaced the generated parser's remaining `NodeExpr` rule contracts with grammar-local expression-family aliases, keeping generic expression compatibility out of the ANTLR output. - Added the `RuntimeExpressionValue` AST contract and centralized expression-boundary validation through `AST.isExpressionBoundaryValue`. - Moved value-oriented function validation onto the `RuntimeExpressionValue` contract, with core type predicates normalizing optional inputs before invoking shared validators. - Tightened user-function and anonymous-function argument binding so evaluated positional, name-value, default, and `varargin` values pass through the shared expression-boundary contract before entering function workspaces. - Narrowed `arguments`-block runtime validation so size, class, `mustBe*`, repeating, and name-value values distinguish expression-boundary carriers from concrete runtime values before validation. - Fixed singleton return-list wrapping so requesting a second output from a single-valued expression reports the MATLAB/Octave-style undefined return-list element instead of an internal unreachable-branch error. - Added interpreter-side runtime-value validation before storing evaluated values in structure fields, including ordinary dot assignment, descriptor `subsasgn`, nested object field updates, and function name-value option structs. - Typed scalar structure fields as concrete runtime values, keeping `null` and `undefined` out of structure storage while preserving `[]` as the MATLAB-like empty value. - Narrowed interpreter-created structure maps for function-handle workspace metadata and Set/Get object property snapshots to concrete structure field values. - Aligned `MultiArray`'s structural view of structure fields with the same non-null field-value contract, while preserving `null`/`undefined` as internal array/cell construction slots. - Tightened indexed assignment RHS preparation so scalar values stored through native array, cell, and brace-assignment paths are narrowed to concrete runtime values before entering `MultiArray` storage. - Narrowed workspace initializer paths so `assignin`, `global = value`, and `persistent = value` store concrete runtime values rather than broader expression carriers. - Typed per-function persistent storage as `RuntimeExpressionValue` and reject non-runtime workspace carriers before saving persistent variables back to a function definition. - Typed class-instance property storage and public event-data fields as `RuntimeExpressionValue`, with runtime guards preventing AST-only carriers from being stored in object property state. - Typed resolved class-enumeration constructor arguments as `RuntimeExpressionValue`, so enumeration values do not retain parser-only AST carriers after member resolution. - Tightened public class metadata properties so `meta.*` objects expose `RuntimeExpressionValue` data, with parser-only property defaults rendered as expression text instead of leaking AST nodes through `DefaultValue`. - Split runtime workspace writers from general scope storage so `assignin` and persistent-variable loading can only write concrete runtime values, while the broader scope name table remains available for parser and definition nodes. - Narrowed `arguments`-block and class-property size/function validator lists from generic AST inputs to expression-boundary values, matching the AST factory guards that build those validation nodes. - Narrowed factory-built index, superclass-constructor, and class-enumeration argument arrays to expression-boundary values, matching the AST factory guards that accept those expression slots. - Aligned function-call, class-constructor, method-dispatch, and indexing argument contracts across `FunctionArguments`, `FunctionCall`, `Context`, and `Interpreter` so AST-normalized call arguments use expression-boundary values instead of broader legacy expression arrays. - Updated architectural boundary tests to track the new call-argument contracts, avoiding stale source-signature expectations during the full build. - Carried expression-boundary call-argument typing through call frames, function-stack metadata, `inputname`, and class-operator overload dispatch. - Added regression coverage for `mfilename("fullpath")` inside host-provided external class method files, including local subfunctions sharing the same virtual `@Class/method.m` source identity. - Extended `dbstack` frame structures to report browser-hosted virtual source file names when loaded function files or external class method files provide a `sourceName`. - Extended `functions(handle).file` metadata for named and nested user function handles so host-provided function files report their virtual `sourceName` instead of always returning an empty file field. - Added diagnostic regressions proving that `catch ME` and `lasterror` public stack structures preserve virtual source file names from browser-hosted function files and their local subfunctions. - Inferred virtual `sourceName` metadata from path-like source-table and provider keys such as `+pkg/f.m`, `@Class/method.m`, and `folder/script.m`, so hosts can use compact string entries without losing source introspection. - Aligned plain `mfilename()` for virtual `.m` files with the file basename while keeping `mfilename("fullpath")` tied to the complete virtual source identity. - Propagated host-provided script `sourceName` metadata to script-local functions, so `mfilename`, `dbstack`, `functions(handle)`, and captured local handles retain the surrounding virtual script file identity. - Propagated host-provided classdef `sourceName` metadata to inline methods, so class methods defined inside virtual class files report the class file through `mfilename`, `dbstack`, and public caught-error stack structures. - Propagated virtual function/method `sourceName` metadata into nested functions, keeping `mfilename` and `dbstack` aligned for nested code inside browser-hosted function files and inline class methods. - Added coverage for returned nested function handles from virtual function files, including `functions(handle).file` metadata and caught-error stack file names after the outer function has returned. - Normalized plain `mfilename()` for URL-like virtual source identities with query strings or fragments, while preserving the complete identity in `mfilename("fullpath")`. - Preserved path-derived virtual `sourceName` metadata in `ManifestSourceResolver.fromTable`, aligning preloaded in-memory source manifests with table-backed and fetch-backed resolver behavior. - Propagated virtual `sourceName` metadata into anonymous function handles, keeping `mfilename`, `dbstack`, and `functions(handle).file` aligned for closures created inside browser-hosted function files and scripts. - Preserved class-context metadata in anonymous function handles created inside instance and static methods, so returned closures keep `mfilename("class")` aligned with the defining class. - Tightened explicit import resolution so multiple same-scope imports for the same simple name are preserved as ordered candidates and produce a clear ambiguity error when more than one imported function or class resolves. - Validated `import` declarations so unqualified simple names are rejected and ambiguous wildcard imports report all resolving function/class candidates instead of picking one silently. - Added direct dispatch for explicitly imported static class methods such as `import pkg.Class.method; method(args)`, including access checks and ambiguity diagnostics across imported method candidates. - Extended `feval("method", ...)` to dispatch through explicitly imported static class methods, preserving the same access checks and ambiguity diagnostics as direct imported-method calls. - Extended function handles for explicitly imported static class methods, so `h = @method; h(args)`, `feval(h, ...)`, and arity introspection share the same imported-method dispatch path. - Preserved imported static-method bindings for `str2func("method")` handles created inside functions, and exposed those handles through `which(handle)` and `functions(handle)` metadata. - Resolved host-provided table entries by their virtual `sourceName` paths, so a source keyed internally as `f` but declared as `+pkg/f.m` can still be loaded through the qualified `pkg.f` name. - Indexed `ManifestSourceResolver.fromTable` entries by both their table keys and declared `sourceName` paths, covering preloaded function, script, and class sources bundled for browser execution. - Normalized URL-like virtual source paths with query strings or fragments for lookup while preserving the complete `sourceName` in `mfilename`, stack, and function-handle introspection metadata. - Allowed fetched manifest entries to use absolute URLs without prefixing the resolver `baseUrl`, while still deriving MATLAB/Octave package names from their virtual `.m` paths. - Added explicit `sourceName` support to fetched manifest entries, allowing hosts to fetch cache/CDN paths while exposing stable MATLAB/Octave virtual file names for lookup and introspection. - Resolved manifest-backed sources through the same canonical path, URL-like, and script-name candidates used when indexing manifests, so equivalent browser source names remain loadable after query/hash or separator changes. - Indexed explicit `name` metadata from source-table entries, allowing browser hosts to use cache-oriented keys while exposing stable canonical function, class, and script lookup names. - Added integration coverage for cache-keyed host function, class, and external method sources using explicit canonical `name` metadata, including imported dispatch, function handles, `exist`, `which`, and `mfilename` source identity checks. - Extended the parser and AST for MATLAB-style multi-attribute `arguments` blocks such as `arguments (Input,Repeating)`, preserving all block attributes while keeping the existing single-attribute compatibility field. - Routed `arguments (Input,Repeating)` through the existing repeating-input validation path. - Implemented `arguments (Output,Repeating)` call semantics for both `varargout` and MATLAB-style named repeating output variables, including requested-output validation of repeated return cells. - Distinguished cell literals from cell-indexing braces in the lexer, allowing spaced and multiline expressions such as `C{2*k - 1}` while preserving whitespace-separated cell literal elements. - Aligned class-property validation with function `arguments` validation for parametrized validators, so property references such as `{mustBeGreaterThan(x, 0)}` evaluate against the candidate property value. - Fixed compound assignments to structure fields, including nested fields, structure arrays, and indexed field chains such as `s.v(2) += 5`, so the operation uses the selected field value rather than the containing structure. - Extended prefix and postfix increment/decrement semantics from simple identifiers to assignable targets such as indexed arrays and structure fields, reusing the same assignment pipeline as `+=` and `-=`. - Returned copied assignment snapshots from mutable assignment targets, avoiding later structure or array mutations from changing previously produced statement results. - Preserved scalar results for compound assignment through descriptor chains, so nested cell targets such as `s.c{2} += 3` store `5` rather than `[5]`. - Distributed vectorized compound-assignment results across final brace descriptor targets, so nested selections such as `s.c{1:2} += [10,20]` update each selected cell content instead of storing duplicated vectors. - Added functional `clear(...)` built-in support on top of the existing command-form `clear`, including multiple names and `clear("functions")`. - Added command-form support for interpreter-owned `exist`, `warning`, and `dbstack`, reusing their existing functional semantics while preserving assignment parsing for variables named `exist`. - Added command-form `error` support, including identifier/message parsing for forms such as `error mathjslab:id message text`. - Allowed selected zero-argument built-ins (`mfilename`, `lastwarn`, `lasterr`, `lasterror`, and `localfunctions`) to be invoked without parentheses when no variable shadows the name. - Normalized primitive results returned by host-provided command-form functions into runtime values, so browser-integrated commands such as `help` can return plain strings, numbers, or booleans safely. - Evaluated MATLAB-style `spmd` worker specifications before running the sequential browser fallback body, so invalid or side-effecting worker expressions are no longer silently ignored. - Evaluated parenthesized `parfor` worker expressions once before the sequential browser fallback loop, preserving the stored AST worker expression while avoiding silent skips. - Validated sequential `parfor` and `spmd` worker-count expressions as nonnegative integer scalars, aligning the browser fallback with MATLAB's worker specification rules. - Rejected invalid `spmd(minWorkers,maxWorkers)` fallback headers when the minimum worker count exceeds the maximum worker count. - Exposed `spmdIndex` and `spmdSize` inside the sequential browser `spmd` fallback as local worker metadata, restoring any user variables with the same names after the block exits. - Tightened sequential `parfor` header semantics so the loop variable must be a simple identifier and the evaluated range must be a row vector of consecutive integer values, while preserving ordinary `for` targets and iteration rules. - Added static `parfor` body validation for the sequential fallback, rejecting MATLAB-incompatible constructs such as `break`, `return`, `global`, `persistent`, nested `parfor`, nested `spmd`, and assignments to the loop variable. - Narrowed the legacy scope parameter-binding helpers to expression-boundary values, keeping simple evaluated-argument storage aligned with the newer function-call pipeline. - Added shared runtime-expression boundary helpers and routed function argument validation plus interpreter runtime-storage checks through them, documenting the stricter boundary between expression carriers and concrete runtime data. - Reused the shared runtime-expression boundary for persistent-variable storage, class-instance property storage, and public `struct` field construction. - Tightened expression-boundary error callbacks to `never`, letting TypeScript narrow expression and runtime guards without local casts. - Added a non-throwing optional runtime-expression helper and reused it in predicate-style built-in checks and dimension-vector validation. - Kept `Context` comma-list expansion and built-in argument evaluation typed as expression-boundary values, avoiding an unnecessary widening back to the legacy expression-array carrier during call dispatch. - Recognized the declarative `array` class in shared function-parameter validation and removed an obsolete fixed-class table from `arguments` block handling, keeping user-defined class declarations on the dynamic validation path. - Tightened `arguments` block class validation for user-defined classes so object arrays must contain at least one matching class/enumeration element, preventing generic empty arrays from satisfying a class-specific declaration while still allowing classdef property defaults to use the implicit empty placeholder before a real value is assigned. - Aligned `isa` with object-array class semantics so homogeneous arrays of class instances report membership in their class or superclass rather than falling through as generic arrays. - Tightened class introspection helpers so object-array inputs must be non-cell arrays made entirely of class objects from the same class metadata, rejecting mixed arrays such as `[obj, 1]` instead of introspecting the first object and ignoring the rest. - Aligned the interpreter-owned `class` built-in with object-array semantics so homogeneous arrays of class instances or enumeration values report the object class name instead of the generic `array` classifier. - Registered the built-in `handle` superclass as a runtime class for interpreter-owned lookup helpers, aligning `isclass`, `exist(..., "class")`, and `which` with `isa(obj, "handle")`. - Tightened `str2func` validation so empty or whitespace-only function names fail immediately with a clear diagnostic instead of creating an unusable named function handle. - Tightened `builtin` and `feval` string-target validation so empty or whitespace-only function names fail before entering built-in lookup or function-handle dispatch. - Extended command-style `which` to accept word-list queries such as `which sin cos missing`, returning one lookup description per requested symbol while keeping the functional `which(...)` built-in scalar. - Tightened `nargin` and `nargout` function-target validation so empty or whitespace-only string names fail before attempting symbol resolution. - Aligned `functions(handle)` workspace metadata so simple named function handles do not expose interpreter closure state, while anonymous and nested handles still report their captured workspaces. - Tightened `exist(name, "builtin")` lookup so it consults the built-in table directly even when a user-defined or host-provided function source shadows the same name, and normalized whitespace around the `exist` kind selector. - Implemented class-aware `mfilename("class")` for instance and static class methods, using the interpreter's existing class-access context while keeping the browser-first file path behavior unchanged. - Preserved the public `ME.stack` payload through `rethrow(ME)`, so relaunching a caught error from another helper function keeps the original MATLAB/Octave stack instead of rebuilding it at the rethrow site. - Aligned scalar-output `deal` calls with MATLAB/Octave so `x = deal(a, b, c)` returns the first input while multiple-output calls still require matching input/output counts unless there is exactly one input value. - Added command-form `run script` and `source script [base|caller]` support on top of the browser-friendly virtual script source resolver, while preserving assignment parsing for variables named like command-form functions. - Extended assignment-preserving command-form parsing to built-in command names such as `clear` and `which`, and to host-provided command entries that explicitly opt into the same contract. - Added conservative formatted-message support to `warning` and `error`, including identifier/message forms and common `%s`, `%d`, `%i`, `%f`, `%g`, and `%%` conversions. - Split diagnostic message formatting into a dedicated helper with direct unit coverage, keeping `Interpreter` focused on dispatch and error-state updates. - Added interpreter-owned `warning("on"|"off"|"query", id)` state handling, including global suppression, identifier-specific suppression, `last` identifier targeting, MATLAB/Octave-style `lastwarn` updates for suppressed warnings, previous-state returns, state-structure restoration, and restart reset coverage. - Extended warning-state handling with the MATLAB/Octave `error` state, so selected warning identifiers or the global warning state can promote warnings to catchable errors while still updating `lastwarn`. - Made `warning()` and `warning("query")` return complete save/restore snapshots, including the global `all` state and all warning identifiers modified in the current interpreter session. - Added virtual source identity plumbing for browser-provided `.m` files: source entries can expose `sourceName`, manifest entries preserve their path, and `mfilename("fullpath")` reports that virtual identity for loaded function files and their private subfunctions. - Extended `lasterror` beyond simple queries with MATLAB/Octave-compatible `lasterror(err)` and `lasterror("reset")` forms, including default field normalization and previous-state returns. - Added the companion `lasterr` message/id query and setter API on top of the same last-error state used by `lasterror`, `catch ME`, and `rethrow`. - Centralized fixed-size lazy return-list validation with a shared AST helper and reused it across multi-output built-ins such as `find`, `sort`, `meshgrid`, `lu`, `qr`, and `eig`. - Tightened local multi-output helpers for `min`, `max`, `cummin`, and `cummax` so ignored outputs still validate excessive requested arity before values are selected. - Preserved MATLAB/Octave diagnostics for detached `:` and `end` nodes by guarding parent/index lookup through AST type guards instead of assuming parser-attached index parents. - Avoided class-method dispatch false positives for empty arrays, so empty `MultiArray` values fall back to ordinary indexing or undefined-function diagnostics instead of vacuous object-array method resolution. - Centralized comma-separated return-list metadata in `AST`, and routed context/interpreter return-list producers such as field expansion and `deal` through that shared constructor. ## 2.2.1 - Added the public `substruct` built-in for MATLAB/Octave-compatible subscript descriptor construction, including dot, parenthesis, and brace descriptors with validation and signature metadata. - Added public `subsref` and `subsasgn` built-ins backed by `substruct` descriptors, covering native array/cell/structure references and assignments plus class overload dispatch. - Extended explicit `subsref`/`subsasgn` descriptor handling for selected object-array elements and preserved comma-separated output lists for final brace descriptors such as `subsref(C, substruct('{}', {1:2}))`. - Tightened manual `subsref`/`subsasgn` descriptor validation, including operation-specific diagnostics and strict dot-descriptor shape checks, while covering explicit class `subsref` multiple-output dispatch. - Aligned descriptor-based brace indexing with direct indexing so explicit `subsref`/`subsasgn` reject `{}` on non-cell arrays. - Preserved structure-array comma-separated field lists for final public `subsref` dot descriptors such as `subsref(S, substruct('.', 'field'))`. - Aligned public and class-dispatch dot subscript descriptors with MATLAB/Octave so `substruct('.', 'field').subs` stores the field name directly while descriptor readers still tolerate legacy cell-wrapped dot payloads. - Allowed descriptor-based `subsasgn` to create structures from empty arrays when the assignment path begins with a dot descriptor, including nested fields and indexed field contents. - Aligned direct field assignment so ordinary `[]` roots can grow into structures through `S.field = value` and nested dot paths. - Fixed automatic cell-array expansion to fill new cells with empty arrays instead of numeric zeroes. - Extended linear expansion from ordinary `0x0` arrays for numeric, cell, and structure-field indexed assignments such as `A(3)=5`, `C{2}=8`, and `S(2).field=value`. - Corrected cell-array parenthesis assignment so `C(i) = {value}` stores the cell contents in `C`, while non-cell RHS values are rejected for existing cell-array targets. - Added implicit cell-array creation for undefined indexed assignments such as `C(2) = {value}` and `C{2} = value`, while rejecting cell RHS assignment into existing non-cell arrays. - Restored cell-array deletion through parenthesis indexing (`C(i) = []`) while preserving brace assignment of empty arrays as cell contents (`C{i} = []`). - Fixed indexed structure-field assignment so array-valued RHS values are stored as whole field values and nested field contents can be assigned or deleted via `S.field(i)=...`, `S(k).field(i)=...`, and cell-field variants. - Added `ExpressionBoundaryValue` as the typed result of expression-boundary validation, so `ExpressionValue` and AST factory helpers can expose `StrictNodeExpr | NodeList` instead of the broader legacy `NodeExpr` alias. - Relaxed function-handle node copy metadata to accept opaque runtime `copy` results, preserving anonymous function handles whose bodies are runtime expression values while keeping parent relinking centralized in `FunctionHandle`. ## 2.2.0 - Aligned release metadata for version 2.1.5 and regenerated the API reference after the parser/AST/runtime typing pass. - Documented the expression-boundary architecture in code and project docs, including the shared `ExpressionValue` helper used by function returns, comma-separated lists, `for` assignment lowering, indexing descriptors, and class dispatch paths. - Cleaned release-adjacent JSDoc coverage in runtime expression, assignment, class dispatch, and array helpers, while keeping larger numeric-kernel documentation cleanup as separate future maintenance. - Named the remaining broad `NodeExpr` compatibility edge as `LegacyNodeExprCarrier`, keeping `StrictNodeExpr` as the documented typed AST expression contract while parser-generated and legacy evaluator paths are migrated incrementally. Argument-validation defaults and function-handle bodies now model omitted expressions with explicit `null` unions. - Added focused AST guards for command-form calls, superclass constructor calls, range/colon/end nodes, runtime expression values, and the aggregate `StrictNodeExpr` contract to support safer parser/evaluator migrations. - Tightened class metadata rendering around the strict expression guard so validation displays only recognized expression/list forms, while evaluated property defaults keep the broader `NodeInput` contract used by runtime meta objects. - Removed the remaining class metadata circular dependency by making class member definitions generic over their owning class type and specializing them in the runtime modules that work directly with `ClassDefinition`. - Tightened the default owner type of generic class member metadata from `any` to `unknown`, keeping runtime modules explicitly specialized with `ClassDefinition`. - Made circular dependency checks a hard architectural gate: `test:circ` now fails the build when `madge` detects cycles. - Reused AST guards in function workspace and argument validation paths: `inputname` now recognizes identifiers through `AST.isNodeIdentifier`, and implicit custom validators only build calls from strict expression values. - Guarded lazy function return-list construction so fixed returns and `varargout` entries must be strict expression values or explicit `NodeList` execution-result carriers before they are exposed to callers. - Reused the same return-expression boundary in context lazy return-list helpers so class dispatch and direct value-return paths reject control-flow statements before exposing outputs to callers. - Routed scalar class-dispatch result arrays through the same guarded return boundary, removing the remaining unchecked `NodeExpr` casts from those paths. - Routed comma-list argument expansion through a shared expression-value guard so evaluated positional arguments reject control-flow nodes before reaching built-in, function, indexing, and class-dispatch helpers. - Guarded interpreter-owned comma-separated return lists so struct/cell field expansion and built-in helper results cannot expose control-flow statements as ordinary returned values. - Guarded scalar and row-vector `for` loop iteration values so evaluated loop expressions cannot expose control-flow statements as ordinary assignments. - Centralized evaluated expression-boundary checks in a shared helper used by function returns, context argument/return expansion, interpreter-owned comma-separated lists, and `for` loop iteration values. - Routed control-flow expression evaluation through an interpreter-owned boundary for `if`, `switch`, `while`, `do-until`, and `for`, validating reduced expression results before boolean conversion, case comparison, or iteration expansion. - Extended that evaluated-expression boundary to operator operands, ranges, `end`/colon index resolution, and indexed-expression receivers. - Routed class constant defaults, enumeration constructor arguments, lazy `meta.property.DefaultValue` evaluation, and name-value `arguments` defaults through the same evaluated-expression boundary. - Routed evaluated index arguments, class `subsref`/`subsasgn` descriptor payloads, dynamic field names, and `arguments` validation expressions through the shared interpreter expression boundary. - Routed parenthesized expressions, assignment RHS values, compound-assignment results, declaration defaults, dot receivers, and superclass receivers through the same evaluated-expression boundary. - Added a separate interpreter execution-result boundary for block execution, textual evaluation, forward-reference solving, and control-flow bodies, so expression validation and statement execution no longer share anonymous return-list reduction sites. - Added a focused architecture regression test to keep direct evaluator return-list reduction confined to the named interpreter boundary helpers. - Mirrored those evaluation boundaries in `Context`, routing function-call arguments, defaults, class default construction, method receivers, lambda inputs/results, and function bodies through named context helpers while preserving raw evaluation for comma-separated-list expansion. - Centralized context built-in argument expansion through a shared helper that preserves comma-separated-list expansion before expression validation. - Centralized class-method return-list reduction in named `Context` and `Interpreter` helpers, including operator overloads, property accessors, `subsref`/`subsasgn`, `end`, and object-array method dispatch. - Centralized assignment-result reduction before storing values into names, structure fields, object properties, and event-listener fields. - Centralized scalar reductions for comma-list fallback expansion, class `numArgumentsFromSubscript`, and scalar indexing/dispatch selections. - Extended architecture tests to cap `Context` and `Interpreter` return-list reductions to their named semantic boundary helpers. - Added an explicit anonymous-function-handle type guard and used it in callable resolution, removing the remaining lambda-handle structural cast. - Replaced object-array functional method dispatch casts with an explicit class-instance element guard in `Context`. - Replaced function-handle casts in interpreter introspection built-ins with a shared evaluated function-handle argument guard. - Centralized textual function-handle parsing for `str2func`, `feval`, and arity introspection so those paths no longer call the built-in table through structural casts. - Added local opaque-node guards to `FunctionHandle` copy/link handling, removing its remaining structural casts without introducing an AST import. - Replaced internal `Structure` navigation casts with explicit nested-structure construction and structure-array guards. - Reworked core AST structural guards to read candidate node properties through validated reflection, removing residual guard-time casts from list, return list, command-call, indexing, superclass, and dot-reference predicates. - Reworked `RuntimeValue` structural predicates for copy, class-instance, and dimension detection through validated reflection, with regression coverage for malformed object and shape candidates. - Tightened `MultiArray` structure-array helpers with explicit object/field guards and validated runtime structure-factory results before field cloning. - Centralized `MultiArray` runtime structure creation and character-list detection behind local guards, removing casts from structure expansion and character concatenation paths. - Added a guarded numeric-element boundary for `MultiArray` logical conversion, complex-element scanning, and imaginary-part detection, with regression coverage for malformed runtime arrays. - Reused the `MultiArray` numeric-element boundary for numeric page slicing and flat-array extraction, and reused the character-list guard for character vector reconstruction. - Moved `arguments` block literal-size validation into a dedicated numeric-size helper, removing residual casts while preserving MATLAB/Octave diagnostics. - Routed additional interpreter textual built-ins and Set/Get name-list handling through shared character guards instead of direct casts, covering warnings, errors, class introspection, workspace evaluation, and script loading helpers. - Optimized `MultiArray.linearize` by filling a preallocated column-major result vector directly, avoiding per-column slice/map allocations while preserving the internal row-major page-stacked storage translation. - Refreshed release-adjacent JSDoc and compatibility docs for runtime boundaries, Set/Get helpers, argument-size validation, and `MultiArray` linearization semantics. - Added factory-time AST validation for command-word arguments, index expression arguments, and superclass constructor arguments so parser-created expression slots reject statement/block nodes before evaluation. - Extended factory-time AST validation to ranges, operator operands, and indirect-reference fields so more expression composites reject invalid AST shapes at construction time. - Added factory-time validation for `arguments` declarations and branch/loop expressions so control-flow factories reject statement/block nodes in condition, selector, target, default, and worker-count slots. - Added factory-time validation for function-handle bodies, class attribute values, class property defaults, and enumeration constructor arguments. - Replaced silent filtering with explicit factory-time validation for `arguments`, `switch`, classdef attribute/superclass/section lists, and class section attribute lists. - Added factory-time validation for function-definition return, parameter, `arguments` block, and body lists, plus anonymous function-handle parameter lists, so invalid parser nodes are rejected before registration/evaluation. - Added section-kind-aware validation for classdef bodies: properties, methods, events, and enumeration sections now reject members from the wrong section before class metadata construction. - Added factory-time validation for declaration entries, control-flow body lists, `try`/`catch`, `unwind_protect`, and `spmd` bodies/workers so block factories reject misplaced parser nodes before evaluation. - Added matrix/cell row validation so array constructors reject statement and block nodes before handing delayed expression elements to `MultiArray`. - Added factory-time validation for `arguments` and class-property size, class, and validator-function declarations. - Tightened `FunctionArguments` consumers to reject invalid AST metadata explicitly instead of silently filtering malformed parameter, return, block, or validation entries. - Tightened function-call layout and arity introspection helpers to reject malformed parameter/return metadata explicitly instead of silently ignoring invalid entries. - Updated class method metadata so `meta.method.InputNames` includes defaulted function-header parameters instead of reporting only bare identifier parameters. - Tightened class member collection so `ClassDefinition` rejects structurally invalid section members explicitly instead of silently skipping malformed entries. - Routed constructor and property accessor signature checks through validated method-header helpers so malformed class method parameters/returns are rejected explicitly before special-method validation. - Validated variadic arguments forwarded by `builtin` and `feval` before dispatch so internal non-expression values cannot cross those call boundaries. - Routed class event callbacks and special method dispatch (`subsref`, `subsasgn`, property setters, operator overloads, `end`, and `numArgumentsFromSubscript`) through the same expression-boundary guard. - Guarded `Context.resolveIdentifier` so malformed symbol-table values cannot be exposed as ordinary identifier expressions by unchecked casts. - Extended expression-boundary helpers to validate unknown values directly and used them when expanding cell-indexing results into comma-separated return lists. - Guarded object-array field assignment values before linearization so invalid runtime elements cannot be distributed into class property assignments. - Added an explicit native indexing boundary through `IndexArgument` and `MultiArray.indexArguments`, so array/cell/string indexing rejects non-numeric subscript values before they enter the low-level indexing engine. - Routed direct, compound, descriptor-based, and object-array indexed assignment paths through evaluated index arguments instead of raw AST subscript nodes. - Reused the same evaluated-index boundary when expanding cell-content assignment targets such as `[C{idx}] = ...`, preserving comma-separated-list assignment semantics with computed index vectors. - Added MATLAB/Octave-compatible `deal` support for comma-separated output distribution, including singleton-input replication, positional multi-input distribution, arity diagnostics, and `nargin`/`nargout` metadata. - Relaxed interpreter-owned comma-separated return-list inputs to `unknown[]` and validated them at selection time, removing unchecked casts from class and structure field expansion paths. - Validated implicit class method receiver arguments and native `subsasgn` descriptor subscripts before forwarding them into function-call and indexing execution paths. - Added validated copy helpers for `for` assignment values and assignment target cloning so malformed runtime/AST values cannot enter assignment lowering through recursive copy paths. - Validated `builtin` and `feval` control arguments before resolving call targets, so malformed internal values fail with expression-boundary diagnostics instead of unchecked casts. - Added an interpreter-owned expression-list guard for structure-field list expansion, dot subscript descriptors, and event callback dispatch. - Validated nested assignment result lists before returning assigned values from embedded assignment expressions, and guarded linearized cell-assignment indices without unchecked expression casts. - Validated boolean control arguments before converting them to runtime booleans, starting with the optional `inputname` flag. - Tightened `for` loop value expansion so structure field values and generated column/field iteration values pass through expression-boundary validation instead of relying on casts. - Routed legacy class-property default expressions through the AST factory expression guard before building the underlying `arguments` declaration. - Removed the unnecessary `NodeExpr` cast from empty `varargout` cell initialization, relying on the `MultiArray` slot contract that already permits `undefined` placeholders. - Named and validated the unresolved call-target placeholder path in `Context.resolveIdentifier`, so only identifier nodes survive late call dispatch as unresolved function targets. - Routed interpreter copy and assignment-target cloning results back through the expression boundary, removing unchecked `NodeExpr` casts from those central evaluator paths. - Guarded `switch` scalar normalization and cell-array case alternatives so malformed non-expression values cannot reach MATLAB/Octave-style case comparison. - Widened context return-expression validation to accept unknown scalar-array contents directly, removing the remaining unchecked return-array cast from that lazy class-dispatch result path. - Routed native subscript scalar results through the expression boundary, so malformed structure fields or indexed array elements cannot cross chained `subsasgn`/`subsref` helper paths as ordinary values. - Copied function-handle workspace metadata through the generic runtime copy helper and expression boundary, preventing malformed captured values from being exposed by `functions(handle).workspace`. - Added a validated expression linearization helper and used it for `for` loop multi-target assignment lowering, avoiding the generic `MathObject` cast while rejecting malformed sequence elements earlier. - Routed interpreter expression copying directly through `RuntimeValue.copy`, removing the remaining `MathObject` cast from assignment and `for` lowering copy helpers. - Removed the remaining unchecked runtime-value casts from `Interpreter` assignment-target cloning after validating cloned `MultiArray` target elements through the existing expression boundary. - Removed redundant `ElementType` casts from `Structure` construction and copy paths, relying on the generic `RuntimeValue.copy` type contract and extending coverage for copied constructor fields. - Refactored anonymous `FunctionHandle` AST-node copying into separate node and nested-value helpers, removing broad `unknown` casts while preserving parent relinking for copied lambda parameter/body nodes. - Expanded structure-field comma-separated targets on the left side of multiple assignment, so `[S.field] = ...`, `[S(:).field] = ...`, and indexed structure selections request and distribute one RHS output per selected structure element. - Extended the same multiple-assignment target expansion to class instance arrays, including direct, indexed, colon, and nested property targets such as `[objs.x] = ...`, `[objs(:).x] = ...`, and `[objs.child.x] = ...`. - Kept indexed object-array property chains on the class-property assignment path instead of the native chained `subsasgn` fallback, fixing nested targets such as `objs(2).child.x = ...` and `[objs(idx).child.x] = ...`. - Added native public `subsasgn` handling for class property chains when no class overload is present, covering scalar objects, object arrays, indexed selections, and nested descriptors such as `substruct('.', 'child', '.', 'x')`. - Added native public `subsref` handling for class property chains when no class overload is present, including scalar objects, object arrays, indexed selections, nested descriptors, and comma-separated outputs from the final property in a chain. - Extended class property assignment to support indexed contents inside nested properties, covering direct syntax and public `subsasgn` descriptors such as `obj.child.values(2) = ...` and `substruct('.', 'child', '.', 'values', '()', {2})`. - Extended public `subsref` fallback for class property chains to support final indexed property contents, including scalar objects, object arrays, selected object-array elements, and comma-separated outputs. - Extended public `subsref`/`subsasgn` descriptor handling to character strings, so `substruct('()', {...})` can reference and assign text contents consistently with direct `()` string indexing while `{}` remains invalid. - Centralized character-vector indexing helpers in `MultiArray` and aligned direct character-string assignment/deletion with the same vectorized semantics used by public `subsref`/`subsasgn`. - Corrected public `subsref` parenthesis descriptors so cell-array `()` indexing returns cell arrays, while numeric arrays and character strings keep their direct-indexing behavior. - Preserved intermediate cell-array parenthesis results in public `subsref`/`subsasgn` descriptor chains, so combinations such as `substruct('()', {2}, '{}', {1})` behave like direct `C(2){1}` syntax, including deeper nested cell chains. - Corrected linear-index result shaping so explicit full-length index vectors such as `A([1, 2, 3])` preserve the index vector orientation instead of being treated like colon indexing (`A(:)`). - Extended linear-index shaping to follow MATLAB/Octave vector rules more closely: vector sources keep their own row/column orientation for vector indices, while matrix-shaped sources or matrix-shaped indices use the index shape. - Added regression coverage for linear indexed assignment with explicit vector and matrix-shaped indices, including ordinary arrays and cell arrays. - Added regression coverage for linear indexed deletion with explicit vector indices, preserving row/column orientation for ordinary arrays and cell arrays. - Corrected logical-index result shaping to match the equivalent `A(find(mask))` behavior: vector targets preserve their own orientation, vector masks shape matrix targets, and matrix-shaped masks return column vectors. - Added regression coverage for logical indexed reads, assignments, and deletions across ordinary arrays, column vectors, and cell arrays. - Added public `subsref`/`subsasgn` regression coverage for logical parenthesis descriptors on numeric arrays, cell arrays, and character strings, including text replacement and deletion through logical masks. - Added public `subsref`/`subsasgn` regression coverage for colon character subscripts inside `substruct` descriptors, including full-column/full-row references, `A(:)` references, scalar fill assignment, row/column deletion, and cell-array clearing. - Added public brace-descriptor coverage for `substruct('{}', {':'})`, including comma-separated `subsref` expansion, multiple assignment capture, scalar content fill, and assigning empty arrays into all selected cells. - Extended comma-separated `subsref` descriptor regression coverage to include too-many-output diagnostics, expansion into function calls, and expansion inside cell-array literals. - Added public `subsasgn` descriptor coverage for cell parenthesis assignment with cell-array RHS distribution, brace-content scalar fill over multiple selected cells, and invalid comma-separated RHS expansion into the three-argument `subsasgn` call. - Added direct indexing regression coverage for `end` in dimension-aware reads, assignments, and deletions across numeric arrays and cell arrays. - Added chained indexing regression coverage for `end` evaluated against intermediate field and cell-content values, including nested assignment and deletion paths. - Fixed character-vector expansion during indexed assignment so assigning past the end of a `CharString` fills intervening positions with spaces instead of numeric zeroes. - Added direct and public `subsasgn` regression coverage for character-vector growth, `end`-based replacement, repeated-position assignment, and `end` range deletion. - Aligned `CharString` indexed assignment with MATLAB character-code conversion so numeric real RHS values are converted to Unicode characters for both direct assignment and public `subsasgn` descriptors. - Rejected non-character, non-numeric RHS values during character-vector indexed assignment with a dedicated diagnostic instead of leaking a post-assignment conversion error. - Added the native `char` built-in for character-vector conversion from numeric code values, existing character values, numeric arrays, and multiple row inputs with MATLAB-style bla