Moataz Elmasry
Moataz Elmasry

Reputation: 548

What's the reason behind deprecating functions starting with create and replacing them with ones starting with make?

Looking through the documentation, I noticed that a lot of instantiation functions that started with the word create were replaced instead with the word make. Out of interest, any reason why the language had to go through these changes?

Upvotes: 1

Views: 82

Answers (1)

PatJ
PatJ

Reputation: 6144

First of all, I don't know for sure. And the only trace I found of the decision is the commit message. For simplicity, I followed the modifications on array.mli but I guess this applies for the rest of the stdlib. Let's take a trip down the git blame lane.

As I stated in the comments, Array.create was marked as deprecated 19 years ago. The commit message is not very relevant to us:

array.mli: documentation des cas d'erreur de make, make_matrix

Which translate to (translation mine):

array.mli: documentation of error cases of make, make_matrix

This seems like the deprecation itself predates that, even though this is the first trace of "deprecated" I found in that file.

However, the two functions had been coexisting for quite some time. make was added (and immediately presented as the preferred name) in 1997.

In the commit message, you can read:

array.mli, array.ml, random.ml: create -> make (coherence avec String)

Which translate to

array.mli, array.ml, random.ml: create -> make (consistency with String)

In that commit, make is added and documented. create is declared as an alias to make and not documented altogether. Which was probably the way to mark things as deprecated at the time.

tl;dr: Because they wanted to have consistency as the same behavior had different name depending on the data structure. Why did make win? You'll have to ask Damien Doligez (he is still one of the lead developers). Personal guess: make sounds more "imperative" than create does. But I may be thinking taht because I learned OCaml when this choice was already made.

Upvotes: 2

Related Questions