-
Notifications
You must be signed in to change notification settings - Fork 570
Are empty/nil slices externalized correctly? #399
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
The reason I ask is because I would expect
Not an empty Or is there a reason why numeric slices with 0 elements are treated differently than numeric slices with 1 or more elements? |
I'm guessing this was an accidental oversight, given that #597 (/cc @flimzy) looks like similar/identical issue, and it was resolved by #599. Running the same code as above with latest GopherJS produces different results, that look more in line with what's expected:
|
@shurcooL apologies I missed this for some reason. I'll make sure I look at this in #617 (comment) |
I know that
(interface{})(nil)
gets externalized as a JavaScriptnull
, andjs.Undefined
gets externalized as JavaScriptundefined
.I also know that, according to the conversion table,
[]byte
slices get externalized asUint8Array
. But other slices, e.g.,[]string
, get externalized asArray
.However, it seems that it's not always the case. Empty
[]byte
slices seemingly get externalized as JavaScriptArray
rather thanUint8Array
.Is this intentional by design, or an accidental oversight?
I've run into this as part of goxjs/gl#18.
The text was updated successfully, but these errors were encountered: