-
Notifications
You must be signed in to change notification settings - Fork 164
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
Normative: Rename numeric types to match ECMAScript typed arrays #856
Conversation
index.bs
Outdated
Promise<void> delay(unrestricted double ms); | ||
Promise<void> delay(unrestricted f64 ms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I had to revert this due to unrestricted f64
currently being a syntax error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this mean the PR should wait for the parser to be updated first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably merge this as‑is, since this PR also defines "aliases" for:
// Not actually implemented using `typedef`s, this is just for illustration:
typedef (i8) byte;
typedef (i16) short;
typedef (i32) long;
typedef (i64) long long;
typedef (u8) octet;
typedef (u16) unsigned short;
typedef (u32) unsigned long;
typedef (u64) unsigned long long;
typedef (f32) float;
typedef (unrestricted f32) unrestricted float;
typedef (f64) double;
typedef (unrestricted f64) unrestricted double;
We’d just have to remember to convert unrestricted double
to unrestricted f64
once the parser is updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK an identifier can't contain a whitespace and thus it can't be like typedef (i64) long long;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s why this isn’t actually implemented using typedef
s, that is just for illustration, the actual aliases are defined as:
For legacy compatibility,
byte
is to be treated as an alias fori8
, similar to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed that part, sorry 😅
index.bs
Outdated
Promise<void> validatedDelay(unrestricted double ms); | ||
Promise<void> validatedDelay(unrestricted f64 ms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
index.bs
Outdated
Promise<any> addDelay(Promise<any> promise, unrestricted double ms); | ||
Promise<any> addDelay(Promise<any> promise, unrestricted f64 ms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
…ename-numeric-types
Since there was support for #843, I decided to go ahead with opening a PR for this.
I decided to go with
i*
for signed integers because it’s what browser engines and the Rust programming language use and due to ECMAScript providing implicit support for 32‑bit signed integers using the binary OR operator, but none for unsigned integers:ECMAScript
Array
s also restrict the length to a positive 32‑bit signed integer.Depends on:
unrestricted
keyword into an extended attribute #857Resolves #843
🔗 PR Preview
Preview | Diff