Skip to content

Terminology: overloading versus multiple dispatch #1

@rauschma

Description

@rauschma

Overloading dispatches statically, via static type information (Java). A better term for what you are doing is “multiple dispatch [1]” (Common Lisp, Clojure). You could structure your API like this (possibly with different names):

var createPerson = createMultiMethod();
createPerson.addMethod([String], function (name) { ... });
createPerson.addMethod([String, Number], function (name, age) { ... });
...

[1] http://en.wikipedia.org/wiki/Multiple_dispatch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions