Files
gridcraft/docs/decisions.md
T
Brandon ThomasandClaude Opus 5.5 59c8e36d36 Merge pull request #83 from harrisonoconnorhover/codex/nonspilling-array-export
Preserve array evaluation for non-spilling XLSX formulas

Rebased onto main with a maintainer fix-up (LET bindings via split_last/as_chunks for clippy, no slice indexing); the contributor's branch does not allow maintainer edits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 15:02:43 -04:00

2.3 KiB

Decisions

Formula localization uses the existing interface preference

PR #98 builds on the persisted UiState.language introduced by #31 and extended by #104. Español selects the Spanish function table and list/decimal separators; there is no competing locale setting. Formula syntax without a supplied translation table falls back to English. The editor translates to canonical English before engine commands, and translates back only for display. API, clipboard and XLSX syntax remain stable. Existing names override aliases.

The revision is based directly on main after #31/#104 and Portuguese interface support (#82) merged. Those locales retain their existing formula fallback; this change adds only Spanish.

Preserve array evaluation when exporting formulas (#64)

GridCraft evaluates ordinary formulas with array semantics even when the final result occupies one cell. XLSX export marks actual spills and formulas whose results may differ under legacy implicit intersection as dynamic, using the spill range or a single-cell array reference. Legacy CSE array ranges keep their existing representation.

The exporter inspects the parsed formula without evaluating it. It distinguishes range-taking functions such as SUM from scalar arguments and operators: SUM(A1:A3) and A1*2 stay ordinary, while SUM(A1:A3*B1:B3) and SQRT(A1:A3) retain array evaluation. Legacy array-aware contexts such as SUMPRODUCT do not need an extra marker. Explicit @ scalarizes its result without hiding array-sensitive operations inside it.

Names are resolved using workbook/sheet scope, and structured references distinguish one table-row cell from a column. Literal INDIRECT and INDEX arguments permit tighter classification; unresolved reference dimensions are conservatively treated as potentially multiple cells. Name/AST traversal is bounded, with array preservation as the fallback. This is an export classifier, not a claim of exact Excel metadata parity for every function or user-defined function. It stays within the format crate's existing dependencies and does not change calculation or import behavior.

This is a writer policy; interpreting implicit intersection in imported legacy formulas remains separate work. See Microsoft's Formula vs. Formula2 documentation.