What is iota function full name

Jonathan M Davis newsgroup.d at jmdavisprog.com
Fri Jun 21 12:02:10 UTC 2019


On Friday, June 21, 2019 5:10:03 AM MDT JN via Digitalmars-d-learn wrote:
> On Friday, 21 June 2019 at 09:18:49 UTC, Jonathan M Davis wrote:
> So, iota is
>
> > the name of the function, and it doesn't stand for anything.
> > It's just the name of the Greek letter that was used for a
> > similar function in another language that most programmers
> > these days have probably never heard of.
> >
> > - Jonathan M Davis
>
> I don't even understand why get so much inspiration from C++. Why
> not just name it seq or sequence?

Quite a lot of the functions in std.algorithm (especially the functions that
it got early on) are modeled after similar functions in C++, standard
library, and when Andrei wrote those functions, he purposefully made them
use the same names as they have in C++. For anyone already familiar with
those functions in C++ (including iota), having the same names makes sense.
Other people are more likely to look at the names on their own merits, and
as such, the names don't necessarily make as much sense (particularly iota).
Regardless, given that Andrei was heavily involved in C++ long before he got
involved with D, it's not exactly surprising that he'd use the C++ names
rather than coming up with new ones - especially when std.algorithm was
originally heavily modeled after C++'s algorithm header.

Some folks argued a while back that iota was a terrible name and that it
should be changed, but it was decided not to change it. However, truth be
told, if you know what iota is, the name is more descriptive than a more
generic name like sequence or generateRange would be. It's just a terrible
name from the perspective that it's not at all decriptive of what it is.
It's just a name that has historically been used for this particular
operation.

In practice, what tends to happen is that when someone first encounters
iota, they think that it's a terrible name, but in the long run, they just
know what it is, and it isn't actually a problem. Either way, at this point,
names in Phobos don't get changed just because some folks think that a name
isn't as good as it could be or should be, because changing would break
code, and Walter and Andrei do not believe that simply giving something a
better name is worth breaking anyone's code.

- Jonathan M Davis





More information about the Digitalmars-d-learn mailing list