Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Write-only properties #79

Merged
merged 6 commits into from Oct 27, 2021
Merged

RFC: Write-only properties #79

merged 6 commits into from Oct 27, 2021

Conversation

asajeffrey
Copy link
Collaborator

An RFC for a write-only access marker on properties in table types.

@asajeffrey asajeffrey added the rfc Language change proposal label Sep 22, 2021
@asajeffrey
Copy link
Collaborator Author

A companion to #77. Replaces #72.

asajeffrey and others added 2 commits October 8, 2021 18:15
Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
Comment on lines +149 to +150
If we infer such types, we may wish to present them differently, for
example TypeScript allows both a getter and a setter.
Copy link
Collaborator

Choose a reason for hiding this comment

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

So are we going to infer such types? This part of the design is a bit vague.

I can see how we can end up with such a type if the user uses intersection on two tables like these, but I'm not sure how will the inference create such an intersection by itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the implementation, I was thinking we'd use type normalization so we'd end up with a property having an optional read type and an optional write type. So inference would be able to create these types.

Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
@zeux zeux merged commit 59c0492 into master Oct 27, 2021
@zeux zeux deleted the ajeffrey-property-writeonly branch October 27, 2021 18:42
vegorov-rbx added a commit that referenced this pull request Apr 28, 2023
* Added a limit on how many instructions the Compiler can safely produce
(reported by @TheGreatSageEqualToHeaven)

C++ API Changes:
* With work started on read-only and write-only properties,
`Property::type` member variable has been replaced with `TypeId type()`
and `setType(TypeId)` functions.
* New `LazyType` unwrap callback now has a `void` return type, all
that's required from the callback is to write into `unwrapped` field.

In our work on the new type solver, the following issues were fixed:

* Work has started to support #77 and
#79
* Refinements are no longer applied on l-values, removing some
false-positive errors
* Improved overload resolution against expected result type
* `Frontend::prepareModuleScope` now works in the new solver
* Cofinite strings are now comparable

And these are the changes in native code generation (JIT):

* Fixed MIN_NUM and MAX_NUM constant fold when one of the arguments is
NaN
* Added constant folding for number conversions and bit operations
* Value spilling and rematerialization is now supported on arm64
* Improved FASTCALL2K IR generation to support second argument constant
* Added value numbering and load/store propagation optimizations
* Added STORE_VECTOR on arm64, completing the IR lowering on this target
RomanKhafizianov added a commit to RomanKhafizianov/luau that referenced this pull request Nov 27, 2023
* Added a limit on how many instructions the Compiler can safely produce
(reported by @TheGreatSageEqualToHeaven)

C++ API Changes:
* With work started on read-only and write-only properties,
`Property::type` member variable has been replaced with `TypeId type()`
and `setType(TypeId)` functions.
* New `LazyType` unwrap callback now has a `void` return type, all
that's required from the callback is to write into `unwrapped` field.

In our work on the new type solver, the following issues were fixed:

* Work has started to support luau-lang/luau#77 and
luau-lang/luau#79
* Refinements are no longer applied on l-values, removing some
false-positive errors
* Improved overload resolution against expected result type
* `Frontend::prepareModuleScope` now works in the new solver
* Cofinite strings are now comparable

And these are the changes in native code generation (JIT):

* Fixed MIN_NUM and MAX_NUM constant fold when one of the arguments is
NaN
* Added constant folding for number conversions and bit operations
* Value spilling and rematerialization is now supported on arm64
* Improved FASTCALL2K IR generation to support second argument constant
* Added value numbering and load/store propagation optimizations
* Added STORE_VECTOR on arm64, completing the IR lowering on this target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfc Language change proposal
Development

Successfully merging this pull request may close these issues.

None yet

3 participants