Actually, orbitz on freenode #erlang just gave me a tremendously interesting new mechanism that's left me feeling quite stupid for not having thought of it: provide a function that returns the non-exported functions as lambdas. Yes, it's related to the "omg you're breaking export" mindset, but if you take export to be "the things which should be usable under normal circumstances" and declare test time to be a magical time when the laws of common sense don't apply, then this suddenly becomes by far the least offensive hack to this end that I've seen.<br>
<br>Here's a super-cheesy example which works (obviously you'd want to export information like name and arity and whatever, but this gets the idea across):<br><br><br><br><br>-module(run_lambda_export).<br>-export([go/0]).<br>
<br>go() -><br><br> [ F0, F1 ] = lambda_export:get_funcs(),<br> io:format("~p~n~p~n", [ F0(), F1(hello) ]),<br> done.<br><br><br><br><br><br><br><br>-module(lambda_export).<br>-export([get_funcs/0]).<br>
<br><br>internal() -> a_winner_is_yuo.<br><br>hidden(X) -> { you_sent, X }.<br><br>get_funcs() -><br> [ fun internal/0, fun hidden/1 ].<br><br>