<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><font color="#333333" face="Geneva, Arial, Helvetica, sans-serif">Hi eep.</font></span></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><font color="#333333" face="Geneva, Arial, Helvetica, sans-serif"><br></font></span></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><font color="#333333" face="Geneva, Arial, Helvetica, sans-serif">In a toy project I am doing I generate code on form:</font></span></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><font color="#333333" face="Geneva, Arial, Helvetica, sans-serif"><br></font></span></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; orphans: 2; text-align: -webkit-auto; text-indent: 0px; widows: 2; border-spacing: 0px;"><font color="#333333" face="Geneva, Arial, Helvetica, sans-serif"><div apple-content-edited="true">-module(foo).</div><div apple-content-edited="true">-export(['_ffe_sqr'/0,'_ffe_sum'/0]).</div><div apple-content-edited="true"><br></div></font></span></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><font color="#333333" face="Geneva, Arial, Helvetica, sans-serif"><div apple-content-edited="true">'_ffe_sqr'() -></div><div apple-content-edited="true">    { 0, <<"sqr">>, fun ffe:docol/4,</div><div apple-content-edited="true">      fun ffe:dupe/0, fun ffe:star/0, </div><div apple-content-edited="true">      fun ffe:semis/0 }.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">'_ffe_sum'() -></div><div apple-content-edited="true">    { 0, <<"sum">>, fun ffe:docol/4,</div><div apple-content-edited="true">      fun ffe:lit/0,  1,</div><div apple-content-edited="true">      fun ffe:pqdo/0, 4,</div><div apple-content-edited="true">        fun ffe:plus/0, </div><div apple-content-edited="true">      fun ffe:ploop/0, -2, </div><div apple-content-edited="true">      fun ffe:semis/0 }.</div></font></span><br class="Apple-interchange-newline">
</div>
To my (mild) surprise I discovered that the tuples above where NOT generated as literals!<div>So of course I checked if there was any particular reason for this.</div><div><br></div><div>I developed a patch produced to patch function return values:</div><div><br></div><div>'__ffe_sqr'() -> <<"sqr">>.</div><div><br></div><div>here I replaced <<"sqr">>.</div><div>with</div><div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;"> { 0, <<"sqr">>, fun ffe:docol/4, fun ffe:dupe/0, fun ffe:star/0, fun ffe:semis/0 }.</div></div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;"><br></div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">in the literal section of the beam file using beam_lib and a simple match.</div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;"><br></div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">The loader worked and the code now return constant tuples with functions in them.</div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;"><br></div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">Question: </div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">1. Is my code going to crash later ?  :-)</div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">2. if so can I do anything about it ?</div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">3. if not can we get external funs as supported literals ?</div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;"><br></div><div apple-content-edited="true" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif;">/Tony</div></body></html>