Methods (methods v0.1.0)

Documentation for Methods.

This adds method calls for Elixir structs.

Call methods with "..".

This breaks ranges if the second argument is a function call.

defmodule Rect do defstruct [width: 0, height: 0]

def area(self) do

self.width * self.height

end end

defmodule Main do use Methods

def main do

r1 = %Rect{width: 10, height: 10}
area = r1..area()

end end

Summary

Functions

Method call.

Functions

aa..bb

(macro)

Method call.

myDog..bark()

If myDog is a %Dog{}, this calls Dog.bark(myDog).

If the thing after the ".." doesn't look like a method call, this falls back to constructing a range.