-
Notifications
You must be signed in to change notification settings - Fork 2
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
Typed Objects #31
Comments
I think group types ( Should probably be a note on how we would handle it. Probably shouldn't be in the syntax yet. |
Well, also how does it work with: let PointType = StructType({
x: uint8, // Our current syntax would allow `x number: uint8`
y: uint8
});
let p PointType; // does this default to undefined or to PointType({x: 0, y: 0}) ? |
I think we have some overlap with https://github.com/dslomov-chromium/typed-objects-es7#convertandcopytotypedescriptor-dimensions-buffer-offset-value |
I think they are assuming no type hinting exists and let PointType = StructType({
x uint8,
y uint8
}); or even: let PointType = {
x uint8,
y uint8
}; Does StructType get passed by value? |
They're treating all types as first class objects/functions, whereas we're treating them as "hints". We might need to think about that, but it does look like this proposal still works with theirs given your examples. If it is changed to what you suggest, then we'll have to write into our semantics that the type of something is stored:
|
Given that this is already stage 1, I would take this proposal seriously. |
From #32:
The type objects get defined in terms of function getA() A { // In temporal deadzone...
return new A();
}
let A = new StructType();
// desugared:
function getA() { return new A(); }
%Set(getA, [[TypeDescriptor]], A); // temporal deadzone...
let A = new StructType(); I guess that's more of something for a transpiler/engine, so that type descriptors of functions get set at the end of the file, or after everything they reference. I'm not sure. |
More information: https://github.com/nikomatsakis/typed-objects-explainer Also solves the forward referencing problem: https://github.com/nikomatsakis/typed-objects-explainer/blob/master/ootypes.md#cyclic-type-definitions |
How will we interact with: https://github.com/dslomov-chromium/typed-objects-es7
This also plays into #23
The text was updated successfully, but these errors were encountered: