Skip to content

Editorial: Use tildes for spec-internal values wherever possible.#1725

Merged
ljharb merged 1 commit intotc39:masterfrom
rkirsling:use-tildes-where-possible
Oct 11, 2019
Merged

Editorial: Use tildes for spec-internal values wherever possible.#1725
ljharb merged 1 commit intotc39:masterfrom
rkirsling:use-tildes-where-possible

Conversation

@rkirsling
Copy link
Member

Follow-up to #1302, prerequisite for the `"foo"`*"foo"* update.

This patch aims to change all non-observable magic strings into ~foo~-style spec-internal values.

@ljharb ljharb requested review from a team, jmdyck and syg October 8, 2019 20:32
@ljharb
Copy link
Member

ljharb commented Oct 8, 2019

This seems good, but more eyes is better. Also, can we add something about tilde-d things to a new section in https://tc39.es/ecma262/#sec-notational-conventions, either a 5.3, or a 5.2.6?

@rkirsling
Copy link
Member Author

We absolutely need such a section (not just for tildes but also asterisks, etc.), but I was hoping to address this in a separate PR. Is that okay?

@ljharb
Copy link
Member

ljharb commented Oct 8, 2019

I suppose, but I worry that without the section, the drift will continue - is there a reason it has to be delayed, or a rush to merge this one?

@rkirsling
Copy link
Member Author

Sorry, I didn't mean to imply any sort of chronology or delay; I just thought it would be deserving of its own review thread.

@ljharb
Copy link
Member

ljharb commented Oct 8, 2019

Hopefully it would be no more controversial than this very PR :-)

@rkirsling
Copy link
Member Author

Added a section 5.2.6.
(I suppose 5.2.5 and 5.2.6 could be turned into 5.3.1 and 5.3.2 but I'm not sure what 5.3's title would be.)

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Collaborator

@jmdyck jmdyck left a comment

Choose a reason for hiding this comment

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

Problem: when passing a TypedArray element-type to the _type_ parameter of:

  • GetValueFromBuffer,
  • SetValueInBuffer,
  • GetModifySetValueInBuffer, and
  • NumericToRawBytes,

sometimes the argument is a String value, and sometimes it's a tilde-value.

One way to resolve this would be to simply undo the String -> tilde change for these values.

If instead you want to go "forward", then I think you'd need to:

  • change the String value of the Element Type value ... to just the Element Type value ...
  • In the TypedArray Constructors table, put the Element Type values in tildes.
  • change 3 SameValue invocations (the ones involving _srcType_) to is the same as/is different from (because SameValue is defined to only take language values).

@rkirsling
Copy link
Member Author

Thanks for noticing that, @jmdyck! I've gone ahead with your "forward" suggestion.

@jmdyck
Copy link
Collaborator

jmdyck commented Oct 11, 2019

Yup, this looks good to go now.

…9#1725)

 - Add "Value Notation" section.
 - Fix Element Type inconsistencies.
@ljharb ljharb self-assigned this Oct 11, 2019
@ljharb ljharb force-pushed the use-tildes-where-possible branch from ad7ce87 to ce66e8f Compare October 11, 2019 02:50
@ljharb ljharb merged commit ce66e8f into tc39:master Oct 11, 2019
@rkirsling rkirsling deleted the use-tildes-where-possible branch October 11, 2019 03:22
jmdyck added a commit to jmdyck/ecma262 that referenced this pull request Oct 11, 2019
When extracting an 'Element Size' from the TypedArray Constructors table,
we have two syntaxes:
- `the Element Size ... for _foo_`
- `the Element Size ... for Element Type _foo_`

With the first, _foo_ is the name of a constructor from column 1 of the table.

With the second, _foo_ is an element type from column 2 of the table.

However, there's one line that uses the first syntax,
but with the second semantics.
This commit changes it to use the second syntax.

(This bug/inconsistency goes back to ES6, and
was brought to light by the changes from PR tc39#1725.)
ljharb pushed a commit to jmdyck/ecma262 that referenced this pull request Oct 12, 2019
When extracting an 'Element Size' from the TypedArray Constructors table,
we have two syntaxes:
- `the Element Size ... for _foo_`
- `the Element Size ... for Element Type _foo_`

With the first, _foo_ is the name of a constructor from column 1 of the table.

With the second, _foo_ is an element type from column 2 of the table.

However, there's one line that uses the first syntax,
but with the second semantics.
This commit changes it to use the second syntax.

(This bug/inconsistency goes back to ES6, and was brought to light by the changes from tc39#1725)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants