-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[vm/ffi] Change load() and store() to val and ref getter/setter pairs. #37361
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
Comments
This will be addressed in the same CL that changes the API to extension methods (#37773). |
About The That is what I would recommend. If you think it is too long, and that it will be used a lot, then going for |
Thanks @lrhn. You can see the impact of Pointer<Coordinate> c1 = Pointer.allocate(count: 3);
Pointer<Coordinate> c2 = c1.elementAt(1);
Pointer<Coordinate> c3 = c1.elementAt(2);
c1.ref.x = 10.0;
c1.ref.y = 10.0;
c1.ref.next = c3;
c2.ref.x = 20.0;
c2.ref.y = 20.0;
c2.ref.next = c1;
c3.ref.x = 30.0;
c3.ref.y = 30.0;
c3.ref.next = c2; But we could argue that that should be rewritten as: // ...
c3.ref
..x = 30.0
..y = 30.0
..next = c2; Maybe going for the idiomatic API |
The C equivalent of |
I vote for |
Implemented in 597cd06. |
In the new structs API (#37229) we will remove
load()
andstore()
in favor of aval
getter/setter pair for non-struct pointers and aref
getter for pointers to structs:This task includes implementation of the decisions make in #35782 and #35756.
The text was updated successfully, but these errors were encountered: