Skip to content

ClimFlows/MemberFunctions.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemberFunctions

Stable Dev Build Status Coverage

Example

    import MemberFunctions: WithMembers, member_functions

    # declare that `MyType` has member functions
    struct MyType <: WithMembers end
    member_functions(::Type{<:MyType}) = (; hello, goodbye)

    # implement member functions as normal Julia functions
    # taking the object as first argument
    hello(::MyType) = println("Hello !")
    goodbye(::MyType) = println("Goodbye !")

    # test
    o = MyType()
    o.hello()
    o.goodbye()

About

Simple and efficient dot notation for Julia

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages