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

Readonly type that allows immutable structural values #465

Closed
jclark opened this issue Mar 25, 2020 · 3 comments
Closed

Readonly type that allows immutable structural values #465

jclark opened this issue Mar 25, 2020 · 3 comments
Assignees
Labels
enhancement Enhancement to language design implementation/done Implementation Done lang Relates to the Ballerina language specification

Comments

@jclark
Copy link
Collaborator

jclark commented Mar 25, 2020

In this issue, meaning of bare readonly type is extended from #462 to allow structural values that were constructed as readonly.

This means that readonly becomes a non-primary aspect of shape.

Contextually expected type can include readonly. Constructors will construct readonly values when contextually expected type is readonly. Contextually expected type of initializer of readonly field will be intersection of readonly and the type.

Static type of reference to const is subtype of readonly.

Cast <readonly>E thus has the effect on structures of checking that they are readonly. Static type of <readonly>E will be readonly.

@jclark jclark added enhancement Enhancement to language design lang Relates to the Ballerina language specification labels Mar 25, 2020
@jclark jclark added this to the 2020R2 milestone Mar 25, 2020
@jclark jclark self-assigned this Mar 25, 2020
jclark added a commit that referenced this issue Mar 27, 2020
@jclark
Copy link
Collaborator Author

jclark commented Mar 27, 2020

Still need to rewrite explanation of immutability for XML and structures.

@jclark jclark added the status/inprogress Fixes are in the process of being added label Mar 27, 2020
jclark added a commit that referenced this issue Mar 28, 2020
Part of #465.
Also improve error (#463).
jclark added a commit that referenced this issue Mar 29, 2020
@jclark
Copy link
Collaborator Author

jclark commented Mar 29, 2020

Operations that used SameShape need to ignore read-only aspect.

jclark added a commit that referenced this issue Mar 29, 2020
Rename to DeepEquals.
Part of #465.
jclark added a commit that referenced this issue Apr 1, 2020
@jclark jclark modified the milestones: 2020R3, 2020R2 Apr 24, 2020
@jclark
Copy link
Collaborator Author

jclark commented May 12, 2020

We will leave things related to contextually expected type to #392

@jclark jclark closed this as completed May 12, 2020
@jclark jclark added status/pending Design is agreed and waiting to be added and removed status/inprogress Fixes are in the process of being added labels May 12, 2020
@hasithaa hasithaa added the implementation/done Implementation Done label Jun 17, 2020
@jclark jclark removed the status/pending Design is agreed and waiting to be added label Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to language design implementation/done Implementation Done lang Relates to the Ballerina language specification
Projects
None yet
Development

No branches or pull requests

2 participants