Skip to content

Class property expressions, class-body arrays, SYS(2007), SET switch words - #9

Merged
RandomChirp merged 1 commit into
FoxDevCommunity:mainfrom
jefflroberts:language-forms
Sep 24, 2026
Merged

RandomChirp merged 1 commit into
FoxDevCommunity:mainfrom
jefflroberts:language-forms

Conversation

@jefflroberts

Copy link
Copy Markdown
Collaborator

Found running a CodeMine application (Shutter Ace); each behaviour measured in
Visual FoxPro 9 first, with goldens whose .expected vfp9.exe wrote.

  • A DEFINE CLASS property value that is an expression - QuickBooksInvoice's
    TxnDate = TRANSFORM(DTOS(DATE()), "@r xxxx-xx-xx") - is kept as source and
    worked out at CREATEOBJECT(), where CREATEOBJECT() was called, so a variable
    set just before it is seen. A subclass's constant still wins over it. It was
    a compile error. Evaluating in a fiber that is waiting on the host no longer
    drops the answer that fiber is waiting for.
  • A class body can set an array property whole (every element) or one element
    of it: DIMENSION wbaSearchOrder[7] then wbaSearchOrder[1] = "WIZARDS",
    as Microsoft's own wbmain.prg does.
  • SYS(2007): CRC-16/CCITT from 0xFFFF or from the seed given, and CRC-32 with
    flag 1. CodeMine validates serial numbers with it.
  • Words after a SET switch are read: SET COMPATIBLE ... PROMPT | NOPROMPT is
    what SET("COMPATIBLE", 1) answers; the words after others change nothing.

Verification. Goldens class_array_elements, sys_checksum and set_switch_words (each .expected written by vfp9.exe), tests/runtime/classPropertyExpressions.test.ts, and an updated case in crates/foxvm/tests/classes.rs. The full VM suite and the runtime, shared, vfp and reference TypeScript tests pass on this branch.

One of several pull requests split out of work on a CodeMine application (Shutter Ace); each stands on main on its own except where it says otherwise.

🤖 Generated with Claude Code

…words

Found running a CodeMine application (Shutter Ace); each behaviour measured in
Visual FoxPro 9 first, with goldens whose .expected vfp9.exe wrote.

- A DEFINE CLASS property value that is an expression - QuickBooksInvoice's
  TxnDate = TRANSFORM(DTOS(DATE()), "@r xxxx-xx-xx") - is kept as source and
  worked out at CREATEOBJECT(), where CREATEOBJECT() was called, so a variable
  set just before it is seen. A subclass's constant still wins over it. It was
  a compile error. Evaluating in a fiber that is waiting on the host no longer
  drops the answer that fiber is waiting for.
- A class body can set an array property whole (every element) or one element
  of it: `DIMENSION wbaSearchOrder[7]` then `wbaSearchOrder[1] = "WIZARDS"`,
  as Microsoft's own wbmain.prg does.
- SYS(2007): CRC-16/CCITT from 0xFFFF or from the seed given, and CRC-32 with
  flag 1. CodeMine validates serial numbers with it.
- Words after a SET switch are read: SET COMPATIBLE ... PROMPT | NOPROMPT is
  what SET("COMPATIBLE", 1) answers; the words after others change nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@RandomChirp RandomChirp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Measured in vfp9.exe: a class property written as an expression is worked out when the object is made, in the caller's scope (nBase = 7 just before CREATEOBJECT gives nFromVar 8), a subclass constant wins over the parent's expression (cchild.nSum 20), and DATE() there is a date. The three goldens (class_array_elements, set_switch_words, sys_checksum) agree with the product, and cargo test -p foxvm is green on a merge with main.

One small thing, not blocking: SYS(2007) takes the low byte of each char, which folds any character above 255 into a byte the product would never see. The strings the VM holds are single-byte in practice, so it is fine today; a comment saying so would stop someone reading it as a bug.

Review generated with Claude Code (Claude Fable 5.1), run against vfp9.exe and the test suites on a merge with main.

@RandomChirp
RandomChirp merged commit f39831b into FoxDevCommunity:main Sep 24, 2026
3 checks passed
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.

2 participants