Conversation
* Add ExecContext gates: analyzer rejects WASM-only nodes in flow statements, compiler rejects flow-only nodes in func blocks, LSP filters completions by execution context * Add flow representation for `time.now` (C++ and Go), making it the first ExecBoth node * Add optional `offset` parameter to `time.now` for both WASM and flow execution paths * Support negated literals in flow config values (e.g. `offset=-3h`) * Unit and integration tests across all layers * Gate exec context at call sites rather than the resolver, because resolver gating conflates wrong-context with undefined, requiring extra error plumbing to distinguish them and to avoid passing `ResolveAny` to 22 unrelated interfaces
…tion warnings for bare forms
…g in CompoundFactory Add status.set() as the preferred qualified form for set_status, with deprecation warning, LSP hover docs, and tests across Go and C++. Fix a latent bug in CompoundFactory/MultiFactory where qualified names with the same member (e.g. authority.set vs status.set) would collide after prefix stripping. Factories can now declare a module name so the dispatcher routes to the correct one.
…upport Move add, subtract, multiply, divide, mod, neg from op into math with deprecation warnings for bare forms. Symbols are ExecBoth, callable in both func blocks and flow statements. WASM host bindings added across all numeric types in Go and C++. pow remains ExecWASM only. Consolidate shared code for integration tests and hover.go
…s.set routing - Add SignedNumericConstraint kind that promotes unsigned types to wider signed equivalents (u8→i16, u16→i32, u32→i64, u64→f64) for math.neg - Add cross-type negate ops (NegateU8/U16/U32/U64) in telem/op - Handle promotion in both WASM compiler and flow constraint unifier - Fix CompoundFactory routing: move ModuleName() to Module so status nodes don't intercept authority.set - Restore status.set name config parameter - Check exec context before argument validation in analyzer
…improve error messages, and validate now() offset type
…since both are now internal. The `len` hover doc remains. The compiler dispatch for `string.len` stays since it's used internally when `len()` dispatches based on argument type.
a6f4512 to
877685e
Compare
pjdotson
left a comment
There was a problem hiding this comment.
I left comments here, but we should be mostly having discussions about this in-person, I just wanted to put extra things to think about. I also think that the error / exception handling is something that needs to be discussed as well: what does returning errors for functions look like in both the flow and func contexts (this is something that also is encountered with ranges + statuses RFC and it really does not feel like we have a consistent story on that, and instead are just doing things slapshot as they arise).
|
@pjdotson , replying to your top-level comment.
|
| - **Strictly typed**: Every value has a definite type known at compile time, and the | ||
| compiler enforces type rules at every boundary. | ||
| - **Strongly typed**: No implicit coercion between unrelated types. The programmer must | ||
| explicitly convert (e.g., JavaScript's `"5" + 3 = "53"` is weak typing). |
There was a problem hiding this comment.
I don't see where you are getting these definitions of strongly vs strictly. From what
I've read before about typing in languages, there is a general strong typing vs weak
typing axis, along with static typing vs dynamic typing and nominal vs structual. But I
haven't heard and can't really seem to find a difference between strict and strong
| returns its input type. `+`, `-`, `*`, `%` stay in the integer domain because they | ||
| produce exact integer results from integer inputs. `/` and `**` do not, so they return | ||
| `f64`. The rule is in the math (like derivative), not in matching the input datatype, | ||
| which ignores what the operators actually do. |
There was a problem hiding this comment.
See my comment below, but it feels like that the sections: type system consistency,
precision errors, and consistency with other operations are mostly reiterating the same
point. There should be one section called user expectation that goes for option A
because most current users expect it to return a float, and another section for
mathematical operator type consistency that goes with option B because when we perform
these primitive math operators (/, %, +, etc.) that are binary operators on two
objects of the same type, the output is the same type as the inputs.
|
|
||
| The counterargument is that low-level hardware engineers expect C-style integer | ||
| division. Every customer we have spoken to disagrees. They come from Python, LabVIEW, or | ||
| MATLAB, where division returns floats. |
There was a problem hiding this comment.
seems to be the same argument as some of the above sections as well
| | Divide by zero | ✓ | | | ||
| | Language identity | ✓ | | | ||
| | Reliability | ✓ | | | ||
| | Safety | ✓ | | |
There was a problem hiding this comment.
should add a section explicitly stating that error / exception behavior would need to be
added here as well for option B.
Pull Request
SY-4127
Greptile Summary
This PR adds an RFC and a trade study documenting the decision to have Arc's
/and**operators always returnf64and to replace divide-by-zero panics with IEEE 754 special values (+Inf,-Inf,NaN). The documents are comprehensive and well-reasoned, covering type-system arguments, precision trade-offs, migration guidance, and a full change-footprint breakdown.Confidence Score: 5/5
Documentation-only PR; safe to merge with the minor example-clarity nit addressed.
Both files are documentation (RFC + trade study); no production code is changed. The single finding is a P2 style issue in a code example. No logic bugs or security concerns.
docs/tech/rfc/0038-260425-division-power-f64-typecast.md — §3.2 code examples
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Arc expression: a / b or a ** b"] --> B{Operator} B -->|"/ or **"| C["Analyzer: force result type → f64"] B -->|"+ − × %"| D["Return input type (no change)"] C --> E{Execution context} E -->|Flow node| F["divide{} / pow{} host function\n(T, T) → f64"] E -->|WASM func block| G["Compiler emits call to\nmath.divide / math.pow host fn"] F --> H{Denominator = 0?} G --> H H -->|"n/0, n≠0"| I["+Inf or -Inf (truthy)"] H -->|"0/0"| J["NaN (non-truthy)"] H -->|normal| L["f64 result"] I --> M[isSeriesTruthy check] J --> M L --> MReviews (3): Last reviewed commit: "SY-4127: Update docs based on feedback/d..." | Re-trigger Greptile