[erlang-questions] noob namespace question

Gianfranco Alongi gianfranco.alongi@REDACTED
Thu Dec 13 07:25:27 CET 2012


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.

-module(capsFuncs).
-export(['Run'/1]).
'Run'(this) ->
    that.


1> c(capsFuncs).
{ok,capsFuncs}
2> capsFuncs:'Run'(this).
that



On Thu, Dec 13, 2012 at 1:37 AM, Richard O'Keefe <ok@REDACTED> wrote:

>
> On 13/12/2012, at 7:14 AM, Rustom Mody wrote:
> > I dont understand. Let me try and be more explicit about my concern.
> >
> > Let h be a higher-order function of one argument (h/1)
> >
> > Now in the call h(foo)
> > How does Erlang know whether foo is a function or an atom?
>
> For one thing, function names in Erlang are *NOT* atoms.
> They are *PAIRS* <atom>/<arity>.  So if you just see an
> atom, it cannot possibly be a function (or the name of a
> function) because there simply is not enough information
> there.
>
> Actually, I told a lie.  Function names are
> module:name/arity triples.  If you are referring to a
> function in the same module, you can omit the module:
> prefix.
>
> If you wanted to call h passing it a reference to a local
> function named foo with 3 arguments, you would have to write
> h(fun foo/3).
>
> In Common Lisp,
>         (h 'foo)                the atom FOO
>         (h foo)                 value of the variable FOO
>         (h #'foo)               the function FOO
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121213/d1fe8080/attachment.htm>


More information about the erlang-questions mailing list