[eeps] allow external function as literals

Björn-Egil Dahlberg egil@REDACTED
Thu Oct 2 11:45:30 CEST 2014


On 2014-10-01 23:55, Tony Rogvall wrote:
> To my (mild) surprise I discovered that the tuples above where NOT 
> generated as literals!
> So of course I checked if there was any particular reason for this.
Was there? =)
>
> I developed a patch produced to patch function return values:
>
> '__ffe_sqr'() -> <<"sqr">>.
>
> here I replaced <<"sqr">>.
> with
>  { 0, <<"sqr">>, fun ffe:docol/4, fun ffe:dupe/0, fun ffe:star/0, fun 
> ffe:semis/0 }.
>
> in the literal section of the beam file using beam_lib and a simple match.
>
> The loader worked and the code now return constant tuples with 
> functions in them.

Could you use these literals? Even if the  external module wasn't loaded?

I only checked the code briefly but I think that if you load an external 
as a literal you have to make a stub for the module if it isn't loaded, 
so the
error handler can load the module later on. But you are a savvy person, 
I think you can figure it out. =)

I'm sure there are other things to consider as well.

>
> Question:
> 1. Is my code going to crash later ?  :-)
> 2. if so can I do anything about it ?
> 3. if not can we get external funs as supported literals ?
>
> /Tony
>
>
> _______________________________________________
> eeps mailing list
> eeps@REDACTED
> http://erlang.org/mailman/listinfo/eeps

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/eeps/attachments/20141002/e144287a/attachment.htm>


More information about the eeps mailing list