| @@ -2277,7 +2277,10 @@ |
| 2277 | 2277 | `Expr::Var` resolution exactly — a context binding or a built-in name — because parse |
| 2278 | 2278 | and eval must agree on what "in scope" means. Since ADR-21/RD-11 every wrapper already |
| 2279 | 2279 | materializes exactly the root level into `Context` and traverses the rest lazily, the |
| 2280 | | - oracle needs no new input traversal and no laziness regression. |
| 2280 | + oracle needs no new input traversal and no laziness regression. A call head also |
| 2281 | + resolves against the ambient host-function registry (ADR-23, `eval_call` step 3), so |
| 2282 | + the wrappers' one-shot `evaluate` probes `ScopeWithFunctions { context, functions }` |
| 2283 | + — a hyphen-named host function (`my-fn(1)`) is callable. |
| 2281 | 2284 | 2. **Lexer pass 2.5** — `fuse_special_names` runs *after* `join_names` (so a multi-word part |
| 2282 | 2285 | like `total price` is already one word unit — `total price-total` is reachable) and before |
| 2283 | 2286 | `mark_reverse_open` (a fused `Name` completes a value for the `]`-role classifier). It |
| @@ -2289,7 +2292,12 @@ |
| 2289 | 2292 | the subtraction the TCK expects), and after a miss it resumes *inside* the run |
| 2290 | 2293 | (`a-b-c` with only `b-c` bound parses as `a - b-c`). Multi-char operators (`..`, `...`, |
| 2291 | 2294 | `**`, `->`) are not name symbols, so ranges, descendants and exponents never fuse. |
| 2292 | | - Without a probe the pass is a no-op. |
| 2295 | + A run only *starts* in a variable position: never at a word directly after an unfused |
| 2296 | + `.` (a path member resolves against the navigated structure, not the root scope — a |
| 2297 | + root key `y-z` must not turn `x.y-z` into `x.(y-z)`; it stays `(x.y) - z`), and never |
| 2298 | + at a pure structure keyword (`return`, `in`, `then`, `else`, `satisfies`, `and`, `or`, |
| 2299 | + `between` — `return -i` yields no `return-i` candidate); such keywords stay legal as |
| 2300 | + *later* run words (`x-in`). Without a probe the pass is a no-op. |
| 2293 | 2301 | 3. **API policy** — `compile_with_probe(expr, probe)` and probe-aware one-shot `evaluate` |
| 2294 | 2302 | (the context is the scope) in feel-core and every wrapper; `compile()` and the |
| 2295 | 2303 | `CompiledExpr` classes stay **probe-free** — a compiled program must not pin one scope, |
| @@ -2324,12 +2332,21 @@ |
| 2324 | 2332 | `a and b` / `for x in y` scope-dependent — the sound cache guard would then disable |
| 2325 | 2333 | feel-pg's parse cache for nearly every nontrivial expression. The engine keeps Tier 1/2 |
| 2326 | 2334 | (unconditional joins) as documented scope-blindness and defers the gated form. |
| 2335 | + - *Names in inner scopes* are not probed: the oracle sees only the root level, so a |
| 2336 | + special-character key one level down — a path member (`applicant.first-name`), a filter |
| 2337 | + element's key (`items[unit-price > 10]`), a `for`/quantifier variable's or a context |
| 2338 | + literal's own entries — keeps its arithmetic reading (`applicant.first - name`). Probing |
| 2339 | + them would need the parser to know the *shape* of the navigated value, i.e. eval-time |
| 2340 | + information at parse time. Workaround: a root-level alias, or `get value(applicant, |
| 2341 | + "first-name")`. |
| 2327 | 2342 | - *`?` and non-XID name starts* (rule 28, `what if?`) stay deferred with the 0083-feel-unicode |
| 2328 | 2343 | widening. |
| 2329 | 2344 | |
| 2330 | 2345 | - **Consequence:** `a-b`, `Date-Time`, `x.y` and `if-then` resolve per §10.3.1.6 in the |
| 2331 | 2346 | one-shot paths of feel-core/feel-py/feel-wasm/feel-lua and per row in feel-pg; `compile` |
| 2332 | | - remains the deterministic parse-once contract. Fixture suite 3145 → 3153 cases / 110 → 111 |
| 2347 | + remains the deterministic parse-once contract. The wrappers' one-shot `evaluate` now |
| 2348 | + converts the context (and registry) *before* parsing, so when both the context and the |
| 2349 | + expression are invalid, the context error is the one reported. Fixture suite 3145 → 3153 cases / 110 → 111 |
| 2333 | 2350 | files (the hand-written 0007-date-time-names fixture). Tests added: feel-core (6 test fns: |
| 2334 | 2351 | scope resolution, longest-match/left-to-right incl. the TCK subtraction and `(a)-(b)` |
| 2335 | 2352 | escape, name-vs-path/member interplay, probe-free-compile policy + both flags/candidates, |