{"action":"closed","issue":{"url":"https://api.github.com/repos/israel-lugo/tsarray/issues/2","repository_url":"https://api.github.com/repos/israel-lugo/tsarray","labels_url":"https://api.github.com/repos/israel-lugo/tsarray/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/israel-lugo/tsarray/issues/2/comments","events_url":"https://api.github.com/repos/israel-lugo/tsarray/issues/2/events","html_url":"https://github.com/israel-lugo/tsarray/issues/2","id":251737280,"number":2,"title":"Hide the tsarray private fields from the user","user":{"login":"israel-lugo","id":19789187,"avatar_url":"https://avatars1.githubusercontent.com/u/19789187?v=4","gravatar_id":"","url":"https://api.github.com/users/israel-lugo","html_url":"https://github.com/israel-lugo","followers_url":"https://api.github.com/users/israel-lugo/followers","following_url":"https://api.github.com/users/israel-lugo/following{/other_user}","gists_url":"https://api.github.com/users/israel-lugo/gists{/gist_id}","starred_url":"https://api.github.com/users/israel-lugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/israel-lugo/subscriptions","organizations_url":"https://api.github.com/users/israel-lugo/orgs","repos_url":"https://api.github.com/users/israel-lugo/repos","events_url":"https://api.github.com/users/israel-lugo/events{/privacy}","received_events_url":"https://api.github.com/users/israel-lugo/received_events","type":"User","site_admin":false},"labels":[{"id":669631669,"url":"https://api.github.com/repos/israel-lugo/tsarray/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":{"login":"israel-lugo","id":19789187,"avatar_url":"https://avatars1.githubusercontent.com/u/19789187?v=4","gravatar_id":"","url":"https://api.github.com/users/israel-lugo","html_url":"https://github.com/israel-lugo","followers_url":"https://api.github.com/users/israel-lugo/followers","following_url":"https://api.github.com/users/israel-lugo/following{/other_user}","gists_url":"https://api.github.com/users/israel-lugo/gists{/gist_id}","starred_url":"https://api.github.com/users/israel-lugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/israel-lugo/subscriptions","organizations_url":"https://api.github.com/users/israel-lugo/orgs","repos_url":"https://api.github.com/users/israel-lugo/repos","events_url":"https://api.github.com/users/israel-lugo/events{/privacy}","received_events_url":"https://api.github.com/users/israel-lugo/received_events","type":"User","site_admin":false},"assignees":[{"login":"israel-lugo","id":19789187,"avatar_url":"https://avatars1.githubusercontent.com/u/19789187?v=4","gravatar_id":"","url":"https://api.github.com/users/israel-lugo","html_url":"https://github.com/israel-lugo","followers_url":"https://api.github.com/users/israel-lugo/followers","following_url":"https://api.github.com/users/israel-lugo/following{/other_user}","gists_url":"https://api.github.com/users/israel-lugo/gists{/gist_id}","starred_url":"https://api.github.com/users/israel-lugo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/israel-lugo/subscriptions","organizations_url":"https://api.github.com/users/israel-lugo/orgs","repos_url":"https://api.github.com/users/israel-lugo/repos","events_url":"https://api.github.com/users/israel-lugo/events{/privacy}","received_events_url":"https://api.github.com/users/israel-lugo/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2017-08-21T18:35:27Z","updated_at":"2017-09-18T02:05:51Z","closed_at":"2017-09-18T02:05:51Z","author_association":"OWNER","body":"We can hide the ``_priv`` field from the user, with some pointer magic.\r\n\r\nCreate an internal-only ``struct _tsarray_desc`` with all the internal fields we want, and the last field is the publicly accessible ``struct _tsarray_abs`` (which only has user-visible fields).\r\n\r\nThis means we'll need a constructor to create tsarrays. Which is probably better for symmetry anyway, since we already require that the user call ``tsarray_free()``. The constructor will internally create a _tsarray_desc, but will only return a pointer to the public ``struct _tsarray_abs`` within it. All public functions receive that pointer, it's the only thing the user ever knows.\r\n\r\nInternally, whenever we want to access the containing ``struct _tsarray_desc`` of a given ``struct _tsarray_abs``, we use ``offsetof()`` pointer arithmetic to calculate the container address.\r\n\r\nIn fact, in the spirit of having a more array-like experience, we could just give the user a pointer to the items array itself. Any other public items (such as len) would be read by getter functions. More magical and user-friendly, which is good, but more magical, which is bad. Also, not as efficient (we can get around that by defining static inline getters)."}}
{"actor":{"display_login":"israel-lugo"}}