{"action":"created","issue":{"url":"https://api.github.com/repos/MikeInnes/BSON.jl/issues/6","repository_url":"https://api.github.com/repos/MikeInnes/BSON.jl","labels_url":"https://api.github.com/repos/MikeInnes/BSON.jl/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/MikeInnes/BSON.jl/issues/6/comments","events_url":"https://api.github.com/repos/MikeInnes/BSON.jl/issues/6/events","html_url":"https://github.com/MikeInnes/BSON.jl/pull/6","id":326703678,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkwNzIyMDM3","number":6,"title":"[RFC] Before trying to lower() an AbstractArray, replace undef values with a defined value of the same type - fixes #3","user":{"login":"DilumAluthge","id":5619885,"node_id":"MDQ6VXNlcjU2MTk4ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/5619885?v=4","gravatar_id":"","url":"https://api.github.com/users/DilumAluthge","html_url":"https://github.com/DilumAluthge","followers_url":"https://api.github.com/users/DilumAluthge/followers","following_url":"https://api.github.com/users/DilumAluthge/following{/other_user}","gists_url":"https://api.github.com/users/DilumAluthge/gists{/gist_id}","starred_url":"https://api.github.com/users/DilumAluthge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DilumAluthge/subscriptions","organizations_url":"https://api.github.com/users/DilumAluthge/orgs","repos_url":"https://api.github.com/users/DilumAluthge/repos","events_url":"https://api.github.com/users/DilumAluthge/events{/privacy}","received_events_url":"https://api.github.com/users/DilumAluthge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-05-26T02:42:28Z","updated_at":"2018-05-31T16:52:24Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/MikeInnes/BSON.jl/pulls/6","html_url":"https://github.com/MikeInnes/BSON.jl/pull/6","diff_url":"https://github.com/MikeInnes/BSON.jl/pull/6.diff","patch_url":"https://github.com/MikeInnes/BSON.jl/pull/6.patch"},"body":"This is a really hacky way to solve #3. The basic idea is this: before trying to lower() an AbstractArray, we go through the array and replace all the #undef values with a value of the appropriate type. (Specifically, we replace the #undef values with the first defined value in the array.)\r\n\r\nFor example, if we have an array that looks like this:\r\n```julia\r\n5-element Array{String,1}:\r\n #undef\r\n    \"b\"\r\n #undef\r\n    \"d\"\r\n    \"e\"\r\n```\r\nThen, before we try to lower() it, we change the #undef values so the array looks like this:\r\n```julia\r\n5-element Array{String,1}:\r\n    \"b\"\r\n    \"b\"\r\n    \"b\"\r\n    \"d\"\r\n    \"e\"\r\n```\r\n\r\nIt seems like those values are ignored, so it doesn't matter what we set them to, as long as we set them to values of the appropriate type."},"comment":{"url":"https://api.github.com/repos/MikeInnes/BSON.jl/issues/comments/393599279","html_url":"https://github.com/MikeInnes/BSON.jl/pull/6#issuecomment-393599279","issue_url":"https://api.github.com/repos/MikeInnes/BSON.jl/issues/6","id":393599279,"node_id":"MDEyOklzc3VlQ29tbWVudDM5MzU5OTI3OQ==","user":{"login":"DilumAluthge","id":5619885,"node_id":"MDQ6VXNlcjU2MTk4ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/5619885?v=4","gravatar_id":"","url":"https://api.github.com/users/DilumAluthge","html_url":"https://github.com/DilumAluthge","followers_url":"https://api.github.com/users/DilumAluthge/followers","following_url":"https://api.github.com/users/DilumAluthge/following{/other_user}","gists_url":"https://api.github.com/users/DilumAluthge/gists{/gist_id}","starred_url":"https://api.github.com/users/DilumAluthge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DilumAluthge/subscriptions","organizations_url":"https://api.github.com/users/DilumAluthge/orgs","repos_url":"https://api.github.com/users/DilumAluthge/repos","events_url":"https://api.github.com/users/DilumAluthge/events{/privacy}","received_events_url":"https://api.github.com/users/DilumAluthge/received_events","type":"User","site_admin":false},"created_at":"2018-05-31T16:52:24Z","updated_at":"2018-05-31T16:52:24Z","author_association":"NONE","body":"So we actually already have `undefined <: BSONType`. We could probably just\nuse that?\n\nOn Thu, May 31, 2018 at 12:05 Dilum Aluthge <dilum@aluthge.com> wrote:\n\n> Ahh I see. Seems like it would work, as long as a zero byte doesn’t\n> already have another meaning in the BSON spec.\n>\n> On Thu, May 31, 2018 at 11:58 Mike J Innes <notifications@github.com>\n> wrote:\n>\n>> I mean at a lower level, i.e. when we write an array out as bytes in the\n>> file. e.g. we could say that a zero byte means undefined, and then the\n>> reader won't fill the array where it sees a zero. (Just an example, I'm not\n>> sure that would work).\n>>\n>> —\n>> You are receiving this because you authored the thread.\n>> Reply to this email directly, view it on GitHub\n>> <https://github.com/MikeInnes/BSON.jl/pull/6#issuecomment-393580876>, or mute\n>> the thread\n>> <https://github.com/notifications/unsubscribe-auth/AFXArd77SFcc1nXcVXdtMm2V2v60HUd1ks5t4BMhgaJpZM4UOwCa>\n>> .\n>>\n> --\n>\n> *Dilum Aluthge*\n>\n> *dilum@aluthge.com <dilum@aluthge.com>*\n>\n>\n> *https://www.aluthge.com <https://www.aluthge.com>*\n>\n-- \n\n*Dilum Aluthge*\n\n*dilum@aluthge.com <dilum@aluthge.com>*\n\n\n*https://www.aluthge.com <https://www.aluthge.com>*\n"}}
{"actor":{"display_login":"DilumAluthge"}}