Skip to content

Bring names in line with AST semantics sooner rather than later #26

Closed

Description

@titzer

Before we get too far along I think we need to have a referendum on the naming going on in the spec. In particular, I think the spec should follow naming conventions that have already been agreed upon in AstSemantics.md. Also, we should solve some of the outstanding issues with naming in AstSemantics.md.

In particular, the operation.type in the spec bothers me. This might come from a viewpoint where operations are parameterized over types in some way. That kind of doesn't make sense, since there are many floating point operations available that don't work on integers and vice versa. Therefore I think it's more logical to do what we were doing before and consider operations to be members of types.

E.g.

type.operation
type.operation[type]

Activity

  1. kg commented on Aug 25, 2015

    @kg
    Contributor

    We really need this. I've spent a while reading over the ml-proto and I still can't figure out how to mentally map name -> ast node -> name. The way it works currently is very confusing to me.

  2. rossberg commented on Aug 25, 2015

    @rossberg
    Member

    I'm fine with inverting the S-expr naming scheme in the proto. FWIW, it was inspired by good old M68k syntax, not by parameterisation.

  3. rossberg commented on Aug 25, 2015

    @rossberg
    Member

    The biggest other discrepancy probably is with the zoo of conversion operators. One reason for the difference was that the naming in the AstSemantics is rather irregular, so kind of impossible to factorise in a pleasant manner. Can we perhaps do something about that?

  4. sunfishcode commented on Aug 25, 2015

    @sunfishcode
    Member

    Could you be more specific about the irregularity you observe? The current set of names is aimed at emphasizing semantic differences among the conversions.

  5. rossberg commented on Aug 26, 2015

    @rossberg
    Member

    @sunfishcode, I understand the motivation, but I'm not convinced it buys anything in a code format not targeted at humans anyway. In fact, find it rather difficult to memoize all the different names, and S-expr generators likewise will have to go through extra hoops to select them.

    Conversions essentially form a 2D matrix (with a few holes; 3D if you want to count sign handling). It's unfortunate if different elements in this matrix require different naming schemes. (Or if both index dimensions are annotated in different ways, for that matter.)

  6. rossberg commented on Aug 26, 2015

    @rossberg
    Member

    I'll probably have plenty of time on the plane tomorrow, will do a first round of lining up naming.

  7. sunfishcode commented on Aug 26, 2015

    @sunfishcode
    Member

    @rossberg-chromium Humans finding it difficult to memorize all of the different names is a human-oriented concern :-). Using a single name to represent different kinds of things is an abstraction.

    All compiler backends I'm familiar with (e.g. LLVM and GCC) use different opcodes to represent the different kinds of conversions, because there are significant semantic differences between them.

  8. lukewagner commented on Sep 17, 2015

    @lukewagner
    Member

    Are there any major discrepancies left?

  9. binji commented on Sep 18, 2015

    @binji
    Member

    Here are the ones I noticed: do_while, forever, continue, comma, conditional, call_direct.

  10. sunfishcode commented on Sep 18, 2015

    @sunfishcode
    Member

    do_while, forever, continue, comma, and conditional are under discussion in issues such as WebAssembly/design#223 and WebAssembly/design#299 .

    The design's call_direct and the spec's call probably aren't waiting for anything though. Anyone want to state a preference?

  11. qwertie commented on Sep 18, 2015

    @qwertie

    @sunfishcode call sgtm.

  12. sunfishcode commented on Sep 21, 2015

    @sunfishcode
    Member

    I submitted WebAssembly/design#365 to rename call_direct to call.

  13. sunfishcode commented on Sep 22, 2015

    @sunfishcode
    Member

    I think we've covered all the basic naming discrepancies between spec and design now, with the exceptions of several things which have open issues, such as those mentioned above, #65, etc.

    Of course, if anyone finds any that we missed, please file a new issue!

  14. added a commit that references this issue on Nov 19, 2019
  15. added a commit that references this issue on Jun 15, 2020
  16. added a commit that references this issue on Mar 22, 2023
  17. added a commit that references this issue on Jul 12, 2023
  18. added a commit that references this issue on Sep 25, 2025
  19. added a commit that references this issue on Nov 12, 2025
  20. added a commit that references this issue on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions