Iota

Paul Backus snarwin at gmail.com
Sat Aug 6 15:11:28 UTC 2022


On Friday, 5 August 2022 at 15:31:18 UTC, Steven Schveighoffer 
wrote:
> As for working with arbitrary types, I don't see a problem with 
> it. If you define ++ on your type or += 1, and it doesn't mean 
> the same as every other type that defines that, then it's on 
> you for not following the conventions. D is a language which 
> uses the introspected abilities of things to define whether 
> they are compatible.

One of the problems with `iota` is that, because it was built up 
by accretion of special cases, it does *not* adhere to any kind 
of consistent structural interface.

For example, this works:

     iota(BigInt(1), BigInt(10))

...but this does not:

     iota(BigInt(1), BigInt(10), BigInt(1))

...because nobody ever bothered to add a `(start, end, step)` 
overload for custom types.


More information about the Digitalmars-d mailing list