-
Notifications
You must be signed in to change notification settings - Fork 1
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
PORT! state binary appears empty when it is not #2314
Comments
This was resolved in Ren-C some time ago, just mentioning it because it came up trying to write up some history-of-ports-in-R3-Alpha document, and it's easier to point to this issue than to go on a tangent about it in that document. |
Question is.. if this value should be accessible.. when it is internal private area. |
If you want more opacity, the HANDLE! type was introduced for that. But I'm more interested in turning this binary-representation-of-a-C-struct into a Rebol-structured OBJECT!, for more transparency. My point about the binary is just that if the length is incorrect, then operations like copying and such won't work...the copy will be empty though the original was not. And of course it confuses people who are working on the "internal implementation" who wonder "huh, I didn't think it was empty, why is it empty?" Or perhaps someone upgrades the GC to reclaim space and it says "oh, the allocation here is bigger than the length, we can shorten that". |
The question is, why this line was commented out. |
When someone else will be reading it... the |
fixes: metaeducation/rebol-issues#2314 I believe that the size setting was commented out to hide the state, so I added series protection so it cannot be modified from Rebol layer
In my branch it is now:
Let's see if it breaks something. |
The port state in the following examples contains bytes that are being used by the port, yet appear empty--meaning the bytes won't be copied, and it breaks the invariant of a BINARY! which may trip up in other ways:
The reason this happens is that the binary is created, but the length is never set:
https://github.com/rebol/rebol/blob/25033f897b2bd466068d7663563cd3ff64740b94/src/core/c-port.c#L100
Make_Binary() takes a capacity, but Make_Series() sets the length to 0, regardless of that capacity.
The text was updated successfully, but these errors were encountered: