Skip to content

Read a selector without arguments as a property in JS - #12

Merged
noha merged 1 commit into
mainfrom
getters-for-unary-selectors
Oct 29, 2026
Merged

noha merged 1 commit into
mainfrom
getters-for-unary-selectors

Conversation

@noha

@noha noha commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

An exposed selector without arguments becomes a read-only property whose getter calls the selector (grid.name); every other selector stays a method (grid.rowAt_(1)). This is how ApptiveScript reads an ASProperty, and what the JS node in apptive-base needs for space.name and space.variables..

  • shim: qjs_binding_define_getter, next to qjs_binding_define and with the same C function behind it; the property is not enumerable, so walking a binding calls nothing in Pharo. The old function stays, so the old Pharo code runs on the new library.
  • QJSBinding>>isProperty: decides; QJSContext defines getter or method.
  • Tests, README and the QJSFunction comment use the property form.

The library changes: the VM needs a new build with this shim before a pin can move here.

An exposed selector without arguments becomes a read-only property whose
getter calls the selector (grid.name); every other selector stays a
method (grid.rowAt_(1)). This is how ApptiveScript reads an ASProperty,
and what the JS node in apptive-base needs for space.name and
space.variables.<key>.

- shim: qjs_binding_define_getter, next to qjs_binding_define and with
  the same C function behind it; the property is not enumerable, so
  walking a binding calls nothing in Pharo. The old function stays, so
  the old Pharo code runs on the new library.
- QJSBinding>>isProperty: decides; QJSContext defines getter or method.
- Tests, README and the QJSFunction comment use the property form.

The library changes: the VM needs a new build with this shim before a
pin can move here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noha
noha merged commit 1aefb2b into main Oct 29, 2026
4 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.

1 participant