Skip to content

`MemberFunctions.jl` helps writing member-like functions, reducing the amount of code required to implement them.

Notifications You must be signed in to change notification settings

tehrengruber/MemberFunctions.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemberFunctions.jl

MemberFunctions.jl helps writing member-like functions, reducing the amount of code required to implement them. All functions prefixed by the @member macro can access, i.e. read and write, fields of the first argument directly.

Example

mutable struct Foo
  value
end

@member get_value(foo::Foo) = value

@member function set_value!(foo::Foo, v)
  value = v
end

foo = Foo(1)
set_value!(foo, 2)

get_value(foo) == 1

set_value!(foo, 2)
get_value(foo) == 2

About

`MemberFunctions.jl` helps writing member-like functions, reducing the amount of code required to implement them.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages