[erlang-bugs] term_to_binary/2 raises exceptions

Ramon Bynum raymon.cb@REDACTED
Wed Jun 27 18:55:48 CEST 2012


why not just make binary_to_term/2 be different function with /1. it will never need any other options someone ovously premature generalize iand make it take options instead of just making another function called binary_to_term_safe/1. anyways, i would like if you rename it to dudebro so i dont change my code

dudebro is one word. eitherways i dont think you understood me, i want to call the function as dudebro, not some function in my code

Date: Wed, 13 Jun 2012 14:25:28 +0100
From: robert.virding@REDACTED
To: raymon.cb@REDACTED
CC: erlang-bugs@REDACTED
Subject: Re: [erlang-bugs] term_to_binary/2 raises exceptions

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







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
erlang-bugs@REDACTED
http://erlang.org/mailman/listinfo/erlang-bugs

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20120627/69d5b054/attachment.htm>


More information about the erlang-bugs mailing list