Repository navigation
feat(pages): write a page variable's default as a bare expression - #1086
Merged
Merged
Conversation
A page or snippet variable's default is a Mendix expression, but MDL took it in a string whose content was the expression: `$show: Boolean = 'true'`. It is now written bare (R5) — `= true`, `= if (3 < 4) then true else false`, `= 'Price' + ' list'`, `= Module.Enum.Value` — in create page, create snippet and `alter page … add variables`. mdl 1 is frozen, so the string form keeps its meaning under every language version and is the deprecated alias MDL-DEPR086 (refused from mdl 2), with the `fmt --upgrade` rewrite. A default that is itself a string (`'''abc'''`) or empty has no bare spelling yet — the bare `'abc'` is the alias — and is not reported. describe writes the bare form when it reads back as the same default. The example scripts were converted with fmt --upgrade itself; docs, syntax help, skills and the generated migration table follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P65SqmwwvbWdJVRwhYiMQw
The R2 brace/paren tests used `$show: Boolean = 'true'` as their canonical form, which MDL-DEPR086 now reports, so each case recorded two deprecations instead of the one it exercises, and describe's expected output was the quoted form. The defaults are written bare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P65SqmwwvbWdJVRwhYiMQw
The generic ALTER PAGE syntax help and the grammar comment, both changed on main since, still showed `$show: Boolean = 'true'` (MDL-DEPR086). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P65SqmwwvbWdJVRwhYiMQw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A page or snippet variable's default is a Mendix expression, but MDL took it in a string whose content was the expression:
$show: Boolean = 'true',= 'if (3 < 4) then true else false'. It can now be written bare, like every other expression (R5):This works in
create page,create snippetandalter page … add variables, which all sharevariableDeclaration.Language version
mdl 1is frozen (ADR-0011), so= 'true'cannot change meaning in it. The string form therefore keeps its meaning (its content is the expression) under every language version. It becomes the deprecated alias MDL-DEPR086, refused frommdl 2, following the precedent of MDL-DEPR080 for workflow expressions:checkandexecwarn on it.fmt --upgraderewrites it to the bare form.One exception: a default that is itself a Mendix string (
$s: String = '''abc''') or is empty has no bare spelling yet, because a bare'abc'is this very alias. Those keep their current form and are not reported.Changes
variableDeclarationtakes(STRING_LITERAL /* @alias MDL-DEPR086 */ | expression).ExitVariableDeclarationrecords DEPR086 with the rewrite.VariableDefaultReadsBackdecides whether a default can be written bare.docs-site/src/language/versions.mdis regenerated.fmt --upgradeitself, which changed only their defaults (including an enumeration value).Verification
mdl 0andmdl 1, and not on'''abc'''or''fmt --upgraderewrite for create and ALTERDefaultValueis exactly the expression written for every form;'''abc'''stores'abc'.mx checkis clean, including a columnVisible: $a and $bigover the variables.TestPageVariableInputBinding_RoundTrippassed locally (it ran, not skipped).make build && make test && make lint && make check-mdl && make check-migration-reference && make check-findingsall pass on the branch rebased onto main.Found while verifying, not changed here: Mendix rejects a default that refers to another page variable (
$x: Boolean = not($a)is CE0117 inmx check), and the quoted spelling fails the same way. Acheckrule for it would be a separate change.🤖 Generated with Claude Code
https://claude.ai/code/session_01P65SqmwwvbWdJVRwhYiMQw
Generated by Claude Code