[erlang-questions] noob namespace question
Richard O'Keefe
ok@REDACTED
Fri Dec 14 03:16:59 CET 2012
On 13/12/2012, at 7:25 PM, Gianfranco Alongi wrote:
> By implication - what I will write has been said.
> But I will just spend a second reinforcing this and dispelling any misconceptions.
>
> They can - if you force it into an atom.
I am confused by the pronoun references here.
"They" refers to what things?
"can" refers to what action?
"it" refers to what thing?
In the text of mine that was quoted, the claim was that
an atom cannot be a function and it cannot be a function name
all by itself either.
This is true, and has nothing whatever to do with quotation marks.
>
> -module(capsFuncs).
> -export(['Run'/1]).
> 'Run'(this) ->
> that.
>
> 1> c(capsFuncs).
> {ok,capsFuncs}
> 2> capsFuncs:'Run'(this).
> that
The only thing this illustrates is that a quoted atom can be used
as part of a function name, and as far as I could tell, nobody ever
saidotherwise. This example does not show an atom being a function
or being a function name all by itself. The only function in
sight is the one whose name is the triple capsFuncs:'Run'/1,
which may be abbreviated to 'Run'/1 within the capsFuncs module.
IIRC, the original poster said he knew something about Lisp,
so the fact that
(defun |Run| (arg) 'that)
is legal Lisp would have prepared him to _expect_ quoted atoms
to be usable as (parts of) function names.
More information about the erlang-questions
mailing list