-
Notifications
You must be signed in to change notification settings - Fork 55
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
Structure with isolated objects and values that belong to value:Cloneable
in an isolated expression
#856
Comments
Also won't work with recursive types. type Client isolated client object {
remote function get(string... strs) returns anydata|error;
};
type Plugin distinct isolated object {
isolated function process(Context context) returns error?;
};
type Context record {|
readonly string path;
Client 'client;
Plugin[] plugins;
|};
type Node record {|
readonly string path;
Context? context = ();
table<Node> key(path) children = table [];
|};
isolated class Class {
private table<Node> key(path) nodes;
function init(table<Node> key(path) nodeTable) {
// need to initialize `self.nodes` with values from `nodeTable`
self.nodes = table [];
}
} |
There's a fundamental issue which I think is related to this: #1244. |
Yes, I believe the changes proposed in "Making cloning work with isolated objects" addresses this. |
I believe it is currently not possible to make a structure that has both isolated objects and values that belong to
value:Cloneable
directly be part of an isolated expression, which may be required as the initial value of a isolated object's field or when transferring in/out such a structure (in a lock statement that accesses a "protected" variable).I guess we can still use the spread operator (as suggested in #855) if the values that belong to
value:Cloneable
are subtypes ofreadonly
.But this would not be possible if the types of the rest of the fields are not subtypes of
readonly
.Although we can get this to work by separating out the isolated objects and the values that belong to
value:Cloneable
and only usingclone
/cloneReadOnly
with the latter, I don't think it will scale with nested records that have isolated objects as field types.Could be related to #784
Originally posted by @MaryamZi in #855 (comment)
The text was updated successfully, but these errors were encountered: