Skip to content

learn(microflows): expression functions take positional arguments only — toString(from: $X) is a silent misparse - #140

Draft
MendixMau wants to merge 1 commit into
masterfrom
learn/expression-args-positional
Draft

MendixMau wants to merge 1 commit into
masterfrom
learn/expression-args-positional

Conversation

@MendixMau

Copy link
Copy Markdown
Owner

What changed and why (one paragraph)

Workshop feedback: a session kept writing toString(from: $Temperature) and the build broke on the from:. New section in skills/learned-microflow-patterns.md records the rule (every Mendix expression function is positional-only; the name: value shape is genuine MDL in page properties, page actions and @anchor, never inside an expression) and the mechanism: mxcli's expression grammar has no named-argument production, so label: value parses as a bare identifier divided by the value (COLON is the OQL division operator). The trap is that mxcli check --references passes it silently whenever the collapsed argument count still matches the function's arity; only an arity mismatch produces an error, and that error (E006 … got 1) never names labelled arguments as the cause. Wrong/correct pair included, plus a STOP instruction: any name: inside a function call's parentheses is a stop regardless of a clean check.

Field evidence

mxcli v0.24.0 / Mendix 11.12.1, on a scratch copy of a small PoC model:

Written mxcli check --references
toString(from: $Temperature) passes silently, exit 0; describe microflow round-trips the labelled form verbatim
formatDateTime($D, pattern: 'yyyy-MM-dd') passes silently, exit 0
substring(from: $S, index: 0, length: 3) fails with substring() expects 2 to 3 argument(s), got 1. [E006]

Not measured: real mx check / Studio Pro on the silently accepted forms (no mxbuild in the environment); the skill says so.

Checklist

  • No client data (leak guard clean)
  • Size cap: 2 files, +31
  • Test tier T0 (doc-only; no fixture covers this section)
  • Instrument rules: n/a (no bin/ change)
  • Routing row: n/a (existing skill, already routed baseline)
  • CHANGELOG line in the same commit
  • Bug entries: n/a

🤖 Generated with Claude Code

https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw


Generated by Claude Code

… positional-only, not labelled

Workshop feedback: `toString(from: $Temperature)` broke, cause unclear. MDL's
expression grammar has no named-argument form for function calls — `label: value`
parses as a bare identifier COLON-divided by the value (COLON is the OQL division
operator), not a labelled argument. Verified on mxcli v0.24.0 / Mendix 11.12.1
against a scratch probe model: `toString(from: $Temperature)` and
`formatDateTime($D, pattern: 'yyyy-MM-dd')` pass `mxcli check --references`
silently because the collapsed argument count still matches the function's
arity; `substring(from: $S, index: 0, length: 3)` fails but with a misleading
E006 that never names labelled arguments as the cause. Likely origin: labelled
colon syntax is genuine MDL elsewhere (page `Attribute:`/`Action: MICROFLOW
Name(Param: val)`, `@anchor(from: bottom, to: top)`) — never inside an
expression.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant