[erlang-bugs] term_to_binary/2 raises exceptions

Robert Virding <>
Wed Jun 13 15:25:28 CEST 2012


It it binary_to_term/2 which takes 'safe' as an option. It should definitely *NOT* return {ok,Term} | {error,badarg} when the 'safe' option is used; it should always have the same structure for return values irrespective of options. So it either returns a term or signals a value. 

dude_bro would be a better name than dudebro, separating words with '_' in atoms is a common convention. It would be a quick fix for you in your code. 

Robert 

----- Original Message -----

> term_to_binary/2 with [safe] as the second argument either throws an
> exception, or returns the decoded term. wouldnt it be better if it
> return either {error, badarg} or {ok, the decoded term} ? i think it
> should be changed to this. btw while at it can you rename the
> function to dudebro? ive already written my code and it uses that
> name everywher. thanks
> _______________________________________________
> erlang-bugs mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-bugs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20120613/cb2c81fc/attachment.html>


More information about the erlang-bugs mailing list