Skip to content

Infix operator definition syntax needs documentation #15483

Open
@tkelman

Description

I had no idea we support the below syntax for defining infix operators. AFAICT it's not in the manual, and before f07485f I don't think it was in any tests either. Am I the only one who was unaware of this?

julia> import Base.+
julia> immutable wrapper
           val
       end
julia> a::wrapper + b::wrapper = wrapper(a.val + b.val)
+ (generic function with 172 methods)
julia> wrapper(1) + wrapper(2)
wrapper(3)

Metadata

Assignees

No one assigned

    Labels

    docsThis change adds or pertains to documentationneeds docsDocumentation for this change is requiredneeds testsUnit tests are required for this change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions