Proposed change to libraries

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposed change to libraries

Fredrik Linder-2
Yes, it is used in (older parts of) our software at CellPoint.

/Fredrik

> -----Original Message-----
> From: owner-erlang-questions
> [mailto:owner-erlang-questions]On Behalf Of Luke Gorrie
> Sent: den 22 februari 2005 20:40
> To: erlang-questions
> Subject: Re: Proposed change to libraries
>
>
> Bjorn Gustavsson <bjorn> writes:
>
> > Unfortunately, it is tricky to check that {M,F} is a valid
> fun. The module
> > M might not even be loaded.
> >
> > It has been suggested earlier that we should add
> >
> >         fun M:F/Arity
> >
> > to the language. Unfortunately, we didn't add it in R10B.
> We could add
> > it in R11B.
>
> I think it would be nice if this prints as something like:
>
>   #Fun<M:F/Arity>
>
> so that you can easily see where it's pointing.
>
> I also wonder if people are using {M,F}-funs without fixed arity.
> toy example:
>
>   callback(Values, Callback = {M,F}) when list(Values) ->
>       apply(M, F, Values).
>
> Cheers,
> Luke
>
>
>


Reply | Threaded
Open this post in threaded view
|

Proposed change to libraries

Luke Gorrie-3
"Fredrik Linder" <fredrik.linder> writes:

> Yes, it is used in (older parts of) our software at CellPoint.

[...]

> >   callback(Values, Callback = {M,F}) when list(Values) ->
> >       apply(M, F, Values).

but if I had thought a bit harder I'd have realised that this is just
an apply/3 and not really related to the tuple-function business.
That would have to be something like

  CB = {mod,fun},
  if ... -> CB();
     ... -> CB(Arg)
  end

which looks a bit more exotic.

-Luke