Again:
defmodule Example do
@doc "This belongs only to use of one particular person or group of people."
def private, do: 5
end
defmodule Example2 do
@doc "This belongs only to use of one particular person or group of people."
def private, do: "Sample"
end
defmodule PrivateTest do
use ExUnit.Case do
test "example" do
assert is_integer(Example.private())
# 2nd assertion would fail
assert is_integer(Example2.private())
end
end
# now look:
defmodule Problem do
def confuse(module), do: apply(module, :private, [])
end
Problem.confuse(Example) # Integer
Problem.confuse(Example2) # String
Person A sign agreement for some job offer. Person B does not know if person A receives payment for hours, specific issue or maybe for whole specific project. That’s why person A should say is saying about agreement name instead of saying saying just about agreement. In any case he/she is working, but this does not mean all cases are exactly same. We could guess, we could assume, but nothing good would happen if we would do so.
That’s why people are using names. If you name something properly other people would understand you without taking care of “source”. Well we could name every pet just pet, because basically all pets are pets. Now you can’t filter images only for cats, because there are no cats - there are only pets. We could generalize everything and saying “thing” on everything, but that would be just confusing.
Just take a look at:
Now say again that private in both cases means exactly same.
This topic does not talk about making some modules private. We are talking about guarding some modules to … (show warning, don’t allow access it unless). This is definitely not how private functions are working.
You think that private is private and there is no way to access private modules. In my linked example I show how it’s possible in specific implementation case. That’s why I mean it’s confusing. They are named similarly, but works differently. private
means private
, but here we have 2 different contexts which makes private
word more than one meaning and that could be confusing.