Skip to content
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

Reference types changes to remove subtyping #1407

Merged
merged 5 commits into from
May 28, 2020
Merged

Reference types changes to remove subtyping #1407

merged 5 commits into from
May 28, 2020

Conversation

binji
Copy link
Member

@binji binji commented May 6, 2020

Main changes:

  • Rename anyref -> externref
  • Remove nullref
  • Rename hostref -> externref
  • ref.null and ref.is_null now have "ref kind" parameter
  • Add ref kind keywords: func, extern, exn

@binji
Copy link
Member Author

binji commented May 6, 2020

This PR can't land as-is, since it fails all the spec tests (that need to be updated)

@binji binji requested a review from sbc100 May 6, 2020 18:46
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! So it was decided to do with externref as the name in the spec? (Over anyref?)

@@ -157,8 +157,7 @@ The `reference-types` proposal adds three more valid types:

| type | JSON format |
| - | - |
| "nullref" | `{"type": "nullref", "value": ""}` |
| "hostref" | `{"type": "hostref", "value": <string>}` |
| "externref" | `{"type": "externref", "value": <string>}` |
| "funcref" | `{"type": "funcref", "value": <string>}` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice there that we are missing exnref .. which is a little annoyingly close in name to externref

return true;
}
return false;
return expected == actual;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a comment here as to why this a function at all still? Something like "we used to have subtyping and we expect we may again in the future"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

case Type::Funcref:
return StringPrintf("funcref:%" PRIzd, tv.value.Get<Ref>().index);

case Type::Externref:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about camel-casing these (as a followup). I find ExternRef a little easier to read than Externref

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -15,8 +17,7 @@ struct TokenInfo {
};
};
%%
anyref, Type::Anyref
array, TokenType::Array
array, Type::Array, TokenType::Array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this and other seemingly unrelated lines in this file change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe another possible split out PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Result BinaryReaderLogging::name(Index value, Type type) { \
LOGF(#name "(index: %" PRIindex ", type: %s)\n", value, type.GetName()); \
return reader_->name(value, type); \
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part could be split out if you feel like landing sooner.

@sbc100
Copy link
Member

sbc100 commented May 6, 2020

Is there a PR in the reftypes proposal you can link to here?

@binji
Copy link
Member Author

binji commented May 6, 2020

Here's the link to the reference-types PR: WebAssembly/reference-types#87. I'll add it to the commit too.

binji added 4 commits May 27, 2020 09:17
Main changes:
* Rename `anyref` -> `externref`
* Remove `nullref`
* Rename `hostref` -> `externref`
* `ref.null` and `ref.is_null` now have "ref kind" parameter
* Add ref kind keywords: `func`, `extern`, `exn`
@binji binji marked this pull request as ready for review May 28, 2020 04:05
@binji binji merged commit bf46c08 into master May 28, 2020
@binji binji deleted the externref branch May 28, 2020 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants