Skip to content

Public private functions #2587

@alco

Description

@alco

Run this code with elixir using master. The code is originally from https://gist.github.com/anonymous/09fc32b1324e89d03694

#from http://elixir-lang.org/getting_started/8.html

defmodule Math do
  def sum(a, b) do
    do_sum(a, b)
  end

  defp do_sum(a, b) do
    a + b
  end
end

IO.puts Math.sum(1, 2)    #=> prints 3
IO.puts Math.do_sum(1, 2) #=> priv fn should throw error? Why also prints 3?

If you load the file in IEx and use tab completion, it will only show the sum function. But module_info says that both sum and do_sum are exported.

I did a bisect on the source tree and found the commit which introduced the issue: 80b9879

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions