I dun a DIP, possibly the best DIP ever

Manu turkeyman at gmail.com
Sat Apr 25 01:31:46 UTC 2020


On Sat, Apr 25, 2020 at 7:00 AM Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

>
> Let's not fall into the mode of only looking at the way C++ did it and not
> seeing other ways. C++ has problems (like not having arrays) that lead it
> in
> different directions for solving array-like problems.
>

It is so predictable that you will eventually produce a sentence like this
whenever I suggest anything.
To be clear; **I started with your proposal** when thinking on this. I
quickly determined it was unworkable.
The fact that I chose the same syntax as C++ is for a few reasons:
 1. we also use `...` to build tuples, it seems natural to invoke the same
syntax here
 2. it turns out that it's grammatically unambiguous!
 3. it's familiar and unsurprising, and there's no compelling reason to
ignore the precedent in point #1 just for the sake of being different than
C++ (which would be the only argument against as far as I can tell)

It's also not a bad idea to look to acclaimed success stories for
inspiration, and I think `...` is probably C++'s biggest success story this
century.
It is not awkward or troubling in C++. It's an unusually excellent piece of
language.

With respect to D though, we gain so much more than C++ can. C++ doesn't
have tuples, but we do!
It applies with a beautiful uniformity, and it's useful in a lot more
situations and with a lot less boilerplate cruft than C++ could ever dream.
This will make junk template instantiations a thing of the past, and it's
also terse and very readable.

I can't imagine a reason to change my proposal. The only reason I would
consider changing it is if you can make your (like-arrays) proposal work...
but it doesn't. I explored that a lot, believe it or not. I really wanted
to believe it could work.

What do other languages do? How are things like this expressed in
> mathematics?
>

C++ uses `...`, and they are the only language that has anything remotely
like this.
Javascript also uses `...` for something similar-ish, so the web guys
should find it familiar too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20200425/eb462c37/attachment-0001.htm>


More information about the Digitalmars-d mailing list