Thread overview
tuple (TypeTuple kind) multi-initialization. Actually documented?
Mar 31, 2014
monarch_dodra
Mar 31, 2014
bearophile
Mar 31, 2014
bearophile
Mar 31, 2014
monarch_dodra
March 31, 2014
If you declare an instance of a tuple, eg TypeTuple!(int, int, int), you can initialize all members from a single argument. EG:

TypeTuple!(int, int, int) a = 5;

bearophile made a suggestion that we should deprecate this.
https://d.puremagic.com/issues/show_bug.cgi?id=6367

I'd like to know if this behavior even documented at all, or kind of "just happens to work".

In particular, it doesn't work in CTFE at all:
https://d.puremagic.com/issues/show_bug.cgi?id=12499

I'd like to ask the spec guru's to know which direction to take in dealing with both these issues.
March 31, 2014
monarch_dodra:

> bearophile made a suggestion that we should deprecate this.
> https://d.puremagic.com/issues/show_bug.cgi?id=6367

It goes against the idea of tuple. No language that I know (Haskell, Rust, F#, Python, and more) that has tuples supports the initialization of a n-tuple with a scalar value. It's sloppy. And sloppy designs usually find a way to bite your rump later.

Bye,
bearophile
March 31, 2014
> No language that I know (Haskell, Rust, F#, Python, and more) that has tuples supports the initialization of a n-tuple with a scalar value.

In Python there is a way to build a n-tuple from a 1-tuple, but the seed is not a scalar, and this is an explicit syntax:

>>> (5,) * 3
(5, 5, 5)

Bye,
bearophile
March 31, 2014
On Monday, 31 March 2014 at 21:05:11 UTC, bearophile wrote:
> monarch_dodra:
>
>> bearophile made a suggestion that we should deprecate this.
>> https://d.puremagic.com/issues/show_bug.cgi?id=6367
>
> It goes against the idea of tuple. No language that I know (Haskell, Rust, F#, Python, and more) that has tuples supports the initialization of a n-tuple with a scalar value. It's sloppy. And sloppy designs usually find a way to bite your rump later.

Yes, but at this point, I (we?) don't even know if it's intended behavior to begin with.

If it was an accident it worked to begin with, then it's fate should be sealed pretty fast.

The fact that CTFE doesn't seem to work with it seems (to me) an indication of that.