[erlang-questions] Improve $handle_undefined_function

Robert Virding robert.virding@REDACTED
Fri Jan 25 13:11:42 CET 2013

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

> From: "Björn-Egil Dahlberg" <egil@REDACTED>

> On 2013-01-24 18:31, Björn-Egil Dahlberg wrote:

> > On 2013-01-24 18:12, Robert Virding wrote:

> > > I think the OTP group made a bad decision *indexing* binaries
> > > from
> > > zero instead of one like the rest of erlang. It is both wrong and
> > > makes the system inconsistent.
> > 

> > Btw, when you say "the OTP group made a bad decision", exactly who
> > are you referring too? Yourself? Isn't these decisions from CS-lab?
> > Certainly way before my time =)

> That probably sounds a bit more irritated than intended.

> I'm honestly curious, who decided indexing on terms and binaries and
> what was the reasoning behind it?

> I think I recall someone saying that binary-syntax was the last thing
> out from CS-Lab?

The decisions were made at different times. 

The choice of indexing in tuples and lists (with the lists:nth function) were made very early when all Erlang work was done by the CS-lab. So they are definitely my fault, partly at least. And I still think it was a good decision. :-) 

Binaries were added when Erlang was still at CS-lab, but there were no indexing operations as such. split_binary/2 ORIGINALLY had as argument the length of the first binary, but now it is the position of the split. It works the same either way. IIRC 

The later BIFs binary_split/2/3 came longer after Erlang left the CS-lab and is in the hands of the OTP group and are explicitly zero indexed. 

My view is that you could choose either depending on you how you swing, but choosing both is definitely the worst option. I am getting old and I value consistency. :-) 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130125/27596725/attachment.htm>

More information about the erlang-questions mailing list