FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BREAKING CHANGE: Make class fields a special kind of property by dcodeIO · Pull Request #2548 · AssemblyScript/assemblyscript · GitHub

BREAKING CHANGE: Make class fields a special kind of property - #2548

Closed
dcodeIO wants to merge 14 commits into
mainfrom
property-fields
Closed

BREAKING CHANGE: Make class fields a special kind of property#2548
dcodeIO wants to merge 14 commits into
mainfrom
property-fields

Conversation

dcodeIO commented Nov 4, 2022

Copy link
Copy Markdown
Member

Removes the hard distinction between fields, i.e.

class Foo {
  a: i32;
}

and properties, i.e.

class Foo {
  get a(): i32 { return 42; }
  set a(value: i32) { }
}

by making fields special kinds of properties, differing in having an associated memory offset. As a result, fields (which get built-in getters and setters) and properties (with explicit getters and setters) can override each other, lifting the annoying limitation that interface fields can only be implemented with properties. Since interchangeable fields and properties are more powerful than what is possible in JS/TS, compatibility with TS becomes a matter of disallowing what wouldn't be supported there due to JS nature.

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

dcodeIO added a commit to AssemblyScript/website that referenced this pull request Nov 6, 2022
that also work with interfaces

dcodeIO commented Nov 6, 2022

Copy link
Copy Markdown
Member Author

Last commit bakes in static instanceof helpers for both classes and interfaces that no longer rely on the RTTI blob. Together with host bindings that also generate static code, bundling the RTTI blob now is no longer necessary. I did not yet remove the RTTI blob, since doing so in turn renders the loader non-functional, so should likely get its own PR.

Comment thread tests/compiler/rt/instanceof.debug.wat Outdated
dcodeIO marked this pull request as ready for review November 7, 2022 15:08
dcodeIO changed the title Make class fields a special kind of property BREAKING CHANGE: Make class fields a special kind of property Nov 7, 2022

dcodeIO commented Nov 9, 2022

Copy link
Copy Markdown
Member Author

(for some reason this one doesn't show as merged as usual but is still open, so closing manually)

dcodeIO closed this Nov 9, 2022
pull Bot pushed a commit to ehtick/assemblyscript that referenced this pull request Nov 9, 2022
BREAKING CHANGE: Element kinds FIELD and FIELD_PROTOTYPE and elements Field and FieldPrototype have been removed. Instead, Property inherit previous Field functionality, indicated by property.isField.
dcodeIO mentioned this pull request Nov 10, 2022
2 tasks
dcodeIO added a commit to AssemblyScript/website that referenced this pull request Nov 11, 2022
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL