<div dir="ltr">Hi,<div><br></div><div>I've stumbled upon a statement in EPP-0045 that made me wonder:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>There is no run-time penality for defining `FUNCTION_STRING`</div><div>yourself, as the compiler will turn either definition of</div><div>`FUNCTION_STRING` into a literal string during compilation.</div><div><div>...</div></div><div><div>Historical note: `MODULE_STRING` was added as an optimization in OTP</div></div><div>R7B, because at the time the compiler did not optimize constant</div><div>expressions as well as it does now.</div></blockquote><div><br>When I tested that on OTP-23.3.4.5 it turned out that the compiled beam file still contained the atom_to_list and integer_to_list calls, e.g. this code snippet:<br><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>test() -></div><div> ?FUNCTION_STRING.</div></blockquote><div><br></div><div>Is contained in the beam file as:<br></div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>test() -></div><div> "test_mod" ++ ":" ++ atom_to_list(test) ++ "/" ++ integer_to_list(0).</div></blockquote><div><br></div><div>What I would have expected is this:<br><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>test() -></div><div> "test_mod:test/0".</div></blockquote><div><br></div><div>Has the optimization been lost or was it never implemented or am I doing something wrong?<br><br>Regards,<br>Andreas<br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><p><span style="font-family:verdana,geneva,sans-serif;font-size:10pt">Andreas Schultz<br></span></p>
</div></div></div>