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

Add a notation for static and runtime semantics attached to grammar productions. #311

Open
claudepache opened this issue Jan 22, 2016 · 4 comments

Comments

@claudepache
Copy link
Contributor

It concerns the phrases of the form "the result of evaluating production with argument arg", and "the result of performing Foo of production with argument arg", and variations thereof.

Possible notation (to be bikesheded):

Evaluation{production}(args)
Foo{production}(args)

etc.

That will allow to replace the majority of remaining ReturnIfAbrupt steps in the spec with the ? notation.

Issue of my proposal: we lose the editorial distinction between the uses of runtime semantics (marked with the action verbs "performing" and "evaluating") and the use of static semantics.

Examples from section 12.2.6.9:

Replace:

  1. Let status be the result of performing PropertyDefinitionEvaluation of PropertyDefinitionList with arguments object and enumerable.
  2. ReturnIfAbrupt(status).

with:

  1. Perform ? PropertyDefinitionEvaluation{PropertyDefinitionList}(object, enumerable).

Replace:

  1. Let propName be StringValue of IdentifierReference.
  2. Let exprValue be the result of evaluating IdentifierReference.
  3. Let propValue be ? GetValue(exprValue).

with:

  1. Let propName be StringValue{IdentifierReference}().
  2. Let exprValue be ? Evaluation{IdentifierReference}().
  3. Let propValue be ? GetValue(exprValue).

Replace:

  1. Let propKey be the result of evaluating PropertyName.
  2. ReturnIfAbrupt(propKey).
  3. Let exprValueRef be the result of evaluating AssignmentExpression.
  4. Let propValue be ? GetValue(exprValueRef).

with:

  1. Let propKey be ? Evaluation{PropertyName}().
  2. Let exprValueRef be ? Evaluation{AssignmentExpression}().
  3. Let propValue be ? GetValue(exprValueRef).
@claudepache
Copy link
Contributor Author

Issue of my proposal: we lose the editorial distinction between the uses of runtime semantics (marked with the action verbs "performing" and "evaluating") and the use of static semantics.

Operations done at runtime should probably always be prefixed by either ? or !; that will restore that distinction.

@bterlson
Copy link
Member

I would like a new syntactic convention here. But what about using method invocation syntax, namely:

PropertyName.Evaluation(), exprValueRef.GetValue(), etc?

@domenic
Copy link
Member

domenic commented Jan 23, 2016

I think when @bterlson explained this to me last it was important that they are really abstract methods, yeah. If that could be made more explicit, I'd be quite happy.

@jmdyck
Copy link
Collaborator

jmdyck commented Jan 25, 2016

Bear in mind that the 'target' of such an invocation can't always be referenced simply by a nonterminal. E.g., consider:

    1. Let _falseRef_ be the result of evaluating the second |AssignmentExpression|.

Would that become

   1. Let _falseRef_ be (the second |AssignmentExpression|).Evaluation()

or

    1. Let _AE2_ be the second |AssignmentExpression|.
    2. Let _falseRef_ be _AE2_.Evaluation()

or (say)

    1. Let _falseRef_ be |AssignmentExpression|<sub>2</sub>.Evaluation()

(Also, the exprValueRef.GetValue() example is odd, because GetValue(V) is defined as an 'ordinary' abstract operation, not a syntax-discriminated operation.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants