I want to find out, at run time, which info items (e.g. heap_size) process_info/2 supports. This is so I don't have to go changing code every time an item is added (or removed, which seems unlikely). What I have done, which I know is frowned upon, is to use the dreaded process_info/1 BIF to get a list of supported info items, something like this:<br>
<br><span style="font-family: courier new,monospace;">5> [K || {K,_} <- process_info(pid(0,0,0))]. </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[registered_name,current_function,initial_call,status,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> message_queue_len,messages,links,dictionary,trap_exit,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> error_handler,priority,group_leader,total_heap_size,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> heap_size,stack_size,reductions,garbage_collection,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> suspending]</span><br>
<br>Two problems.<br><ul><li>There is a dire warning in red that process_info/1 is for debugging only and that process_info/2 should be used for all other purposes, presumably on pain of death, shunning, excommunication, finger-pointing, or worse :)<br>
</li><li>Not all the supported info items are returned by process_info/1, which of course I can't complain about because it's for debugging only. <br></li></ul>Short of hard-coding the names of all the info items, or scanning the documentation at run-time, is there any way to do what I want to do using only standard BIFs or some other clever thing?<br>
<br>Regards,<br>Edwin Fine<br>