Skip to content

Text Format: Clarify symbolic identifiers on function type parameters aren't to be used #1411

@codefromthecrypt

Description

@codefromthecrypt

Currently, the text format defines not only a symbolic identifier for a type, but also, via functype, symbolic identifiers for params. There is ambiguity in the Type Uses documentation caused by this. For example, when one references a type by index, shouldn't its param IDs be inherited if not explicitly overridden?

Ex. one could reasonably think they should.

(type $filter (func (param $offset i32) (param $count i32)))

(func $nop_filter (type $filter) ...)

However, via a discussion with @alexcrichton and @rossberg, it seems the parameter IDs on a type are not intended to be used anywhere. I think there should be a spec or doc change as a result and don't mind either.

a. Remove symbolic param IDs on a function type definition. That removes the ambiguity and eliminates currently useless IDs. If someone wants to document, they can use comments
b. Clarify in the "Type Uses" note that any param IDs on a type referenced by index are to be ignored when binding the symbolic index of locals (and the name section for that matter).

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