Skip to content

Need better support for multi-methods #23

@cgay

Description

@cgay

A current example that is a bit of a conundrum for me....

The transcendentals module has a lot of functions that have 4 methods. For example, take atan2:

atan2(<single-float>, <single-float>)
atan2(<double-float>, <single-float>)
atan2(<single-float>, <double-float>)
atan2(<double-float>, <double-float>)

How to document these?

Problem 1: Obviously we don't want to duplicate the entire section of documentation for all four methods, but there doesn't seem to be any way to reference a particular method specialization's documentation. It's common to do a minor conversion and then call the "primary" method.

Problem 2: Even if we could reference a particular method specialization, I suspect there would be many cases (and atan2 is an example) where it would be easier to read the documentation if it were all in a single section listing all method specializations. A natural way to do this would be to allow multiple :specializer: annotations under one .. method:: atan2. I'm also thinking perhaps we should allow :specializer: to be used (multiple times) under .. generic-function:: for cases like this where everything is sealed and all methods are known.

(If we do allow multiple :specializer: annotations, it will have an effect on how we solve the "reference a particular method" problem.)

I don't have it all figured out, obviously. Anyone have thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions