Skip to content

syscall/js: the name "Callback" does not fit to all of its use cases #28711

@neelance

Description

@neelance

Wikipedia says:

In computer programming, a callback, also known as a "call-after" function, is any executable code that is passed as an argument to other code that is expected to call back (execute) the argument at a given time.

This does not apply to all use cases of js.Callback, for example it may be used to register an event listener.

In #26045 the alternative names js.Callable and js.Function have been suggested. While js.Function seems like the simplest name, it suffers from being too common, so the documentation becomes hard to read because the term "function" does not only identify js.Function.

If we want to change the name, we should do so for Go 1.12 because the signature of js.NewCallback already got changed in this cycle, so we should do this breaking change in the same cycle.

(syscall/js is experimental and exempt from Go's compatibility promise)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions