digitalmars.D.learn - tuple (TypeTuple kind) multi-initialization. Actually documented?
- monarch_dodra (11/11) Mar 31 2014 If you declare an instance of a tuple, eg TypeTuple!(int, int,
- bearophile (7/9) Mar 31 2014 It goes against the idea of tuple. No language that I know
- bearophile (5/9) Mar 31 2014 (5, 5, 5)
- monarch_dodra (7/15) Mar 31 2014 Yes, but at this point, I (we?) don't even know if it's intended
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.
Mar 31 2014
monarch_dodra:bearophile made a suggestion that we should deprecate this. https://d.puremagic.com/issues/show_bug.cgi?id=6367It goes against the idea of tuple. No language that I know 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
Mar 31 2014
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, 5, 5) Bye, bearophile(5,) * 3
Mar 31 2014
On Monday, 31 March 2014 at 21:05:11 UTC, bearophile wrote:monarch_dodra: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.bearophile made a suggestion that we should deprecate this. https://d.puremagic.com/issues/show_bug.cgi?id=6367It goes against the idea of tuple. No language that I know 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.
Mar 31 2014