[erlang-questions] Erlang introspection

Charles Ahn <>
Wed Nov 26 04:33:14 CET 2008


Isn't there also a problem about memory use in this case? Because  
atoms are never garbage collected, if this service runs too long you  
could completely run out of memory as people try all kinds of weird  
function names.

Furthermore, you can get around having exactly 3 arguments by passing  
the arguments in a list to apply.

Charles
On Nov 25, 2008, at 5:46 PM, Andrew Stone wrote:

> If both sides are erlang you can send the actual fun(), otherwise,  
> on the receiving end you can do list_to_atom on the function name  
> and then call the function with the arguments. For instance you  
> could do something like this.
>
> you've received a string "fun_name", with arguments A, B, C.
>
> Func = list_to_atom("fun_name"),
> Func(A,B,C).
>
> Of course you need the actual function to exist and the parameters  
> to be valid. And IMHO, you also really don't want to be doing stuff  
> like this over a network unless you are VERY careful.
>
> -Andrew
>
> From: Matthew Williams <>
> To: 
> Sent: Tuesday, November 25, 2008 7:58:21 PM
> Subject: [erlang-questions] Erlang introspection
>
> I'm trying to find information about erlangs support for  
> introspection. I've got a program that receives and function name  
> and arguments through a socket and I'd like to use this information  
> to make a function call on the module that receives it. Can anyone  
> suggest a good starting point for finding out how to do this?
>
> Thanks
>
> Matt
>
> ______________________________________________________________________
> This email may contain privileged or confidential information, which  
> should only be used for the purpose for which it was sent by  
> Xyratex. No further rights or licenses are granted to use such  
> information. If you are not the intended recipient of this message,  
> please notify the sender by return and delete it. You may not use,  
> copy, disclose or rely on the information contained in it.
>
> Internet email is susceptible to data corruption, interception and  
> unauthorised amendment for which Xyratex does not accept liability.  
> While we have taken reasonable precautions to ensure that this email  
> is free of viruses, Xyratex does not accept liability for the  
> presence of any computer viruses in this email, nor for any losses  
> caused as a result of viruses.
>
> Xyratex Technology Limited (03134912), Registered in England &  
> Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.
>
> The Xyratex group of companies also includes, Xyratex Ltd,  
> registered in Bermuda, Xyratex International Inc, registered in  
> California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia,  
> Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic  
> of China and Xyratex Japan Limited registered in Japan.
> ______________________________________________________________________
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081125/187f3e82/attachment.html>


More information about the erlang-questions mailing list