falood / file_system

Filesystem monitor for elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example in README fail with `unbound variable ^watcher_pid`

Nagasaki45 opened this issue · comments

I was surprised to see that it's possible to bind a variable and match against it in the same pattern:

def handle_info({:file_event, ^watcher_pid, {path, events}}, %{watcher_pid: watcher_pid}=state) do

But it doesn't really work. Copying the example to iex raises a compilation error:

** (CompileError) iex:14: unbound variable ^watcher_pid
    (stdlib) lists.erl:1354: :lists.mapfoldl/3
    (stdlib) lists.erl:1355: :lists.mapfoldl/3
    (stdlib) lists.erl:1354: :lists.mapfoldl/3

Elixir: 1.4.5.

I'm really sorry that's a bug, don't need the ^ in function arguments, just remove ^ and make it def handle_info({:file_event, watcher_pid, {path, events}}, %{watcher_pid: watcher_pid}=state) do, have updated README file.
Thank you for reporting ❤️