<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">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.<div><br></div><div>Furthermore, you can get around having exactly 3 arguments by passing the arguments in a list to apply.</div><div><br></div><div>Charles<br><div><div>On Nov 25, 2008, at 5:46 PM, Andrew Stone wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">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.<br><br>you've received a string "fun_name", with arguments A, B, C.<br><br>Func = list_to_atom("fun_name"),<br>Func(A,B,C).<br><br>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.<br><br>-Andrew<br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold; ">From:</span></b><span class="Apple-converted-space"> </span>Matthew Williams <<a href="mailto:Matthew_Williams@xyratex.com">Matthew_Williams@xyratex.com</a>><br><b><span style="font-weight: bold; ">To:</span></b><span class="Apple-converted-space"> </span><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><b><span style="font-weight: bold; ">Sent:</span></b><span class="Apple-converted-space"> </span>Tuesday, November 25, 2008 7:58:21 PM<br><b><span style="font-weight: bold; ">Subject:</span></b><span class="Apple-converted-space"> </span>[erlang-questions] Erlang introspection<br></font><br><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="107255300-26112008"><font size="2" face="Arial">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?</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font size="2" face="Arial"></font> </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="107255300-26112008"><font size="2" face="Arial">Thanks</font></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="107255300-26112008"><font size="2" face="Arial"></font></span> </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="107255300-26112008"><font size="2" face="Arial">Matt</font></span></div><br>______________________________________________________________________<br>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.<br><br>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.<br><br>Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.<br><br>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.<br>______________________________________________________________________<br></div></div></div>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a></div></span></blockquote></div><br></div></body></html>