[erlang-questions] code:load_binary - why there's module as argument

John Doe donpedrothird@REDACTED
Mon Apr 16 20:05:25 CEST 2018

Fair enough, but it would be nice to have a version without such limitation.

2018-04-16 12:05 GMT+03:00 Attila Rajmund Nohl <attila.r.nohl@REDACTED>:

> 2018-04-14 21:11 GMT+02:00 John Doe <donpedrothird@REDACTED>:
>> Hi all,
>> I wonder why code:load_binary() requires module name as one of the
>> arguments? The function would fail if this name is not equal to the real
>> module name from the binary, so it can deduce the correct name. Why it does
>> not allow loading just whatever module from a given binary and return
>> something like {ok, moduleName} as the result?
> ​I guess to avoid overwriting an unexpected module. The input binary can
> contain any code, if it pretends to be the list module, but the caller
> thinks its the strings module, that could be a problem.​
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180416/d166aaea/attachment.htm>

More information about the erlang-questions mailing list